|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 20, 2007 1:26 pm
multistate button labels |
I am trying to use multistate buttons for an unusual purpose. My mud does not make status numbers visible to the players. Instead it uses phrases for numerical ranges. So, for instance, when my magic power recovers, I can get messages such as "Your aura appears to be blue."
This makes gauges a bit less useful. Also, since many of the states are displayed in ansi colors, I'd like a screen display using those colors to make it easier to identify my status at a glance. To do this, I have made some multistate buttons, with a label and color for each status level. Each button is linked to a variable. I use triggers to change the numerical value of the variable when status messages arrive.
The button colors are working great. They appear to be updating correctly, changing to the correct color whenever a status message changes the variable. However, the labels are acting strangely. Whenever the variable changes, the button label changes to what it should have been previously. It is one step behind the button color almost all the time. If I push a toggle button, or do something else that changes any button state, all the multistate button labels correct themselves.
Example:
Let's say the button starts out blue, with a label "blue".
A message pops up: "Your aura appears to be yellowish green."
The button color changes to yellowis green, with a label of "blue".
A message pops up: "Your aura appears to be green."
The button color changes to green, with a label of "yellowish green".
A message pops up: "Your aura appears to be bluish green."
The button color changes to bluish green, with a label of "green".
I toggle some other button.
The button color is still bluish green, and the label corrects to "bluish green".
A message pops up: "Your aura appears to be greenish blue".
The button color changes to greenish blue, but the label stays "bluish green".
The same thing happens if I manually change the value of the variable controlling the button. It looks like a bug in the update procedure for multistate button labels. This is in verson 1.34. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu Sep 20, 2007 4:17 pm |
I'm pretty sure that multi state buttons start at 0.
1 2 3 4 5 6 7
0 1 2 3 4 5 6
If you starting at 1 with your mana states you are always going to be one off. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 20, 2007 8:50 pm |
Yes, the multistate buttons start at 0. I took that into account.
The colors are coming out correct. The labels are not always matching. Say, state 3 (zero base) has the color blue and the label "blue", while state 4 has the color indigo and the label "indigo" and state 5 has the color violet and the label "violet". I start with the variable at 4, and the button at color blue and label "blue", (i.e., state 3). If I change the variable to 5, the button goes to indigo, but the label stays "blue". I then change the variable to 6, and the button goes to the color violet and the label "indigo". I change the variable to 5 again, and the button changes to blue and the label "violet".
What seems to be happening is that when the variable changes, the displayed label is changing to the label value of the previous state. It gets corrected whenever any button is toggled, or a button is activated or deactivated. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Sep 21, 2007 1:25 pm |
Is anyone else seeing this? Here is a test you can do:
Make a variable @testvar, value 1
Make a button named "red", with variable @testvar, color red,, text color gray, type multistate.
Add some button states:
state 0: color orange, name "orange"
state 1: color yellow, name "yellow"
state 2: color green, name "green"
state 3: color blue, name "blue"
Then change the value of @testvar several times.
Here is what I see when I do this:
initial state of 1: button is orange, labeled "orange"
#var testvar 2 : button is yellow, labeled "orange"
#var testvar 3 : button is green, labeled "yellow"
#var testvar 4 : button is blue, labeled "green"
#var testvar 1 : button is orange, labeled "blue"
#var testvar 0 : button is black, labeled "orange"
#var testvar 2 : button is yellow, labled "red" |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Sep 21, 2007 2:04 pm |
I Think this has been fixed in the beta version. There is a line in the fixes list at least.
Cmud 2.00 Version History wrote: |
Fixed several problems with Variables in toggle and multistate buttons
|
And this is one from several versions back.
I was definitely able to reproduce your problem in 1.34. If not your exact results from the steps you gave me. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Sep 21, 2007 2:12 pm |
Ah great! Version 2 has so many bug fixes, I didn't notice that one. I've been looking forward to several other fixes in version 2. Hope it goes public soon!
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Sep 21, 2007 2:13 pm |
I can't speak for this issue, by why use multistate buttons for this at all? A gauge could still be useful if you set a variable to a numerical value based on the text.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Sep 21, 2007 2:45 pm |
Yes, I considered using gauges that way. But a gauge only allows me to use two colors. With multi-state buttons, I can have the button be a range of colors. This is especially useful since I can use the same colors as the mud uses to display the status messages, making it easy to tell my status with a quick glance at the colors.
On this mud (Dartmud), magical aura comes in 26 different detectable levels, each named a different color! Concentration can be "too confused to remember your name", "shot to hell", "distracted and off balance", "quite distracted", "off balance", "somewhat distracted", "a bit off balance", and "bushy-tailed", and each successive state takes less time to recover. Reducing that to a mere number and 2 colors is a bit limiting. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Sep 23, 2007 4:19 pm |
It's totally up to you but you can use scripting to change the color and the caption of the gauge to reflect whatever your current state is. I actually use a similar approach to give me a 3-color HP gauge.
|
|
_________________ Asati di tempari! |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Sep 24, 2007 3:04 pm |
Hm. That could be useful. I see what you mean, with %btncol. I'll check it out.
|
|
|
|
|
|
|
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
|
|