Well, neither of those take into account the maximum length you can have in a single message line, which could be a problem depending how many nicks are in the channel.
And, Orion... having
} } at the end of a line in the middle of a script is a good way to run into mistakes, imo.
Here's how I would do it.
on *:text:!slapall:#yourchannel: {
var %cnt = 1
var %total = $nick($chan,0)
while (%cnt <= %total) {
if ($nick($chan,%cnt) != $me) {
; The $iif in here prevents having an extra comma at the end.
var %slapnicks = $iif(%slapnicks,%slapnicks $+ $chr(44) $+ $nick($chan,%cnt),$nick($chan,%cnt))
; If the length is too long, do the first ~400 characters to begin with.
if ($len(%slapnicks) > 400) {
; The first $iif checks to see if this is the first line of the split... you don't need "slaps" at the beginning of every single line.
; The second $iif will display the ending (with a large trout) if this happens to be the last nick that puts it over 400 characters.
describe $chan $iif(!%split,slaps) %slapnicks $iif($calc(%cnt + 1) == %total,with a large trout.)
var %split = $true
unset %slapnicks
}
}
inc %cnt
}
; Display remaining nicks (or all if all of them are less than 400 characters).
if (%slapnicks) { describe $chan %slapnicks with a large trout. }
}
That should work and should let you do this in channels with a lot of people in them as long as you don't have hundreds of people that would cause you to get flooded off by saying too many lines at once.
I threw in some comments to help explain it.
[EDIT] I fixed a mistake. If you tried this before seeing this edit line, then use this copy instead.