mIRC Home    About    Download    Register    News    Help

Print Thread
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?

Joined: Mar 2014
Posts: 52
P
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

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
It's resolved at the time you start the timer, you can use $!read to resolve it when the timer triggers

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

Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
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
Joined: Dec 2013
Posts: 779
N
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

Link Copied to Clipboard