Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Tue May 19, 2009 5:53 am   

[3.07] Buttons updating/failing to operate with non-updating variable
 
For the button to stop working:

1. Make a multistate button "test"
2. Make a substate with caption a, put #print blah in as its script
3. go the the main state test -> options -> variable, set variable @buttontest
4. click substate a, see blah printed
5. type #var buttontest 1
6. button will fail to fire when you click on it.


For the button to continually fire without the variable changing:

1. enter this in command line: #tr {this is a test} {#var buttontest 5}
2. Make a multistate button "test"
2. Make a substate with caption a, put #print blah in as its script
3. go the the main state test -> options -> variable, set variable @buttontest
4. click substate a, see blah printed
5. type #show this is a test numerous times
6. blah will keep being printed

The documentation states the button with a variable will fire when its variable state changes.
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Tue May 19, 2009 7:39 am   
 
I'm unable to reproduce this, changing the variable, clicking the button all appear to correctly function.

The only case where the appropriate script was not execute was when clicking state 2, then calling "buttontest = 2", the varible isn't changed so... nothing happens, could be beneficial to execute the script when the variable is set, not changed. Otherwise i could forsee setting a dummy state.. probably state 0, and returning the button to state = after every button click.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Tue May 19, 2009 1:43 pm   
 
The instructions I gave only had one state being created. Also, do you have the button set as a multistate? This doesn't occur with a push button. After testing my instructions, this bug happened again. Also, after performing the latter instructions, if you add an additional state after typing #show this is a test, that state's script will be printed out after the next #show.

1. enter this in command line: #tr {this is a test} {#var buttontest 5}
2. Make a multistate button "test"
2. Make a substate with caption a, put #print blah in as its script
3. go the the main state test -> options -> variable, set variable @buttontest
4. click substate a, see blah printed
5. type #show this is a test numerous times
6. blah will keep being printed
7. Make a new substate b, have it's script print script b
8. type #show this is a test numerous times
9. b is printed
10. Make a new substate c, have it's script print script c
11. type #show this is a test
12. c is printed

The expected behavior to me would be the last called script would be printed, which in this case may be considered the last one made. This is the output I'm getting

Quote:

this is a test
blah
this is a test
blah
this is a test
blah
-- ADD STATE b --
this is a test
b
this is a test
b
this is a test
b
-- ADD STATE c --
this is a test
c
this is a test
c
this is a test
c
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue May 19, 2009 5:21 pm   
 
It's the "#var buttontest 5" that is doing it. You are setting the button to a state that doesn't exist yet. In your first test, the button only has one state, and you are trying to set it to state 5. What happens in this case is that the variable gets changed from 1 to 5. Then when CMUD tries to set the button state to 5 and discovers that no such state exists, CMUD changes the variable back to the highest state number available (1 in this case). Since the variable now changed from 5 back to 1, the button script gets executed.

If you change your script to be "#var buttontest 1" then it works as expected and only fires once.

So in any case, what you are doing in your script is undefined. The effect of setting a button state variable to a state that doesn't exist is not defined.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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