mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 83
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2002
Posts: 83
I would like to know why this if don't work normally :

Code:
 if (!(%bot.nick)) return $false  


The variable %bot.nick is setted just before.
I make an echo before this line and the variable is setted.
I make an echo after this line and the variable is unsetted.

I don't understand why the variable is unsetted with the if.
Any idea ?

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Why do you have another parenthesis? Just use:

if (!%variable) statement

The second parenthesis I can only assume is messing it up. mIRc does not have the ability to negate a whole expression outisde of its proper encasing.


-KingTomato
Joined: Apr 2003
Posts: 85
K
Babel fish
Offline
Babel fish
K
Joined: Apr 2003
Posts: 85
you can also use an $iif statement

$iif(%var,what to do if true,what to do if false)


--

katsklaw
Rather experienced Admin
Rather experienced mIRC Scripter
Amateur C Coder
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
For siongle commands that will work, but note that it is NOT what $iif is intended for. If you wish to execute a set of commands - the if statement itself is what you want.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Joined: Dec 2002
Posts: 83
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2002
Posts: 83
Okay KingTomato !

I had set antoher parenthesis in the doubt !
But you seem you don't answer at my principal question :
why mIRC unset my variable (knowing that is a /var ) when I typed this line ???


Joined: Apr 2003
Posts: 85
K
Babel fish
Offline
Babel fish
K
Joined: Apr 2003
Posts: 85
actually I use it for multiple commands as well, however I make aliases and/or custom identifiers and reference.

I also make my custom identifiers as generic as possible so that I can call them from any event that may apply.

ie:
$writecfg

alias writecfg writeini $1-

now I can call $writecfg from any event that writes to an ini file from any statement if or $iif


--

katsklaw
Rather experienced Admin
Rather experienced mIRC Scripter
Amateur C Coder

Link Copied to Clipboard