|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Jul 26, 2010 8:26 am
[3.22]BUG?: Gauge Value/Max value not accepting GMCP |
I'm not sure if this is a bug or not, but if it isn't, it's somewhat of an inconvenience.
The issue is simply using %gmcp.char.vitals.hp and %gmcp.char.vitals.maxhp as values for 'Value' and 'Max' boxes in gauges. The 'Low' value works with expressions, so it confuses me why the Value and Max boxes wouldn't.
Yes, I know GMCP is relatively new, but I wouldn't think this has to do with the newness of a feature or not...
Charneus |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jul 26, 2010 5:27 pm |
You should not use %gmcp variables directly like this because CMUD will not update your gauges when they change. Unlike normal variables, a change to a %gmcp value does not trigger any "change". So no button update, no expression trigger update, no status bar update, etc.
The proper way to do this is to create a GMCP trigger and then set a normal CMUD variable with the %gmcp value. Then have the Gauge use the normal CMUD variable. For example:
Code: |
GMCP Trigger: Char.Vitals
#IF (@hp <> %gmcp.char.vitals.hp) { hp = %gmcp.char.vitals.hp }
#IF (@maxhp <> %gmcp.char.vitals.maxhp} { maxhp = %gmcp.char.vitals.maxhp } |
This trigger will update the @hp and @maxhp CMUD variables with the new values from GMCP when the GMCP values change. Setting the @hp variable will trigger a "change message" which will update any button/gauge that uses @hp.
As far as the Gauges, I'm not sure why "Low" works differently than "Value" or "Max". I had thought they all allowed expressions, but if not then it's probably a bug. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Jul 26, 2010 6:00 pm |
Ah, I was trying to do away with having so many variables, or having to rely on them. I knew that receiving the GMCP line would not update the buttons automatically, so I actually set up a trigger for * on GMCP 201 to #UPDATE buttonid when needed.
I may go the route you showed, though. I'll take a look into other issues, though.
Is there a remote possibility that CMUD will (in the future) create its own internal trigger to update GMCP variables when it crosses the screen?
Charneus |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jul 27, 2010 12:08 am |
Oh, well, using the #UPDATE command is a good way to handle it too. So maybe I need to look into this a bit more if they are not accepting %gmcp.char.vitals.hp as a proper expression reference.
I doubt CMUD will ever be able to trigger updates from GMCP changes though. There just isn't any way to modify the JSON library to tell it to call a trigger in CMUD when some internal hash table value is updated. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Aug 23, 2010 9:51 pm |
I could not find any difference between the handling of the Gauge Low and the Gauge Max properties. So if you still can't get it to work with the Gauge Max, then you'll need to post the exact procedure for reproducing the problem.
Note that #UPDATE is still required. When you first create the button, the %gmcp.char.vitals.maxhp value probably isn't defined yet. Doing #UPDATE on the button will allow the button to recompute and display once that gmcp variable is set.
Both Low, Max, and Value all properly accept expressions as far as I can tell. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Aug 27, 2010 2:13 am |
Looking over the original post I had made on this, I realized it was my mistake. The value was supposed to be char.maxstats.maxhp, not char.vitals.maxhp, so it couldn't find what I was putting in. Bah. Thanks anyway!
Charneus |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Aug 27, 2010 3:24 pm |
Ahh, good to know. Thanks for clearing this up so I can delete it from the bug list :)
|
|
|
|
|
|