mIRC Homepage
Hello all mirc members. I researched and made automatic code connecting to multiple servers and automatically identifying nicknames for each server. However, the code does not work as I want, so I post here asking you to be familiar with the mirc code to help me make this code work. Thank you very much and hope to receive the code soon.

This is my code:
Code
on *:connect: {
  if ($network == DaVang) || ($network == Rizon) { autoconnect }
}
alias autoconnect {
on *:notice:*:?: {
  if ($network == DaVang) && ($nick == NickServ) {
    if (*nickname is registered* iswm $1-) { /ns identify passnickhere | timer 1 10 /join #davang,#party,#help }
  }
    if (*Nickname is already in use* iswm $1-) { /ns ghost NickName passnickhere | timer 1 1 /nick NickName | timer 1 5 /ns identify passnickhere | timer 1 20 /join #davang,#party }
  }
  elseif ($network == Rizon) && ($nick == NickServ) {
   /nick NickChat | timer 1 5 /join #party,#davang
}
}
You cannot put an ON EVENT handler inside an alias. Your ON NOTICE event already has code inside it which activates only at the 2 networks, so you don't need the ON CONNECT nor the alias.

Also, for future help, it often helps to include debug messages in your code, like
echo -s $script $scriptline event $event nick $nick (1-) $1-
which lets you see whether the problem is that the EVENT isn't being triggered, or the code is not branching inside an if() condition, etc.

Also, since both your events have "nickname is" within their magic string, you can make your event be triggered by fewer false positives by changing it to:
on *:notice:*nickname is*:?: {

You'd still keep the if() conditions the same.
Thank you for your help. But can you rewrite the complete code for me, maroon? Thank you so well
As I said, you can just eliminate the code that's not needed. You'd just delete the final line and lines 1-4. And optionally, replace the 5th line with my example, but do that only once the existing code works. The debug echo is just something you can sprinkle throughout your code as a tracer to see which lines aren't being executed but should be, or are being executed but shouldn't, or to inform of unexpected values in identifiers and variables.
© mIRC Discussion Forums