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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4672
Location: Pensacola, FL, USA

PostPosted: Fri Apr 27, 2012 5:06 pm   

Dummy Gauge
 
I have a button that changes color based on weather or not enough time has passed for me to repeat the associated command.

Code:
#CALL %btncol(Jerky,,firebrick)
#ALARM "keepJerking" +31:00 {#CALL %btncol(Jerky,,lime)}


I was trying to stick a reference to the time into the button caption, but it doesn't want to play along.

Code:
#VAR jerky {%eval(%alarm(keepjerking)/1000.0)}
#FUNC jerky {
$sec=%eval(%alarm(keepjerking)/1000.0)
#IF ($sec>0) {#RETURN $sec}
}


Both of those were input via the GUI to prevent premature evaluation.
However, as a variable, it doesn't recognize when its value changes.
And as a function, it just displays the literal zscript instead of evaluating.
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4672
Location: Pensacola, FL, USA

PostPosted: Fri Apr 27, 2012 5:39 pm   
 
I tried doing this on a regular gauge, but %btncol only seems to change the current value color.
Also it only has 2 color arguments, where as gauges have 3 color arguments.
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Apr 27, 2012 7:05 pm   
 
The value of the variable _won't_ change unless you keep using the #VAR command to reset it. A variable is constant until it is explicitly changed. Above, you are setting the variable to a string "%eval(%alarm(keepjerking)/1000.0)", which is constant. Unless you keep explicitly changing the value of @jerky, it will not change.

The way to do it is to have an alarm or loop constantly changing the value of @jerky every so often.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4672
Location: Pensacola, FL, USA

PostPosted: Fri Apr 27, 2012 9:19 pm   
 
Should not the function option have gotten around that?
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sat Apr 28, 2012 2:14 pm   
 
I'm not sure about the function. As I recall, captions don't check the value unless it thinks something has changed. For variables, this is triggered when the variable is internally marked as "updated". I'm not sure what causes the caption to check the value of a function.
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