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


Joined: 19 Nov 2005
Posts: 53

PostPosted: Thu Aug 14, 2008 10:52 pm   

Gauges turning empty from floating point math in some zMUD installations?
 
I have the following four gauges:
Code:
#BUTTON 1 {HP: @currenthp / @maxhp} {} {} {} {@healthpercent+(@healthpercent/100.0)} {} {} {Size} {200} {20} {} {} {} {79} {} {Gauge||6|100|50|8} {} "" {Explore|Inset} {} {HP}
#BUTTON 2 {MANA: @currentmana / @maxmana} {} {} {} {@manapercent+(@manapercent/100.0)} {} {} {Size} {200} {20} {} {} {} {31} {} {Gauge||6|100|50|8} {} "" {Explore|Inset} {} {MANA}
#BUTTON 3 {MOVES: @currentmoves / @maxmoves} {} {} {} {@movespercent+(@movespercent/100.0)} {} {} {Size} {200} {20} {} {} {} {47} {} {Gauge||6|100|50|8} {} "" {Explore|Inset} {} {MOVES}
#BUTTON 4 {@enemyname %if(@enemyhealth!="", %concat(@enemyhealth, "%"))} {} {} {} {@enemyhealth} {} {} {Size} {200} {20} {} {} {} {32847} {} {Gauge||12|100|0|0} {} "" {Explore|Inset} {} {ENEMY}


Now that works fine for me.
On my screen I see this...


But a few other people have told me that the gauges are completely empty no matter the values.
They're seeing this...


It seems that the way to correct this for them so far is to get rid of the floating point division. So @healthpercent+(@healthpercent/100.0) becomes @healthpercent+(@healthpercent/100), and so on. Replacing 100.0 with %float(100) doesn't help.
(The reason the division part is even there at all has to do with this forum post: http://forums.zuggsoft.com/forums/viewtopic.php?t=31540)
Also, they've assured me that they are using zMUD 7.21 on Windows XP, which is the same setup that I have.
What I want to know is WHY?
What is interfering with floating point math inside the gauge on only some computers in versions that should support it?
Reply with quote
Tech
GURU


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

PostPosted: Fri Aug 15, 2008 1:50 am   
 
How are you determining the value of @health percent? Is it a floating point number? Is between 0 and 1, or 0 and 100?

I suspect you may be falling prey to rounding and float to integer conversion issues, however with out knowing how you are calculating the xxxpercent values and their ranges, it's hard to say.
_________________
Asati di tempari!
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Fri Aug 15, 2008 2:00 am   
 
Tech wrote:
How are you determining the value of @health percent? Is it a floating point number? Is between 0 and 1, or 0 and 100?
All stored values are integers. The stored percents are integers between either 0 or 1 and 100. I'd tell you if it's 0 or 1, but actually finding that out is tricky. I can only assume for now that the range is 0 to 100 since the MUD tends to round down.

Quote:
I suspect you may be falling prey to rounding and float to integer conversion issues, however with out knowing how you are calculating the xxxpercent values and their ranges, it's hard to say.
The values are not calculated. They are given, and they are integers (hence the attempt to make them floats for better precision). And, how do you explain it working on some zmuds but not on others of the same version? It works just fine for me and for lots of other people. It just happens that there are a few people who have this issue.
Reply with quote
Tech
GURU


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

PostPosted: Fri Aug 15, 2008 2:52 am   
 
Are they given by the MUD in a prompt for example? If so what is the text received? How are you storing it?

I'm not really sure what could cause this. It may be that depending on how the variable is captured that it's not it's not being treated as a variable but a string instead. It's also possible the preferences are different. You can have them check to make sure that their Script Parser -> General Parser options and their Special Character options match yours as well.
_________________
Asati di tempari!
Reply with quote
FiendishX
Wanderer


Joined: 19 Nov 2005
Posts: 53

PostPosted: Fri Aug 15, 2008 3:06 am   
 
Tech wrote:
Are they given by the MUD in a prompt for example? If so what is the text received? How are you storing it?
Example MUD output...
Code:
{stats}188/107,75/51,98/55,161/107,77/53,144/107,100,100,100,292,306,You are Standing.,9999,3130/3130,2422/2422,3133/3133,252952,5410,5,2180,2224,92,5

Captured by...
Code:
#REGEX {^\{stats\}(\d+)/(\d+),(\d+)/(\d+),(\d+)/(\d+),(\d+)/(\d+),(\d+)/(\d+),(\d+)/(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),You are ([^,]+)\.,(\d+),(\d+)/(\d+),(\d+)/(\d+),(\d+)/(\d+),(\d+),(\d+),(\d+),([-]?\d+),(\d+),(\d+),(\d+)} {#GAG;#VARIABLE stat_currenthp %20;#VARIABLE stat_maxhp %21;#VARIABLE stat_currentmana %22;#VARIABLE stat_maxmana %23;#VARIABLE stat_currentmoves %24;#VARIABLE stat_maxmoves %25;#VARIABLE stat_enemyhealth %if( %19!=9999, %19, "");#VARIABLE stat_enemyname %if( %32 = 4, %concat( %right( %18, 9), ":") , "");#VARIABLE stat_healthpercent %13;#VARIABLE stat_manapercent %14;#VARIABLE stat_movespercent %15} "StatGauges"


Quote:
It may be that depending on how the variable is captured that it's not it's not being treated as a variable but a string instead.
That should be consistent across installs.

Quote:
It's also possible the preferences are different. You can have them check to make sure that their Script Parser -> General Parser options and their Special Character options match yours as well.
I thought of that. At least one of the affected people had the same settings as I do.
Reply with quote
Tech
GURU


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

PostPosted: Mon Aug 18, 2008 12:20 am   
 
I'm stumped on this one. I recreated everything you gave me and it worked fine for me. They only things I can think of that cause this are the the same ones I mentioned before, or possibly for some reasons their variables are getting created somewhere else?

The last thing you can trying in case your friends had some quirk from upgrading is that you can have the back up their settings and then trying a clean install of zMUD. You can also trying typing #VARIABLE at the command line to see the full list of variables. There maybe some duplicates somewhere. Beyond that you're going to have to keep going with the workaround.
_________________
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