Okay, you totally came up with a different solution to solve my problem. And that's also good in my book.
So I have.
var %x = 1
while (%x <= $ialchan($banmask,$chan,0)) {
echo $chan $ialchan($banmask,$chan,%x).nick
/set %bnick $+ $ialchan($banmask,$chan,%x).nick $banmask
inc %x
}
Then I got
%bnickNick1 $banmask
%bnickNick2 $banmask
%bnickNick3 $banmask
Then, for the unban event, I have the same thing, except I used /unset %bnick $+ $ialchan($banmask,$chan,%x).nick. That didn't unset it. I guess I have to play around with it, using [ ] or $eval().