mIRC Home    About    Download    Register    News    Help

Print Thread
Timed Random Messages #81967 05/05/04 04:50 AM
Joined: Jan 2004
Posts: 16
S
SuperMappy Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jan 2004
Posts: 16
How can I get Mirc to post random messages from a timer?

This line:

/timer 0 3600 /msg #chat $read c:\mIRC\stuff.txt

will just display the same message once every hour.

2nd question:

It isn't that important but how can I set up random timer intervals to do the same thing basically?

Thank you

Re: Timed Random Messages #81968 05/05/04 05:47 AM
Joined: Dec 2002
Posts: 94
K
krunch Offline
Babel fish
Offline
Babel fish
K
Joined: Dec 2002
Posts: 94
question 1
Code:
timer 0 3600 /msg #chat $read(c:\mIRC\stuff.txt,$rand(0,$lines(c:\mIRC\stuff.txt)))


random timers id make a alias that started a new timer and use this in the alias
Code:
timer 1 $rand(60,3600) /msg #chat $read(c:\mIRC\stuff.txt,$rand(0,$lines(c:\mIRC\stuff.txt)))



Lets get dirty
Re: Timed Random Messages #81969 05/05/04 08:49 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hello,

in those examples, the timer would display the same message each time the timer is called upon, if the timer is triggered in an alias. That is cuz that $read identifier is evaluated the first time, and then it will put out that value each time the timer is called. So if this timer would be called from an alias, it would print the same thing each time. If the person types that timer code manually, then it will do what he wants it to do (assuming he only uses one /). If he triggers it from an alias, (or uses //) then he has to make the timer re-evaluate the $read each time the timer is called upon.

That can be done as following:

alias time.stuff { .timer 0 3600 msg #chat $!read(c:\mIRC\stuff.txt) }

Usage: /time.stuff

Note that you do not need to specify $rand, because as stated in the help file:

//echo $read(funny.txt)
--> Reads a random line from the file funny.txt.


Greetz






Gone.
Re: Timed Random Messages #81970 05/05/04 02:44 PM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
//timer 0 3600 /msg #chat $!read(c:\mIRC\stuff.txt)

Each time a $!identifier is parsed, one ! will go away.
Another solution is using $eval($read(c:\mIRC\stuff.txt),0)

In a script you can remove the // or / in front of commands, in an editbox use / if you do not want it's arguments parsed and // to parse them (like in a script)

Re: Timed Random Messages #81971 05/05/04 03:01 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
2.
Code:
//timer[color:blue]MMIVVVI[/color] 1 3 echo -a $!read(versions.txt,n) $chr(124) .timer[color:blue]MMIVVVI[/color] 1 $!rand(3,9) $!timer([color:blue]MMIVVVI[/color]).com

MMIVVVI can be any unique name for the timer, but must be the same in all three positions.
If you type /timer after starting the above you will see an entry as below.
* Timer mmivvvi 1 time(s) 3s delay echo -a $read(versions.txt,n) | .timerMMIVVVI 1 $rand(3,9) $timer(MMIVVVI).com