So i have this code running on connect:
Code:
on *:CONNECT:{ 
  if $network == quakenet {
    .timer 1 1 .msg q@cserve.quakenet.org AUTH %myauth $$?*
    mode $me +x
    j #channel1
    j #channel2
    j #channel3
    ...
    j #channeln
  }
}


I need to modify it by adding an auth check BEFORE joins.
I thought of adding a timer with infinite loops and interval 5 seconds.
On each pulse i will check my address and if i'm authed Then i will join

What i've got so far:
Code:
on *:CONNECT: {
  if $network == quakenet {
    .timer 1 1 .msg q@cserve.quakenet.org AUTH %myauth $$?*
    mode $me +x

    .timer 0 2 {

      if $remove($mid($address($me,2),4,99),@,.users.quakenet.org) != %mynick {
        msg script-bot not authed
        inc %trash
        dec %trash
      }

      else {
        msg script-bot authed
        ;j #channel_1
        ;j #channel_2
        ;j #channel_3
        ;...
        ;j #channel_n
        .timer off
        break
      }

    }

  }

}


What am i doing wrong and i can't get it to work?