This is a little rework of a script I found online at http://forums.mirc.com/ubbthreads.php/topics/231245/Mass_PM , uploaded by RusselB (credits to him).
What I changed is:
1) Messages are sent to all regular users not to just voiced users as it was in original script, though this is easily changeable.
2) the script does not send a message to all users in the %rnicks list with a single command (.msg %nicks $1-) anymore, as this was bacically sending messages all at the same time, and it is not possible to delay execution between a message and another this way (to my humble mirc scripting knowledge!).
So what I did is iterating through the list and sending one message at a time with its own timer.
alias msgall {
if !$1 { echo -a No message specified }
else {
var %a = 1, %b = $nick($chan,0,r), %rnicks
while %a <= %b {
var %rnicks = $addtok(%rnicks,$nick($chan,%a,r),44)
inc %a
}
; We grabbed all reg users in a list. This is cool because we could also leave the channel while sending out messages.
; We could message all of the nicknames in the list with a single line:
; .msg %rnicks $1-
; but we won't be able to set a timer for each message so we will retrieve each nick from the array
; and then send each message with a delay
var %rnsize = $numtok(%rnicks, 44)
if ( %rnsize < 1 ) { echo -a There are no regular users. Can't message anyone. }
else {
var %counter = 1
while %counter <= %rnsize {
echo -a Messaging: $gettok(%rnicks, %counter, 44)
; Timers are not code blocking, so we need to spread each message delivery across time
; We will calculate the different start time using %counter
var %incremental_delay = %counter * 5
.timer 1 %incremental_delay .msg $gettok(%rnicks, %counter, 44) $1-
inc %counter
}
}
}
}
Ok, this works and all. But what I can't figure out is the reason for two while loops. You can accomplish this with one loop. You can still have checks for !$1 and no regular users. Instead of putting all the nicks in %rnicks as nick1,nick2,nick3...you can just do $nick(#,%a,r) and when increasing %a, it will return the value of each nick. That's just my opinion though.
Nice idea am very happy today..
www.pass-4sure.ws