menu nicklist {
; show this popup only if 1) you're olined (usermode o) and 2) one to 999 nicks are selected in the nicklist
; if you don't like the o-line check, simply remove the "(o isin $usermode) &&"
$iif((o isin $usermode) && ($snick($active,0) isnum 1-999),·RandomNick $v1 users) : { randnicks $0 }
}
alias -l randnicks {
; set %n to total number of selected nicks; ask for nick prefix ($gettok ensures you don't try to use spaces here)
; if you don't like the input prompt, just hard-code it here
var %n = $1, %prefix = $$gettok($input(What prefix shall the new nicks have?,eog,Mass-svsnick of %n selected user(s)),1,32)
; loop selected nicks (last to first)
while (%n > 0) {
; draw a random 3-digit number (zeropadding low numbers)
var %nicknr = $base($rand(1,999),10,10,3)
; this number hasn't been used so far
if (!$var($+(%,randnick.,%nicknr),1).local) {
; set a local variable to mark this number as used
var % $+ randnick. $+ %nicknr
; issue the svsnick command ( $snick($active,%n) is the currently processed nick )
.msg operserv SVSNICK $snick($active,%n) $+(%prefix,-,%nicknr)
; proceed with next nick
dec %n
}
}
}