mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Aug 2004
Posts: 3
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

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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.

Joined: Dec 2002
Posts: 266
Z
Fjord artisan
Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
Yes, but the evaulation shouldn't remove the last parenthesis.


You won't like it when I get angry.
Joined: Aug 2004
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Aug 2004
Posts: 3
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

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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)

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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 $(},)

Joined: Dec 2002
Posts: 230
G
Fjord artisan
Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
If your script is a lot more complicated make an alias and use the timer to call the alias. Much easier.

Joined: Aug 2004
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Aug 2004
Posts: 3
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.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 12
T
Pikka bird
Offline
Pikka bird
T
Joined: Dec 2002
Posts: 12
/timer 1 1 if ( $+ $me isop $chan(1) $+ ) echo -a hi

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
$+ 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

Last edited by cold; 14/08/04 07:14 PM.

* cold edits his posts 24/7

Link Copied to Clipboard