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
Hemdall
Wanderer


Joined: 30 Nov 2006
Posts: 50

PostPosted: Tue Jan 25, 2011 5:10 am   

Button caption doesn't update when indirect variable changes.
 
As in the subject, caption and gauge value doesn't update when variable changes.
Code:

<button type="Gauge" autosize="false" width="218" height="20" autopos="false" left="1698" top="100" toolbar="2" iconleft="false" inset="true" toolstyle="true" stack="true" color="#00FF80" gaugelowcol="red" gaugebackcol="white" priority="10974" id="81">
  <caption>@team_member_1 @{@team_member_1}</caption>
  <value>kurwa</value>
  <expr>@{@{@team_member_1}}</expr>
  <gaugemax>7</gaugemax>
  <gaugelow>4</gaugelow>
</button>
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jan 25, 2011 1:27 pm   
 
That is expected. It only checks the direct variable. You simply can't do it with indirect variables.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Jan 25, 2011 2:29 pm   
 
One option is to manually update the button yourself when that indirect variable changes using the #UPDATE command.
_________________
Asati di tempari!
Reply with quote
Hemdall
Wanderer


Joined: 30 Nov 2006
Posts: 50

PostPosted: Tue Jan 25, 2011 2:45 pm   
 
That might be helpful, I'll definitely check it out. Could you tell me please what will be more effective - using #update or using database variable: %dbkey(@team_member,1) @team_member.1 - all my buttons got caption like this in example and works fine, but I was suggested that efficiency of the code I'm using now is very poor so I'm trying to rewrite and improve it a bit.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jan 25, 2011 4:17 pm   
 
The problem with using a database variable is that the button will try to update whenever _any_ element in the variable changes. If all your buttons are using the same variable, it means that all the buttons will try to update whenever any element in the variable changes, which is an awful lot of overhead. #update will be much, much more efficient.
Reply with quote
Hemdall
Wanderer


Joined: 30 Nov 2006
Posts: 50

PostPosted: Tue Jan 25, 2011 6:42 pm   
 
Yes, I'm aware of that but the thing is I'm going to create separate database variable for every team member of my team so every button will be using different variable than others. This way I believe only buttons assigned to variables which have changed will update what might be more effective than #update class of buttons within it.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jan 25, 2011 9:22 pm   
 
I was just answering the question "Could you tell me please what will be more effective - using #update or using database variable".
Reply with quote
Hemdall
Wanderer


Joined: 30 Nov 2006
Posts: 50

PostPosted: Tue Jan 25, 2011 9:45 pm   
 
My question wasn't precise enough then - what will be more effective, using #update to update buttons' class or single record database variable for every button.
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