mIRC Home    About    Download    Register    News    Help

Print Thread
Problems w/ timers and $read? #248985 09/11/14 04:35 AM
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
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?

Re: Problems w/ timers and $read? [Re: Bramzee] #248986 09/11/14 04:48 AM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
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

Re: Problems w/ timers and $read? [Re: Bramzee] #248987 09/11/14 04:48 AM
Joined: Jan 2004
Posts: 1,350
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,350
It's resolved at the time you start the timer, you can use $!read to resolve it when the timer triggers

Re: Problems w/ timers and $read? [Re: Loki12583] #248988 09/11/14 05:00 AM
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
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

Re: Problems w/ timers and $read? [Re: Bramzee] #248995 09/11/14 07:39 PM
Joined: Jul 2006
Posts: 3,889
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,889
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Re: Problems w/ timers and $read? [Re: Wims] #249000 09/11/14 09:01 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net