Hi,

I've posted before about an old nick tracking script that I wrote, but I'm now working on a new one. I'm having some problems where it's making a new entry in the text file like the nick or address isn't already there, when it is. I'm changing a few of the words in the script to generic terms, just for personal reasons, but it won't affect the script. Here's the code.
Code:
on 1:JOIN:#Chat: {
  { set -u5 %owner.chan $chan }
  { set %defaultqmsg my quit message
  { set %join.address. [ $+ [ $nick ] ] $address }
  { set %join.compaddress. [ $+ [ $nick ] ] $read(C:\mirc\nicks.txt,w,$address) }  
  { set %join.compnick. [ $+ [ $nick ] ] $read(C:\mirc\nicks.txt,w,$nick) } 
  { set %join.time. [ $+ [ $nick ] ] $mid($ctime,2,8) }
  { set %join.newnick. [ $+ [ $nick ] ] , $+ $nick  %join.time. [ $+ [ $nick ] ] }
  { set %join.bothnew. [ $+ [ $nick ] ] $address $+ , $+ $nick  %join.time. [ $+ [ $nick ] ] }
  if (word1* iswm $nick) { 
    if (%join.address. [ $+ [ $nick ] ] = %join.compaddress. [ $+ [ $nick ] ]) { .notice $me Address Match 4$nick | unset *. $+ $nick }
    else { echo 4 -a No Match $nick | unset *. $+ $nick }
  }
  elseif (word2* iswm $nick) { 
    if (%join.address. [ $+ [ $nick ] ] = %join.compaddress. [ $+ [ $nick ] ]) { .notice $me Address Match 4$nick | unset *. $+ $nick }
    else { echo 4 -a No Match $nick | unset *. $+ $nick }
  }
  elseif (%join.address. [ $+ [ $nick ] ] = %join.compaddress. [ $+ [ $nick ] ]) { .notice $me Address Match 4$nick |  goto NickEval }
  else { write C:\mirc\nicks.txt %join.bothnew. [ $+ [ $nick ] ]  | unset *. $+ $nick | echo 4 -a $nick is a new entry }
  halt
  :NickEval
  if ($nick = %join.compnick. [ $+ [ $nick ] ]) { .notice $me Nick Match 4$nick | write -al %join.compaddress. [ $+ [ $nick ] ] C:\mirc\nicks.txt %join.newnick. [ $+ [ $nick ] ] | unset *. $+ $nick }
  else { write -al %join.compaddress. [ $+ [ $nick ] ] C:\mirc\nicks.txt %join.newnick. [ $+ [ $nick ] ] | unset *. $+ $nick }
}  
on 1:NICK: {
  { set %nick.address. [ $+ [ $newnick ] ] $address }
  { set %nick.compaddress. [ $+ [ $newnick ] ] $read(C:\mirc\nicks.txt,w,$address) }
  { set %nick.compnewnick. [ $+ [ $newnick ] ] $read(C:\mirc\nicks.txt,w,$newnick) }
  { set %nick.newnick. [ $+ [ $newnick ] ] , $+ $newnick %join.time }
  { set %nick.nicktime. [ $+ [ $newnick ] ] $mid($ctime,2,8) }
  { set %nick.bothnew. [ $+ [ $newnick ] ] $address $+ , $newnick %nick.nicktime. [ $+ [ $newnick ] ] }
  if ($newnick = %nick.compnewnick. [ $+ [ $newnick ] ]) { .notice $me $newnick found-not writing | unset *. $+ $newnick }
  elseif (%nick.address. [ $+ [ $newnick ] ] = %nick.compaddress. [ $+ [ $newnick ] ]) { write -al %nick.compaddress. [ $+ [ $newnick ] ] C:\mirc\nicks.txt | .notice $me new nick old address | unset *. $+ $newnick }
  else { write C:\mirc\nicks.txt %nick.bothnew. [ $+ [ $newnick ] ] | unset *. $+ $newnick | echo 4 -a $newnick is a new entry }
}


Thanks for any help.