|
sonic76 Newbie
Joined: 20 Feb 2004 Posts: 8 Location: USA
|
Posted: Fri Aug 17, 2018 3:58 am
Display timer on button |
I have a very simple timer that fires when I pick something up. The room resets in 15 minutes, so I have a timer that does an echo after 15 minutes.
What I would love would be to just have that showing all the time. So a button that shows the timer as it counts down.
How would I do this?
#ala potions +900 {#say potions reset}
that's my simple timer.
If i type #show %alarm(potios) it shows me the time remainng in miliseconds. I want it to just show the seconds, and not have to use #show, just show on the button. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4662 Location: Pensacola, FL, USA
|
Posted: Fri Aug 17, 2018 12:58 pm |
In order to display the countdown on a button, you need to keep a dedicated variable for that value.
Unfortunately, the value from a function, or a database variable, won't update in the button caption.
potionTimer=900
#ALARM "countdown" -1 {
#IF (@potionTimer>0) {potionTimer=(@potionTimer-1)}
//repeat for any other timers you need to keep track of
}
Personally, I dont like making my buttons extra long to accommodate the timer, so i just change the color of the button as a visual cue as to whether or not i can use it.
#CALL %btncol( potion, , firebrick)
#ALARM "nextPotion" +900 {#CALL %btncol( potion, , lime)}
P.S. Typing #ALARM by itself will show you all currently running alarms, as well as how many seconds until they fire. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|
|
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
|
|