I made a small dialog for private offensive words and I cant get the trigger to work?

Code:
 
dialog spamdetect {
  title "Private Offensive"
  size -1 -1 88 75
  option dbu
  list 1, 2 3 50 59, size
  button "Add", 2, 57 6 24 9,flat
  button "Del", 3, 57 18 24 9,flat
  box "", 5, 53 0 33 60
  button "List", 6, 57 30 24 9,flat
  button "Close", 11, 57 42 24 9,flat,ok,cancel
}
on *:dialog:spamdetect:sclick:2:{
  .write spamdetect.txt $?="Spam Word To Add"
  dialog -x $dname
  dialog -dmn spamdetect spamdetect
}
on *:dialog:spamdetect:sclick:3:{
.write -ds $+ $?="Spam Word To Delete" spamdetect.txt
dialog -x $dname
dialog -dmn spamdetect spamdetect
}
on *:dialog:spamdetect:sclick:6:{
.run spamdetect.txt
}
on *:dialog:spamdetect:init:*:{ 
loadbuf -o $dname 1 $+(",$mircdir/spamdetect.txt,")
}

on *:open:?:*: {
var %Spamword = 1
while (%Spamword <= $lines(spamdetect.txt)) {
if ($+(*,$read(spamdetect.txt,%Spamword),*)  iswm $1-) {
.kick # $nick Private Offensive Language
.mode # +b $nick 2
    }
   inc %Spamword
  }
}
on ^*:notice:*:?: {
  var %Spamword = 1
while (%Spamword <= $lines(spamdetect.txt)) {
if ($+(*,$read(spamdetect.txt,%Spamword),*)  iswm $1-) {
      haltdef
    }
   inc %Spamword
  }
}
alias spamdetect {
inc %i
if (%i == 1) write spamdetect.txt
dialog -dmn spamdetect spamdetect
}