Originally Posted By: Riamus2
You'd need to prevent the evaluation.

.timer 1 5 if ($($nick isreg $chan,0)) { mode $chan +h $nick }

the easiest way to think about this is by asking the question "how will that look after a single evaluation?". mIRC evaluates the .timer line once initially, just as it would the arguments to any other command (well, it also handles variable related commands in a special way, but that's not important at the moment :P). that's why we can use //echo to see what the timer is likely to perform, if our instinct fails us:

//echo -a if ($($nick isreg $chan,0)) { mode $chan +h $nick }

= if ($($nick isreg mode +h

not really what we want :P

this is because '($($nick' fails to evaluate due to '(' touching '$nick'. then '$chan,0))' gets evaluated as an identifier in full, and { } get chomped away (which is ok since there's just a single command).

if we can recognize that what we want produced is:


if (<value of nick> isreg <value of $chan> ) mode <value of $chan> +h <value of $nick>

then we can can quite easily see that the solution is:

.timer 1 5 if ( $+ $nick isreg $chan ) mode $chan +h $nick

we must be careful though, $nick / $chan may contain characters that could interfere with the code later when the timer executes its command ($nick = '{' or '}', $chan containing unbalanced parentheses, or beginning with '#$' which is evaluated as an identifier). setting variables or sticking information in the timer name and using $ctimer is generally advised. there's also a $safe_eval() snippet lying around if someone wants to share it.

"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde