mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
Code:
on *:join:#:{
  writeini recuta.ini Recrutas $nick Waiting
}
on *:text:!next*:*:{ 
  chanserv voice $chan $readini(recruta.ini.....)
}


Hi guys, i need help in this code... I want to make a waiting code.

I want to do <!next> and the bot will give voice to the first person that joined the channel. Like..

John1 - Joins
John2 - Joins
john3 - Joins

So, the bot ill put them in order of arrive, and when i do !next it ill give voice to John1 because he was the first to arrive at the #.

I started by trying to work with the $ini but i don't know how to make it read the first line only. Like $line(recruta.ini,1) Something like that idk =|
And after he gives voice, he eliminates the $nick from the list, getting John2 to the top of the list.

Last edited by DukeHH; 18/04/11 01:45 PM.
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Here is a version with a global variable:
Code:
;note: the ! mean if ($nick != $me), we just store each nick in %wait
on !*:join:#:set %wait %wait $nick
;we check if $gettok(%wait,1,32) (which represent the first person in the list (so the first person who joined)) is on the channel
;if so, voice him, but in any case we delete him from the list so $gettok(%wait,1,32) will represent the next person next time
on *:text:!next:#:if ($gettok(%wait,1,32) ison $chan) cs voice $chan $v1 | set %wait $remtok(%wait,$v1,32)
It doesn't seem necessary to use a ini/text file or any other storage method than variable just for that, but here is a text file version:
Code:
on !*:join:#:write wait.txt $nick
on *:text:!next:#:if ($read(wait.txt,n,1)) ison $chan) cs voice $chan $v1 | write -dl1 wait.txt


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
Tnk you very much dude!

Ye i dindt want the .txt or .ini version i actually prefer the other on. Explain me just someting what 32 means in here -> ($gettok(%wait,1,32) ?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Your token-string of nicknames in %wait is separated by spaces. "32" is the ascii value for "space". See "/help token identifiers". smile

And I suggest the following addition (that makes further use of them token identifiers):
Code:
; if a user on the wait-list changes his nickname, put the new nickname in place of the old one
on *:nick: if ($findtok(%wait,$nick,32)) set %wait $puttok(%wait,$newnick,$v1,32)

Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
ye nice tip!

thank you.

How can i make th ebot identify a nick level?

Like i want that when some 1 joins the channel the bot alert the admins so they know that some 1 is waiting.

Like..

Code:
on !*:join:#:set %wait %wait $nick | msg <idk what to put here>($level == Admin) Some 1 has joined the #!


something like this.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
If you already have the users added as admins in mIRC's users list, you can simply use:
Code:
on admin:join:#:{
This will trigger and match with the ones added in the users list.

Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
?

That's nothing like that dude..
Code:
on !*:join:#:set %wait %wait $nick | msg [b]<idk what to put here>[/b]($level == Admin) Some 1 has joined the #!


When some1 joins the channel i need to send a message to all users with acess Admin or if possible to all users in a ini so i can manage the staff in the channel.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Did you use mIRC's inbuilt users list? The $level() identifier is used to reference the users added in it.

I'm not sure if that's a custom identifier you have. There's no such identifier as $level but $level() and $ulevel == something

Last edited by Tomao; 18/04/11 04:03 PM.
Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
yes i do.

i was trying something like this
Code:
.... | msg $(something)($level == Admin) <message>



i don't know what is the idenitifier for some1 in the user list

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
What is the format you've added in the users list? What does it look like?

Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
omg...

You use level numbers like 5, 10 to get level to some1.

I use words. Admin, Regular.

Its the same. I just need an identifier to the nicks in the user list.

like
Code:
on *:text:!Users*:#: msg $nick The Users With Acess Are: (and where stand the identifier, lets suposse that is $userlist)
: So it will be:

on *:text:!Users*:#: msg $nick The Users With Acess Are: $userlist

:And the bot says:

The Users With Acess Are: John Paul etc etc...


Got it? i need an identifier but i think that there is none for what i want, so im asking if some1 knows how to get all users for what i need.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Quote:
omg
does not apply to my understanding of what you try to do based on the example provided.
Quote:
Got it?
That is a no, your description is sort of vague.

I was just trying to find out what you have done to add the user level in the user list.

Some people add them as

/auser -a 100 Nick
or
/auser -a 1,3,5 nick

or /auser -a Admin user

if you're gonna find out all the users added in the user list, you may need to user a while loop in conjunction with the $ulist() identifier.

Joined: Apr 2011
Posts: 8
D
DukeHH Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Apr 2011
Posts: 8
/auser admin nick

like i said normal way...

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Thank you. You can do it like this:
Code:
on !*:join:#:{
  var %u = 1
  while ($ulist(*,admin,%u)) {
    if ($nick == $v1) {
      msg $chan Admin $v1 has joined $chan $+ !
    }
    inc %u
  }
}
This will send a message to any user added with "admin" access in the user list.

If you're gonna match with other accesses you've added, the code will need to be modified. Currently it will match the admin only.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As stated, you will have to loop through your user list. A faster method if the admins rarely change is to just put them directly into the msg command...

/msg nick1,nick2,nick3 This is the message.

If they do change regularly, then you'll want to loop through the user list by using a while loop and checking $ulist(*,admin,N), where N is the number that you are checking. You'll want to loop from N=1 to N=0 (0 being the total). You can add those to a variable in the format of nick1,nick2,nick3 within your loop so that you can then message them all with a single /msg command.

Code:
on !*:join:#yourchannel: {
  var %c = 1, %t = $ulist(*,admin,0)
  while (%c <= %t) {
    var %admins = $addtok(%admins,$ulist(*,admin,%c),44)
    inc %c
  }
  msg %admins Your message here.
}


Btw, unless you are completely positive that your number of waiting users will never grow to be really large, you may want to consider something other than a variable. A variable is fine for "small" numbers of nicks (you have about 4000 characters to work with in mIRC 7.x). But if you think it might grow beyond that, you're better off just using a text file and deleting row 1 each time you are done with that user. It's very easy to manage that way and is only limited in size by your hard drive.

** Note that I did not put in a check to make sure that you actually have users with the level of "admin". You could add something like that, but it's unlikely you'll ever need it as long as you make sure you always have someone with that user level.

Last edited by Riamus2; 18/04/11 05:37 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: Tomao
This will send a message to any user added with "admin" access in the user list.


He wants it to notify all admins with someone gets added to the waiting list. So you're not notifying the channel that an Admin arrived. smile


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
It seems to me he wants a code to identify the users added with the admin user level upon joining.

My example compares one nick with the user list at a time when he or she joins a channel where the code is run.

Riamus2's example works well for a text event based operation, where it will message multiple nicknames at the same time, depending on how many nicknames your network supports for multiple targets.

Then again, I could have misunderstood his main intent for a desired code.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Quote:
When some1 joins the channel i need to send a message to all users with acess Admin or if possible to all users in a ini so i can manage the staff in the channel.


I believe this script is for a #help type of channel, where the first user to arrive gets help first, and then down the list. If someone gets added to the waiting list, all admins are notified in case it's been quiet and no one is actively monitoring the channel. Admins then help the first person in the waiting list. Once done, they can use the !next command to then help the next person if there is one. Typically, these will voice the person being helped so they can talk in a moderated channel.

You do bring up a good point about the maximum number of people the network lets you send a message to at one time. It may be necessary to modify the script if the level is lower than the number of admins. That's an easy change, but I'd need some idea from the OP as to how many can be messaged at one time on that network.

I also edited my script above so that it's in the join event to prevent any confusion. Originally, I was just explaining what needs done, but in hindsight, I think showing it in the event will be less confusing.

Last edited by Riamus2; 18/04/11 05:38 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Yes Riamus2, I may have been befuddled by his explanation somewhat. Now the quote you've shown me, again, appears to be a bit confusing per se, whereas "send a message to all users with acess Admin or if possible to all users in a ini" ; to me, that's where the misunderstanding takes place. lol

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, if you break it into two parts (reworded slightly)...

1) Send to all users with admin access
- So send the message to everyone with the admin access level.

2) Or if possible to all users in an ini
- Or the OP can make an INI file (or other type of file) and then send to everyone listed in that file. Basically, if it can't be done using the access levels (which it can), then this is an alternative.

I hope that helps clear it up. I know the thread has gotten a bit confusing and mixed up with trying to sort out what was needed. Maybe I'm wrong, but going off what's been said, it really sounds to me like a help channel script and that's how those function. smile


Invision Support
#Invision on irc.irchighway.net
Page 1 of 2 1 2

Link Copied to Clipboard