Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Jonasbonas
Newbie


Joined: 12 Jul 2011
Posts: 3

PostPosted: Tue Jul 12, 2011 6:33 pm   

Countdowntimer to trigger on trigger
 
Hi everyone Very Happy

Im trying to create a countdownclock or timer that starts the countdown when one of my triggers trigger.
Eg. I have a short alias sent to my mud every 150-160 sec and I want the clock to start the countdown in a button when that trigger fires so I can keep an eye on how many seconds theres left before the triggers fires again.

I have no idea on how to make such script/button!

Regards
Jonas
Reply with quote
aslanthekat
Novice


Joined: 17 Sep 2007
Posts: 44
Location: Missouri

PostPosted: Tue Jul 12, 2011 8:50 pm   
 
Code:
#alarm countdown {-150} {do something here}
#alarm {-1} {#math time %alarm(countdown)/1000}
#BU buttontimer {@time}
The first line executes your command every 150 seconds
The second line changes the caption of your button every 1 second
Third line just makes the button with a variable caption
Reply with quote
Jonasbonas
Newbie


Joined: 12 Jul 2011
Posts: 3

PostPosted: Tue Jul 12, 2011 9:37 pm   
 
I only want the timer to count down from 150 to 0 secs when a trigger I have fires. That trigger fires every 150 sec and sends a text to the mud, I want the timer to trigger on that text and start the countdown to 0
And next time the trigger fires the timer will start a new countdown.
Reply with quote
aslanthekat
Novice


Joined: 17 Sep 2007
Posts: 44
Location: Missouri

PostPosted: Wed Jul 13, 2011 12:54 am   
 
Trying to understand...You already have a trigger that fires every 150 seconds. When that trigger fires, you want this timer to start...
add the following to the trigger you already have
Code:
#alarm countdown {+150}

Then create these two...
Code:
#alarm {-1} {#math time %alarm(countdown)/1000}
#BU buttontimer {@time}
If this isn't what you're after, please post what you already have. I'm a little confused.
Reply with quote
Jonasbonas
Newbie


Joined: 12 Jul 2011
Posts: 3

PostPosted: Wed Jul 13, 2011 2:00 pm   
 
Correct! It now work just fine, thank you for your help!

Regards
Jonas
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jul 14, 2011 1:51 pm   
 
If you already have a trigger firing every 150 seconds, then there is a better way of doing this which only uses a single alarm. In your trigger, replace that first alarm command with this:
Code:
time = 150

Then change the second alarm to this:
Code:
#alarm {-1} {#if (@time > 0) {time = (@time - 1)}

Leave the button the same.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net