|
Jonasbonas Newbie
Joined: 12 Jul 2011 Posts: 3
|
Posted: Tue Jul 12, 2011 6:33 pm
Countdowntimer to trigger on trigger |
Hi everyone
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 |
|
|
|
aslanthekat Novice
Joined: 17 Sep 2007 Posts: 44 Location: Missouri
|
Posted: 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 |
|
|
|
Jonasbonas Newbie
Joined: 12 Jul 2011 Posts: 3
|
Posted: 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. |
|
|
|
aslanthekat Novice
Joined: 17 Sep 2007 Posts: 44 Location: Missouri
|
Posted: 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. |
|
|
|
Jonasbonas Newbie
Joined: 12 Jul 2011 Posts: 3
|
Posted: Wed Jul 13, 2011 2:00 pm |
Correct! It now work just fine, thank you for your help!
Regards
Jonas |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: 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:
Then change the second alarm to this:
Code: |
#alarm {-1} {#if (@time > 0) {time = (@time - 1)} |
Leave the button the same. |
|
|
|
|
|