mIRC Homepage
Posted By: Bramzee Problems w/ timers and $read? - 09/11/14 04:35 AM
I'm using a timer to send a message. It's a simple timer with some $calc involved...

example:

Code:
.timerMinuteLeft 1 $calc($3 * 60 - 60) msg # One minute remaining...
.timerFinished 1 $calc($3 * 60) msg # Game Over.
.timerWinner 1 $calc($3 * 60 + 3) msg # WINNER!! - $read(players.txt)


this works up until the last timer. Which outputs: "WINNER!! - "
as well as */msg: insufficient parameters


Tried creating a var to read the file and then replacing the $read with the %varname but that didn't work either. Ideas?
Posted By: patrickplays Re: Problems w/ timers and $read? - 09/11/14 04:48 AM
Code:
on *:text:asdasd:#: {
timertext 1 $calc(1 * 1 + 1) msg # test - $read(text.txt)
}


all i can say is.. this works for me
tried it several times
Posted By: Loki12583 Re: Problems w/ timers and $read? - 09/11/14 04:48 AM
It's resolved at the time you start the timer, you can use $!read to resolve it when the timer triggers
Posted By: Bramzee Re: Problems w/ timers and $read? - 09/11/14 05:00 AM
Originally Posted By: patrickplays
Code:
on *:text:asdasd:#: {
timertext 1 $calc(1 * 1 + 1) msg # test - $read(text.txt)
}


all i can say is.. this works for me
tried it several times


That's working for me. But, I have multiple timers... so I'm thinking that was the problem.


@Loki

Thanks man. That worked. You're always so reliable and helpful smile
Posted By: Wims Re: Problems w/ timers and $read? - 09/11/14 07:39 PM
Always use the 'n' switch unless you specifically wants $read (or $readini!) to evaluate what is read as code. Right now, $read will returns and evaluates the line once of it's own, but your timer will evaluate once again, this is extremely dangerous, more about this here
Posted By: Nillen Re: Problems w/ timers and $read? - 09/11/14 09:01 PM
I actually just finished reading all of this, instead of just skimming over it as I've done a couple times before.

I noticed the issue with "$1- = %variable, $calc($1-)" evaluating and returning the value. Is there a way to prevent this? I'm using a $calc() with user input values myself. (Granted I don't keep any information someone would be interested in in it, but still)
As a temporary solution I added a check for "if (% isin $1-) halt" since I dunno any other means of avoiding this.
© mIRC Discussion Forums