Random Multi-Slap:{
var %nicklist | [color:#006600]; %max different random nicks [/color]
var %string | [color:#006600]; Output string[/color]
var %max = 10 | [color:#006600]; Start by assuming 5 slaps (times 2 nicks per slap)[/color]
var %nicks = $calc($nick($chan,0) - 1) | [color:#006600]; Total nicks (minus $me)[/color]
[color:#006600]
; Correct %max if there are less than 11 nicks in the channel
;[/color]
if %max > %nicks var %max = $calc($int($calc(%nicks / 2)) * 2)
[color:#006600]
; Build the random nicklist
;[/color]
while $numtok(%nicklist, 32) < %max {
[color:#006600]
; Get the next random nick
;[/color]
var %nick = $nick($chan, $rand(1, %nicks))
[color:#006600]
; Make sure we're not adding ourselves
;[/color]
if (%nick != $me) var %nicklist = $addtok(%nicklist, %nick, 32)
}
[color:#006600]
; Build the output string
;[/color]
while $gettok(%nicklist, 1-2, 32) != $null {
[color:#006600]
; Save the two nicks we're working with
;[/color]
var %2 = $ifmatch
[color:#006600]
; If we reach the end of the %nicklist, substitute "and " for the delimiting ", " and
; append a "." to terminate the string.
;[/color]
if ($numtok(%nicklist, 32) == 2) $&
%string = %string and $gettok(%2, 1, 32) with a large $gettok(%2, 2, 32)
[color:#006600]
; Otherwise, just delimit each string addition with a ", ".
;[/color]
else $&
%string = %string $+ , $gettok(%2, 1, 32) with a large $gettok(%2, 2, 32)
[color:#006600]
; Delete these two nicks from the %nicklist
;[/color]
%nicklist = $deltok(%nicklist, 1-2, 32)
}
[color:#006600]
; Perform the slap, chopping off the initial ", " in the process.
;[/color]
describe $chan slaps $right(%string, -2)
}