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


Joined: 30 May 2006
Posts: 6
Location: Langley, BC, Canada

PostPosted: Sun Jun 04, 2006 8:25 am   

Trouble with gauges
 
I'm trying to make some gauges for hp/sp/ep tracking (I'm playing on Medievia if that helps), but I seem to be having a problem getting the color to change.

I've managed to get the text to decrement properly on the hp and sp gauges, but am still working on the math to get the ep gauge to show "ep remaining until level".

Any help/pointers anyone can give would be greatly appreciated.


I'm using the latest version of zMUD.



Thanks,

Wasperine
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Jun 04, 2006 11:30 am   
 
Please show an example of what you already have, what it does, and what it should do that it doesn't.
_________________
Kjata
Reply with quote
Wasperine
Newbie


Joined: 30 May 2006
Posts: 6
Location: Langley, BC, Canada

PostPosted: Mon Jun 05, 2006 11:44 am   
 
Kjata wrote:
Please show an example of what you already have, what it does, and what it should do that it doesn't.


Sure, no problem.

I've (finally) figured out how to get the color to change, but I've run up against a new problem: how to add the values of two variables together and assign it to a third variable.

Here's what I've got so far:

variable #1: currentxp with a value of 406,175
variable #2: tolevelxp with a value of 217,825
variable #3: maxxp with no value

Okay, I've tried #MATH maxxp @currentxp+@tolevelxp, but instead of getting the sum assigned to the variable maxxp I get this:

406,175217,825

Close, but not close enough. Confused


So, any hints on how to get the correct value assigned to maxxp?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jun 05, 2006 12:57 pm   
 
Ok, your problem is with the commas. zMUD tries to infer the type of a variable based on what it contains. When it sees the commas, it thinks that the variables are strings. You will need to remove the commas when doing the addition:

#MATH maxxp {%int(%replace(@currentxp, ",", "")) + %int(%replace(@tolevelxp, ",", ""))}
_________________
Kjata
Reply with quote
Tech
GURU


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

PostPosted: Mon Jun 05, 2006 5:43 pm   
 
Kjata's advice is great. I would also reccomend doing it when you are actually capturing the variable so that you only need to do it once.
_________________
Asati di tempari!
Reply with quote
Wasperine
Newbie


Joined: 30 May 2006
Posts: 6
Location: Langley, BC, Canada

PostPosted: Tue Jun 06, 2006 9:36 pm   
 
Kjata wrote:
Ok, your problem is with the commas. zMUD tries to infer the type of a variable based on what it contains. When it sees the commas, it thinks that the variables are strings. You will need to remove the commas when doing the addition:

#MATH maxxp {%int(%replace(@currentxp, ",", "")) + %int(%replace(@tolevelxp, ",", ""))}


Thanks, Kjata, it's working properly now. Very Happy
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