Trigger with random timer

Post Reply
Jonasbonas
Posts: 1
Joined: Thu Jul 14, 2011 9:38 pm

Trigger with random timer

Post by Jonasbonas »

Im trying to create a trigger with a timer that in CMUD looks like this:

When cmud recieves a certain text from the mud it triggers the following lines:

#WAIT %random(150000,155000)
#PRINT Executing alias 1 in 5 seconds
#WAIT %random(5000,5100)
alias


For Mudlet, this is what i came up with so far but I cant get it to work correctly:

tempTimer( 150+155.random(), [[print("Executing alias 1 in 5 seconds")]] );
tempTimer( 5+5,1.random(), [[send("alias")]] );


And also, is there a way to display the timer so I can keep an eye on the countdown?

Regards
Jonas

Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

Re: Trigger with random timer

Post by Lucky24 »

1) If you supply a number to the random() function, it'll return a number between 1 and that number.
2) use echo() instead of print()
3) if you want your text to parse aliases before sending, use expandAlias() instead of send().

So I would try:

tempTimer(random(155)+150,[[echo("Executing alias 1 in 5 seconds")]]);
tempTimer(random(1)+5,[[expandAlias("alias")]]);

Also, if you're using a lot of WAIT commands, I suggest using the quick queues function, which lets you stack commands and handles the execution of the timers for you.

Post Reply