 |
Nightwing Newbie
Joined: 10 Jan 2009 Posts: 2
|
Posted: Sat Jan 10, 2009 11:48 pm
possible bug in Multistate button with lua |
Hi Folks!
I am having some nasty problems creating a multistate button.
If my button executes zScript commands everything works just
fine:
Code: |
<button name="Test" type="Multistate" priority="480" id="48">
<caption>TestCaption 0</caption>
<state caption="1">#echo 1</state>
<state caption="2">#echo 2</state>
</button> |
But then I want to use Lua nothing happen:
Code: |
<button name="Test" type="Multistate" priority="480" language="Lua" id="48">
<caption>TestCaption 0</caption>
<state caption="1">zs.echo("1")</state>
<state caption="2">zs.echo("2")</state>
</button> |
After looking into this some more I figured out, if using Lua the
buttons "main" ScriptText is executed instead of the Script of
the selected state.
Code: |
<button name="Test" type="Multistate" priority="480" language="Lua" id="48">
<caption>TestCaption 0</caption>
<value>zs.echo("0")</value>
<state caption="1">zs.echo("1")</state>
<state caption="2">zs.echo("2")</state>
</button> |
I hope that you can help me? I really badly want to execute lua
with a multistate button :-)
Oh and i have another question: What is the equivalent of the
below lua command in zScript? How to change the Caption of
a (multistate) button with zScript code?
Code: |
zs.getbutton("Test").caption = "Caption1" |
Thanks in advance! Kal Nightwing |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jan 10, 2009 11:53 pm |
There isn't a simple way to do that with zScript - the OO model that the Lua interface uses is probably the best way to go about stuff like that.
The way it's been done in the past is to put a variable in the caption and change the string in that variable when you want to change the caption.
As to your original problem, it seems that the Script setting isn't being saved for button sub-states, and that is a bug, yes.
EDIT: Actually, no, it's being saved, it's just not being used. |
|
|
 |
Nightwing Newbie
Joined: 10 Jan 2009 Posts: 2
|
Posted: Sun Jan 11, 2009 9:39 am |
Thanks Fang!
Well I'll try to make few Buttons without lua... *sniff*
And wait for Zugg to debug cmud 8)
Greetings, Kal Nightwing |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 12, 2009 6:25 pm |
Added to bug list.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Feb 05, 2009 6:36 pm |
This is fixed for v3.04.
|
|
|
 |
|
|