|
Joined: May 2008
Posts: 127
Vogon poet
|
OP
Vogon poet
Joined: May 2008
Posts: 127 |
I made a script so that when an OP types !adminalert <name>, they are alerted when that name joins the channel. I finally got it working, and it works nicely, however I want the script to PM every op in the channel.
Is there a way I can get it to do this without individually adding each OPs name in the script?
|
|
|
|
Joined: Jul 2004
Posts: 59
Babel fish
|
Babel fish
Joined: Jul 2004
Posts: 59 |
This is a modified list ops might need to be edited a bit and I know that using a while statment would be best but this should do the trick. Check the mIRC help files on how to use a while statment and the if-then-else for the isop statment. these will help.
Alias MSGOPS { echo 4 * Notifying Op's on # set %i 1 :next set %nick $nick(#,%i) if %nick == $null goto done if %nick isop # MSG $1- inc %i goto next :done echo 4 * End of Ops list }
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
on @*:text:!adminalert &:#: set %watch $addtok(%watch,$1,32)
on !*:join:#:{
if ($istok(%watch,$nick,32)) onotice # $nick just joined and is on the watch list.
}
|
|
|
|
Joined: Jul 2006
Posts: 4,212
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,212 |
on @*:text:!adminalert &:#: set %watch $addtok(%watch,$1,32) I'm not sure the "bot" have to be an op with this event.Only the users that type the command have to, so you should have a if ($nick isop $chan), and you're adding $1 to %watch, should be $2 
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
The bot will have to have ops, as only ops can use the onotice or omsg commands, but it looks like you're right about hixxy using $1 where it should be $2 in the $addtok.
|
|
|
|
Joined: Jul 2006
Posts: 4,212
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,212 |
The OP never said the "bot" have to be an ops, even when he have to alert, but i agree it makes sense.In any case there still miss a if statement because the user that type the !command have to be an op too.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
on *:text:!adminalert &:#:{
if ($nick isop #) set %watch $addtok(%watch,$1,32)
}
on !*:join:#:{
if ($istok(%watch,$nick,32)) notice @ $+ # $nick just joined and is on the watch list.
}
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Would not on *:text:!adminalert &:#:{
if ($nick isop #) set %watch $addtok(%watch,$1,32)
} simply end up setting %watch to !adminalert ? My reading of the OP's original request seems to make this to make more sense on *:text:!adminalert*:#:{
if $nick !isop # { .msg $nick This command is reserved for channel ops }
elseif !$2 { .msg $nick Please use the correct format of !adminalert <nick(s)> }
else {
var %a = $replace($2-,$chr(44),$chr(32)), %b = 1, %c = $numtok(%a,32)
while %b <= %c {
set %watch $addtok(%watch,$gettok(%a,%b,32),32)
inc %b
}
}
}
on @*:join:#:{
if $istok(%watch,$nick,32) { .omsg Watched nick $nick has joined $chan }
}
Admittedly the OP didn't ask for the ability to add more than one nick at the same time, or for the message if the person didn't have access to the command or for the message if the command wasn't issued properly.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Yes, should've been $2 :p
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
LittleJohn: If you're going to use $nick(#,%i) or similar to loop, you can use the extra parameter of "o" to specify only looping through ops rather than having a separate IF.
$nick(#,%i,o)
Invision Support #Invision on irc.irchighway.net
|
|
|
|
|