|
Wasperine Newbie
Joined: 30 May 2006 Posts: 6 Location: Langley, BC, Canada
|
Posted: 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 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: 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 |
|
|
|
Wasperine Newbie
Joined: 30 May 2006 Posts: 6 Location: Langley, BC, Canada
|
Posted: 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.
So, any hints on how to get the correct value assigned to maxxp? |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: 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 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
|
Wasperine Newbie
Joined: 30 May 2006 Posts: 6 Location: Langley, BC, Canada
|
Posted: 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. |
|
|
|
|
|
|
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
|
|