mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2009
Posts: 5
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2009
Posts: 5
Im running several timers. On activation the timers post messages like "* Timer 5 activated" in the Status window. Is there a way to suppress these messages from appearing? TIA

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Put a dot in front of your timers to silence them.
/.timer

Joined: Mar 2009
Posts: 5
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2009
Posts: 5
Thanks for your help. That worked. Im sure its in the mIRC help somewhere but I will be danged if I could find it.

Next question: can this be done? /timer5 0 $rand(10,40) /echo Hi
I keep getting an error.....

Scamp

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
1) You aren't specifying where you want the echo to go to.
2) Next time, supplying the error message would be of a lot of help.

Joined: Mar 2009
Posts: 5
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2009
Posts: 5
The error is simply reported as this line in my alias.ini
/timer5 0 $rand(10,40) /echo Hi

ok. I forgot the -s i.e. /timer5 0 $rand(10,40) /echo -s Hi

If I eliminate $rand(10,40) and replace with say 10
it runs every 10 seconds. I assume the $rand function
would be re-evaluated with each run, but I guess not????


Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
//.timer5 0 10 echo -s $rand(10,40) Hi

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
That would run every 10 seconds, displaying the random number and the message.
As I understand the OP, he wants it to run at different intervals, with the interval being randomized.

To the OP: The problem that I can quickly foresee with that situation can be described with the following example.

1) Timer is started
2) Random time of 20 is picked
3) script waits 20 seconds
4) random time of 30 is picked
5) script waits 30 seconds
6) random time of 15 seconds is picked
7 script waits 15 seconds
etc. etc. etc.

ie: Due to the fact that the message doesn't get displayed until after the delay time has elapsed, setting a new delay time, each time, would mean that the message would never get displayed.

Re-reading your response regarding the error, it appears that you have the /timer command as a single line in the aliases.ini file.
In the alaises.ini file, you should have nothing except aliases, so the /timer command is invalid as an alias.
I suggest moving the code to a remote script, and if you want it as an alias, then use the alias prefix.

Last edited by RusselB; 07/03/09 11:04 PM.
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
i don't see there being a problem as long as you make it correctly

in this case, of course, you're forced to keep restarting a timer with 1rep. simple example:

Code:
//.timert5 1 $r(10,40) echo hi $(|) .timert5 1 $!r(10,40) $!timer(t5).com 


i named the timer t5 instead of 5 so it could be referenced accurately by $timer(). in general it's best to avoid naming such things as timers, @windows, hash tables etc. as integers especially when the associated identifiers would otherwise mess up!


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Mar 2009
Posts: 5
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2009
Posts: 5
Thanks for all the great feedback. Im an Airline Pilot not a programmer hihi, but this is how I eventually solved my problem:

3 aliases:

/start /.timer5 0 1 /operate

/operate set %ptime $rand(10,80) | /.timer5 off | /msg #mychannel $time | /.timer5 0 %ptime /operate

/killtimer /timer5 off

Im sure there is a more elegant way but this seems to work ok.

Thanks again,
Captain Scampy

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
/start .timer5 1 1 operate 

/operate {
  set %ptime $rand(10,80)
  .msg #mychannel $time
  .timer5 1 %ptime operate
}

/killtimer timer5 off

No need to constantly tell mIRC to start/stop the timer, when you can set the number of repetitions to one.
The /operate alias is fine with the pipes (|), I just don't like using them, so I re-wrote it in the format that I prefer.

Also the / character is not required in a scripted code to start a command in the code.


Joined: Mar 2009
Posts: 5
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2009
Posts: 5
Thanks for all the hints...working great now smile

Scampy


Link Copied to Clipboard