ok, I'm trying to gin up a channel blacklist, one that would check the channels a user is in on join against a list, unfortunately I am running into a snag

here's what I got:

Code:
on *:join:#channel: {
  whois $nick
}
raw 319:*: {
  //set %blacklist.check $1-
  //set %blacklist.num $read(blacklist.txt,0)
  set %b 1
  while (%b <= %blacklist.num) {
    //set %blacklist $read(blacklist.txt,%b)
    if (%blacklist iscs %blacklist.check) {
      ban -u300 #channel $2 2
      kick #channel $2 You are in a blacklisted channel.  Please part %blacklist before rejoining. [5 Minute Ban]
      unset %b
      break
    }
    else {
      inc %b 1
    }
  }
}


Now, I took it apart piece by piece and figure the problem starts here:
Code:
    //set %blacklist $read(blacklist.txt,%b)


It will either set it to the first channel in the list and stay there, or simply not set.

Ideas?