mIRC Home    About    Download    Register    News    Help

Print Thread
IF statement inside the PERFORM #234644 05/11/11 05:39 PM
Joined: Nov 2011
Posts: 4
N
Neeva Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Nov 2011
Posts: 4
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

Re: IF statement inside the PERFORM [Re: Neeva] #234646 05/11/11 06:38 PM
Joined: Nov 2009
Posts: 295
P
pball Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
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.


http://scripting.pball.win
My personal site with some scripts I've released.
Re: IF statement inside the PERFORM [Re: Neeva] #234648 05/11/11 07:11 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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)

Re: IF statement inside the PERFORM [Re: Neeva] #234652 05/11/11 11:29 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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

Last edited by Riamus2; 05/11/11 11:32 PM.

Invision Support
#Invision on irc.irchighway.net
Re: IF statement inside the PERFORM [Re: pball] #234654 06/11/11 01:27 AM
Joined: Nov 2011
Posts: 4
N
Neeva Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Nov 2011
Posts: 4
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

Re: IF statement inside the PERFORM [Re: Tomao] #234655 06/11/11 01:29 AM
Joined: Nov 2011
Posts: 4
N
Neeva Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Nov 2011
Posts: 4
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

Re: IF statement inside the PERFORM [Re: Neeva] #234656 06/11/11 01:58 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: IF statement inside the PERFORM [Re: Riamus2] #234659 06/11/11 07:54 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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

Re: IF statement inside the PERFORM [Re: Tomao] #234660 06/11/11 09:56 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
You can use any mIRC command from inside perform.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"