mIRC Home    About    Download    Register    News    Help

Print Thread
[7.52.425] if () bug #263015 13/05/18 06:46 PM
Joined: Sep 2003
Posts: 30
O
Ook Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Sep 2003
Posts: 30
I found an odd bug when trying to /run after an if()

Code:
alias test_fail {
  if ($isfile($mircexe) && $isfile(versions.txt)) run versions.txt
}


gives the error: * /if: 'run' unknown operator

Re: [7.52.425] if () bug [Re: Ook] #263016 13/05/18 07:08 PM
Joined: Jan 2004
Posts: 1,187
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,187
It has always been this way, it needs extra parenthesis, as this also does the same thing:

Code:
//if (1 && 1) echo -a test
vs
//if ((1) && (1)) echo -a test


also, it appears versions.txt goes into the same folder as mirc.exe, so if mirc.ini is in appdata\roaming\mirc\ and mirc.exe is elsewhere, this will not find versions.txt unless you do something like:

//run $qt($nofile($mircexe) $+ versions.txt)

Re: [7.52.425] if () bug [Re: maroon] #263017 13/05/18 11:53 PM
Joined: Feb 2003
Posts: 2,652
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,652
As maroon said above, it's best to always group each condition in its own parenthesis.

Code:
Do:
if (condition) || (condition) then stuff
if ((condition) || (condition)) then stuff

Avoid:
if (condition || condition) then stuff

Addition of { } to make it more readable or support multiple lines or piped commands.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!