|
tigika Newbie
Joined: 30 Oct 2003 Posts: 7
|
Posted: Thu Oct 30, 2003 1:15 am
button gauge questions |
There's no clear help files on this topic so asking here in forum.
On the buttons, there's a gauge feature and there's a feature to change color on when it gets low, how excatly is the expression set up? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Oct 30, 2003 1:33 am |
The expression goes in the Value box.
The maximum value of the gauge goes in the Gauge Max box.
This will produce a gauge where the bar represents the relationship of Value to Gauge Max, i.e. if Value is one-third of Gauge Max the bar will take up one-third of the button, starting from the left.
The expression to change color goes in the Gauge Low box. When the Value is less than the value of Gauge Low, the Low Color is used. Otherwise, the Gauge Color is used. |
|
|
|
tigika Newbie
Joined: 30 Oct 2003 Posts: 7
|
Posted: Thu Oct 30, 2003 4:24 am |
hmmm the bar stays full not according to percent.
here is what I have written down.
value: (@hp/@maxhp)*100
gauge max: 100
gauge low: 20
from what I understood (would be better if there was example or a decent help file) in the value ya write down the expression then in the max you put the final number that's maxed because when I tried putting down @maxhp in the gauge max box and the button wasn't colored. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Oct 30, 2003 4:49 am |
Since zMUD uses integer math and @hp is almost always less than @maxhp, @hp/@maxhp is almost always 0. Multiplying the quotient by 100 still gives 0. There are at least three different ways to fix this.
1. Change the Value to (100 * @hp)/@maxhp (good for small values)
2. Change the Value to @hp/(@maxhp/100) (good for large values)
3. Or probably the best choice
Value: @hp
Gauge Max: @maxhp
Gauge Low: @maxhp/5
As for the gauge not being colored, that's because you probably have the Gauge Color set to black (default value). This is actually no color, which means the bar doesn't show up. Change it to blue (or other color of your choice). |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Oct 30, 2003 4:51 am |
I am going to guess your hp and maxhp variables will only be equal when full, and that the rest of time you hp variable will be less then your maxhp variable. Since zMud uses integer math...(1 to x)/(x+1)=0. So the guage will always read as the low value with the formula your provided, except when full then it will read as max. Instead use @hp as value, @maxhp as guage max, and @maxhp/5 as guage low. This allows the actual percentage calculation to be done with much more precision at much greater speeds.
Edit: Hrm, guess I was typing right when Lightbulb hit post. Same answers though. |
|
|
|
tigika Newbie
Joined: 30 Oct 2003 Posts: 7
|
Posted: Thu Oct 30, 2003 8:05 am |
works, thank you guys.
|
|
|
|
|
|