Congratulations on your efforts.
Regarding the
while
loop that you used:
I suppose you can use a while loop, but that isn't how I would do it.
(Others may differ - let's hope that somebody else comes along and comments here too. )
When working with a list like that, I tend to use a
foreach
loop to iterate through each element.
I experimented with it like this:
Code: Select all
foreach n $lines {
putserv "ison $n"
}
and discovered that the bot was buffering and queuing sending the command to the server like this:
ison nick1 nick2
and discovered that wouldn't work.
Perhaps that is why you tried to introduce a delay with a utimer?
Here is how I did it:
Code: Select all
set x 1
foreach n $lines {
utimer $x [list putserv "ison $n"]
incr x 3
}
and on the couple tests I ran, it seems to work.
I didn't try it with a long list of nicks though. Only a couple.
About the raw binds:
Did you look up raw 461? It would seem that you won't even need it, due to what you are trying to do. Therefore, I would remove that bind.
I am not good with using the scan command. If you want to use scan, then perhaps someone else will come along to discuss that with you.
The return from ISON that triggers a raw bind 303 can be parsed using a different method though.
Like this:
Code: Select all
bind RAW - 303 ison:raw
proc ison:raw { server keyword text } {
global canal_admin
set response [lindex [split $text : ] 1]
set response [string trim $response]
if {$response ne ""} {
putserv "privmsg $canal_admin :$response is online"
}
}
( I can't stand to use
arg
as a variable name. It looks too much like
args
for me. Usually, I use
text
for that variable name. )
The above will not have the bot say anything, if the user is not online.
It would be easy to have it say something, if you were just doing one
ISON command at a time, as in a pub command by a user.
But doing a list of them, and due to the way ISON responds without including the nick that it checked, does not make it easy to do without possibility for confusion. Perhaps someone else will have ideas for you on this.
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !