I came across this script Author unknown but cant get it to work. Using mIRC 7.36 in remotes as a channel bot. Please advice

Quote:
;Swearwords============================

on @*:TEXT:*:#: {
; The list of swears. Words should be separated by commas
var %swears = fark,shoot,mittens
; Number of times to warn before banning
var %warns = 2
var %x = $numtok(%swears,44)
tokenize 32 $strip($1-)
while (%x) && ($nick isreg $chan) {
if ($istok($1-,$gettok(%swears,%x,44),32)) {
inc $+(%,swear.,$wildsite)
var %n = $($+(%,swear.,$wildsite),2)
if (%n <= %warns) {
notice $nick $nick $+ , this is your $ord(%n) warning for using forbidden language in this channel. $iif(%n = %warns,Breaking the channel rules one more time will result in ban.)
}
elseif (%n > %warns) {
ban -ku300 $chan $nick 2 Using forbidden language
unset $+(%,swear.,$wildsite)
}
}
dec %x
}
}
; Reset all of the swear data on mIRC start
on *:START: { unset %swear.* }


Not sure about the while (%x) && ($nick isreg $chan) {
changed it to while (%x) {
But still not working when using one of the words in channel