mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2003
Posts: 29
I
iRP Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Oct 2003
Posts: 29
I was scripting and I discovered a parsing problem with the $iif function. When you enter //echo -a $iif((1) echo -a hello,bye) it will output "hello return 1". I am not sure if this a bug or not because if you enter //echo -a $iif((0) echo -a hello,bye) nothing happens. I just thought I would let you know...


Good job Khaled for 140,100+ lines of source code!!!
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You are getting weird results because you misuse $iif.

$iif(condition,true,false)

You forgot to put a comma after the condition, to seperate the condition from the actions. Also it's not a good idea to use brackets in an identifier like that, they aren't needed even.

What you are looking for is:

//echo -a $iif(0,echo -a hello,bye)
//echo -a $iif(1,echo -a hello,bye)

which are both processed correctly.

Even using brackets, it gave the required result:

//echo -a $iif((0),echo -a hello,bye)
//echo -a $iif((1),echo -a hello,bye)

which were both processed correctly.

However, don't use brackets in the if condition nevertheless.

Greets


Gone.
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Looks like a bug. Even though you used $iif() incorrectly, it should give an error (or at least return $null), not execute a command.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Oct 2003
Posts: 29
I
iRP Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Oct 2003
Posts: 29
I know the correct syntax for $iif is $iif(condition,t,f) but I am just showing you a bug of what happens when you enter //echo -a $iif((1) echo -a test,t) just incase it is not misused in the future.


Good job Khaled for 140,100+ lines of source code!!!

Link Copied to Clipboard