Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Wed Oct 26, 2005 12:37 am   

Gauges Not Updating Properly from Record Variable
 
I use a record variable to store the information captured from my prompt (health, mana, and movement). I then have 3 gauges set up to display those values.

My problem is that the gauges don't automatically update like they should until I click on something else (i.e. another button or another window), or any other non-record variable updates.

Has anyone else had this problem? Is this normal behavior?

The only 2 solutions I have right now are to split the stats into three variables (which is ok I guess I'd just rather have one variable instead of three), or create some dummy variable thet just bounces between 0 and 1 as part of my prompt trigger to get the gauges to update.
Any other ideas?
_________________
Erasmus
Reply with quote
Tech
GURU


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

PostPosted: Wed Oct 26, 2005 4:57 am   
 
If you post the actual script for your gauge we may be able to help debug, the gauge can theorectically work with any expresssion and thus should be able to to work with a db record.. But your best bet is to split it. That's standard practice ( and to my knowledge ) there's no issues with that.

I did a quick test using a record and was able to see the value. If you record variables is called Test and the health is stored in HP you would access it via @Test.HP Hope that helps.
_________________
Asati di tempari!
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Oct 27, 2005 1:39 am   
 
I included the code the variables for current and max stats, prompt trigger, and 3 gauges below. I used the %db() format in the gauges, but I tested with the @Test.HP format, and got the same results.

Code:

#VARIABLE Stats {}
#VARIABLE MaxStats {}
#ADDKEY MaxStats Health 3353
#ADDKEY MaxStats Mana 3140
#ADDKEY MaxStats Movement 3250
#TRIGGER "trgPromptStatsSet" {(%d)h, (%d)m, (%d)v-} {#ADDKEY Stats Health %1;#ADDKEY Stats Mana %2;#ADDKEY Stats Movement %3} "" {prompt}
#BUTTON 1 {Health: %format("&5.0n",%db(@Stats,Health))} {~drink health} {} {} {%db(@Stats,Health)} {} {} {Size} {127} {17} {} {} {} {47} {} {Gauge||12|%db(@MaxStats,Health)|1000|8} {} "" {Explore|Inset} {} {btnGaugeHealth}
#BUTTON 2 {Mana: %format("&5.0n",%db(@Stats,Mana))} {~drink mana} {} {} {%db(@Stats,Mana)} {} {} {Size} {127} {17} {} {} {} {63} {} {Gauge||12|%db(@MaxStats,Mana)|1000|8} {} "" {Explore|Inset} {} {btnGaugeMana}
#BUTTON 3 {Movement: %format("&5.0n",%db(@Stats,Movement))} {} {} {} {%db(@Stats,Movement)} {} {} {Size} {127} {17} {} {} {} {79} {} {Gauge||12|%db(@MaxStats,Movement)|5000|8} {} "" {Explore|Inset} {} {btnGaugeMovement}
_________________
Erasmus
Reply with quote
Tech
GURU


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

PostPosted: Thu Oct 27, 2005 4:14 am   
 
Ok.. I see the problem. You're using a ',' instead of a '.'; i.e. a comma instead of a period.

@MaxStats.Health
@MaxStats.Mana
@MaxStats.Movement

Replace with these and you should be fine.
_________________
Asati di tempari!
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Oct 27, 2005 12:31 pm   
 
Thanks, for the reply Tech but I have a couple of questions/comments.

I'm not sure where I'm using comma incorrectly when I should be using a period.
I used the %db(@MaxStats,Health) function to pull the value not the @MaxStats.Health format. I'm assuming that is what you are referring to.

Also, I said in my last post I tried the @Stats.Health format as opposed to %db(), and still got the delayed updating. Admittedly, I only changed the the Stats variable to the @Stats.Health format not MaxStats so I will try changing both tonight.
_________________
Erasmus
Reply with quote
Tech
GURU


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

PostPosted: Thu Oct 27, 2005 2:43 pm   
 
Yeah.. I guess I should have clarified. You will need to change the Stats variable as well. I saw the @MaxStats variables first so I only spoke to those. Generally speaking to access a particular entry of a record variable you use the dot-notation. You can read more about it here
_________________
Asati di tempari!
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Oct 27, 2005 6:18 pm   
 
Quote:

Generally speaking to access a particular entry of a record variable you use the dot-notation. You can read more about it here


The file you pointed me to says....

Quote:

To access a field Value from a database variable, you can use one of two methods. The most general method is to use the %db function, where the first argument is the database variable, and the second argument is the Name of the field you wish to retrieve.


Just thought I'd point that out.

Seriously though, I try to stay in the habit of using %db() because there are times when I have spaces in my keys (especially inventory variables), and I have never managed to get that to work properly using the dot notation.
_________________
Erasmus
Reply with quote
Tech
GURU


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

PostPosted: Thu Oct 27, 2005 7:29 pm   
 
I stand corrected. I guess I should say that's what I generally use. Laughing
_________________
Asati di tempari!
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Oct 27, 2005 11:57 pm   
 
Ok dot notation didn't work either. I'm just going to split Stats into 3 different variables and that should take care of it.
_________________
Erasmus
Reply with quote
DustyShouri
Novice


Joined: 29 Oct 2004
Posts: 34

PostPosted: Fri Oct 28, 2005 8:38 am   
 
I had this problem too, so you're not alone. For some reason it doesn't check database variables in guages. If I had a toggle button for a database variable and changed it without the button, the button would not update until I interacted with the GUI. I wasn't really sure how to fix that, and guessing it's more of doing with Zmud's coding, and not sure if you can work around anything to fix it.
Reply with quote
Tech
GURU


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

PostPosted: Fri Oct 28, 2005 12:54 pm   
 
Hmmm... I thoughtposted a response last night.. but I guess I must have forgot to submit.

Erasmus,

I copied your trigger verbatim in to my zMud copy. A registered version of 7.21 and had no problems with it, whatsoever. First I manually set the values of the Stats record variable. After that, I tried to see it would update based on you trigger prompt and it did.

I'm guessing that you trigger prompt is actually what's causing the problem since it works for me in both the dot-notation and using %db. I suspect that you're trigger prompt is not correctly triggering and as a results your 'Stats' record variable is not being set. Can you post an example of your mud prompt.
_________________
Asati di tempari!
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Fri Oct 28, 2005 5:54 pm   
 
The prompt is: 3100h, 1700m, 500v-

I've tested my prompt using the #SHOWPROMPT command, (I'm sure I've tried it on the mud as well but since it didn't work I've done most of the testing offline) and it seems to capture fine. The gauge never updates to reflect the new values.

Example:
After using the code from several posts ago to create the variables, triggers, and gauges I'll do something like

Code:

#SHOWPROMPT 3100h, 1700m, 500v-;#ECHO @Stats

in the command line which displays
Code:

3100h, 1700m, 500v-Health|3100|Mana|1700|Movement|500

in the output window.

The Stats variable is updating correctly, but the gauges never update to reflect the new values. Since I just created them they remain empty (except for the words Health, Mana or Movement I have in the captions). The gagues will only update if I interact with any button (gauge, toggle, push, or otherwise), change windows, update any non-record type variable, or change something in the settings editor.
_________________
Erasmus
Reply with quote
Tech
GURU


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

PostPosted: Fri Oct 28, 2005 7:47 pm   
 
I think what you're seeing is a quirk of offline testing. Not possible for me to test online right now.

It's seems that when record variables are processed offline, the values are updated but their depedents don't immediately recognize it. A problem that doesn't hold true for regular variables. I tried what you said, and only got updates when I clicked the button or went gauge. However if I tried
Code:
#SHOWPROMPT 3100h, 1700m, 500v-;#SHOWDB @Stats


I saw the updates right away. I'd say try it online as you have the code now, I'm assuming whatever the phantom event will occur correctly while your online.

Edit:

I played around with it some more and the #SHOWDB only works when the trigger window is open. I think what the ultimate culprit is how zMud is checking if the DB variables being updated. If you the Health value changes all the others get updated properly. If it doesn't the others get ignored unless something like switch to the Trigger Window and back forces a full re-eval of the record variable.

As mentioned before. Try it online if you keep seeing those quirks, either switch to using regular variables or use both record variables and regular variables.
_________________
Asati di tempari!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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