mIRC Homepage
Using version 6.03 here, but i had someone test with 6.16 and got the same results.... the problem is as follows:

This works as it should:
/timer 1 1 //if ($me isop $chan(1)) echo -a hi

This does not:
//timer 1 1 if ($me isop $chan(1)) echo -a hi

if you check the /timers after starting the second timer, it appears like this:
* Timer 1 1 time(s) 1s delay if ($me isop #chan echo -a hi (Network)

Notice no ) after #chan
This means you can't use an if statement in a timer if it's called from an alias or remote. When the timer goes off it returns:
* /if: invalid format

Adding more )'s does not change anything in the display of /timers
For Example:

//timer 1 1 if ($me isop $chan(1)) echo -a hi

IS THE SAME AS

//timer 1 1 if ($me isop $chan(1))))))))) echo -a hi


Now, I know workarounds for the problem, (make an alias to evaluate the if, put a space after #chan before the bracket, etc, etc) but I thought the bug should be reported anyway, and hopefully it can be fixed. smile
Posted By: Iori Re: //timer eating ) brackets in if statement - 03/08/04 08:57 AM
Yeah the "$chan(1))" part gets evaluated when you set the timer, but the "($me" doesn't because of the "(". To avoid it, use $!chan(1)) to delay evaluation until the timer executes so both parts of the if statement can be evaluated together.
Posted By: zack Re: //timer eating ) brackets in if statement - 03/08/04 09:01 AM
Yes, but the evaulation shouldn't remove the last parenthesis.
Right... That would work for a line as simple as this, but the actual script i'm trying to create is a lot more complicated, the $chan(1) needs to be evaluated when the timer is set, not when it executes since it's set up in a loop and there are multiple timers and multiple channelnames
Posted By: Iori Re: //timer eating ) brackets in if statement - 03/08/04 09:13 AM
It always does when evaluating $identifiers with parameters . smile

//echo -a $chan(1))
^^ will not have a parenthesis added to the channel name.

//echo -a $scon(1))
^^ Won't be 1)
Posted By: Iori Re: //timer eating ) brackets in if statement - 03/08/04 09:15 AM
mm well, you can also use this format

//timer 1 1 if $me isop $chan(1) { echo -a hi }
//timer 1 1 if $!server && $me isop $chan(1) $({,) echo -a hi $(},)
Posted By: greeny Re: //timer eating ) brackets in if statement - 03/08/04 11:42 AM
If your script is a lot more complicated make an alias and use the timer to call the alias. Much easier.
Posted By: TheBlackPanther (Addition to original report) - 04/08/04 06:14 AM
Actually, the $me should have been evaluated when the timer was set as well, instead it showed as ($me


Please Note: I won't be responding to anyone offering work arounds. I know how to make mIRC do what I want. The simple fact is, it's not functioning the way it seems it should.
Posted By: starbucks_mafia Re: (Addition to original report) - 04/08/04 10:55 AM
The reason $me isn't evaluated is because there's a parenthesis '(' in front the the dollar sign. mIRC only evaluates things when the first character is either '%' or '$'. The simple solution to the problem, and it's not a problem that mIRC can really fix - just an unfortunate consequence of unquoted strings, is to put a space between the parentheses and the operands.
Posted By: TimeFX Re: //timer eating ) brackets in if statement - 07/08/04 11:16 PM
/timer 1 1 if ( $+ $me isop $chan(1) $+ ) echo -a hi
Posted By: cold Re: //timer eating ) brackets in if statement - 14/08/04 07:12 PM
$+ aren't needed, / isn't used (it's // that's used), therefore, $me and $chan(1) shouldn't be evaluated.
As it was suggested before, use //timer 1 1 if ($me isop $!chan(1)) echo -a hi
© mIRC Discussion Forums