mIRC Homepage
Posted By: Neeva IF statement inside the PERFORM - 05/11/11 05:39 PM
Hi,

I want to connect to two different servers. I wish to issue two different nickserv passwords since each server requires a different one.

I have not begun to work on the connecting issue yet. I am just trying to get the password issue setup correctly. Currently it seems that neither nickserv command is executed. Here is what I have in my PERFORM segment:

Code:
//mode $me +x
IF ($server == irc.geekshed.net) {/msg nickserv identify password1}
IF ($server == irc.ipocalypse.net) {/msg nickserv identify password2}


I have been searching for an answer for the last couple of days. I found the IF statement during the search. I have also read that I should not code my actual password into the script. I do not know how to get around that though.

Any help would be appreciated.

Thanks
Neeva
Posted By: pball Re: IF statement inside the PERFORM - 05/11/11 06:38 PM
I use the on *:connect: event to send my identification commands. so just making a little script instead of using perform would probably work best for your situation.

Code:
on *:connect: {
  mode $me +x
  if ($server == irc.geekshed.net) msg nickserv identify %password1
  elseif ($server == irc.ipocalypse.net) msg nickserv identify %password2
}

in the example above you could have the passwords stored in variables you would add to the variables tab of the scripts editor.
Posted By: Tomao Re: IF statement inside the PERFORM - 05/11/11 07:11 PM
You can try using the $iif() and see if that works for mIRC's perform.
Code:
/mode $me +x
/msg nickserv identify $iif($server == irc.geekshed.net,password1)
/msg nickserv identify $iif($server == irc.ipocalypse.net,password2)
Posted By: Riamus2 Re: IF statement inside the PERFORM - 05/11/11 11:29 PM
I think you may be confusing server and network. They are two different things. A network is something like Undernet and Efnet. Each network usually has multiple servers, often with some in different countries. Regardless which server you're on, you are still on the same network.

In most cases, all servers on a specific network use the same nickserv password. If you use $server, you'd have to include every server that the network has. Instead, if you use $network, then it won't matter which server you happen to connect to... the password will be sent.

To get the correct $network name to put in your IF statement, type the following while on that network:

//echo -a $network
Posted By: Neeva Re: IF statement inside the PERFORM - 06/11/11 01:27 AM
Thank you very much!

I tried to incorporate your suggestion. I placed it into my script editor under Remote. I then added my passwords as variables in the Variable tab. I also emptied my Perform statement.

When I connect it does not seem like anything attempts to execute.

Have I done something amiss?

Thanks,
Neeva
Posted By: Neeva Re: IF statement inside the PERFORM - 06/11/11 01:29 AM
Thank you for your suggestion!

I tried your example and it seemed that both statements executed although I had only connected to one server. This caused my passwords to be rejected.

I'm not sure why this might happen.

Thanks,
Neeva
Posted By: Riamus2 Re: IF statement inside the PERFORM - 06/11/11 01:58 AM
Tomao's example will send both commands because of how they are written. You just won't send a password if you're on the wrong server. I would recommend using a normal IF for this instead of $iif.

As for pball's, it should work fine, though there really isn't any reason to use variables. You can just put your password there instead of using a variable. The reason it may not be working is what I mentioned... $server requires that you are on exactly the right server. There could be dozens of servers for a network. If you're going to use $server, you have to put every single possible server on that network or else it won't work except when you happen to join the correct server. That is why I suggested using $network instead.
Posted By: Tomao Re: IF statement inside the PERFORM - 06/11/11 07:54 AM
I wasn't sure if it was possible to use a normal if statement within the perform dialog box. That's why I told Neeva to try $iif and see if it worked out that way.

I do agree with Riamus2 to use $network in place of $server
Posted By: argv0 Re: IF statement inside the PERFORM - 06/11/11 09:56 AM
You can use any mIRC command from inside perform.
© mIRC Discussion Forums