mIRC Home    About    Download    Register    News    Help

Print Thread
#263015 13/05/18 06:46 PM
Joined: Sep 2003
Posts: 35
O
Ook Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Sep 2003
Posts: 35
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

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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)

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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!

Link Copied to Clipboard