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
Wedric
Newbie


Joined: 27 Aug 2007
Posts: 4

PostPosted: Tue May 06, 2008 10:27 am   

Help with Gauges
 
Howdy, I'm a new convert to Cmud from Zmud. I'm having a bit of trouble with gauges and wondering if someone could help me out.

Basically, I have the following gauge:

Code:

<button name="AutobashStatus" type="Gauge" autosize="false" width="70" transparent="false" color="lime" gaugelowcol="red" gaugebackcol="red" priority="390" id="39">
  <caption>Autobasher</caption>
  <value>#if (%class(Autobasher)) {aboff} {abon}</value>
  <expr>%class(Autobasher)</expr>
  <gaugemax>1</gaugemax>
  <gaugelow>0</gaugelow>
</button>


In Zmud, this would automatically update the gauge's value, the %class(Autobasher), whenever that class was turned off/on, thus effectively changing the gauge from green to red and back.

In Cmud, it's not doing this for whatever reason. It'll set the colour of the gauge to whatever the current value of the class' state is whenever I save changes to the gauge.

I'm assuming that this is due to the change of code being compiled instead of interpreted, but I can't think of any way to go about making this work. I notice that it would update if I set it to a variable and changed the variable's value, so I tried using a function that would return the value of the class' state. No luck.

Anyone happen to know the solution?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue May 06, 2008 10:59 am   
 
CMud makes more of an effort to ensure that these visual items aren't constantly being redrawn. This is done by noting what variables are used for a control, and then watching for those variable to change. In your current gauge expression you don't have any variables so the guage never updates. When you tried a function the function itself wasn't actually changing so the gauge was not getting updated.

The correct way to do this is to use a variable for the gauge expression, lets call it ABashState. You should set the default value of the variable to "%class(AutoBasher)" and check the UseDefault box. Then add this line to both your abon and aboff aliases "ABashState=%class(AutoBasher)".
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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