mIRC Homepage

[7.52.425] if () bug

Posted By: Ook

[7.52.425] if () bug - 13/05/18 06:46 PM

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
Posted By: maroon

Re: [7.52.425] if () bug - 13/05/18 07:08 PM

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)
Posted By: Raccoon

Re: [7.52.425] if () bug - 13/05/18 11:53 PM

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.
© 2021 mIRC Discussion Forums