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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
acaykath
Wanderer


Joined: 03 Aug 2005
Posts: 84

PostPosted: Sun Apr 29, 2012 2:57 am   

Toggle Buttons not Toggling
 
I want to make a set of toggle buttons for my automatic actions. I have scripts for various things such as gold running which is located in the class "GoldrunTerra".

I have created a button and set:
Code:

Main Button:
  Caption: Gold Run
  Type: Toggle
  Language: zScript
  Script Text: #T+ GoldrunTerra
  Expr: %trigger(GoldrunTerra)=1
  Tooltip: Toggle Gold Running
1:
  Caption: Stop Gold Running
  Language: zScript
  Script Text: #T- GoldrunTerra


Whether I click the button or toggle the state of "GoldrunTerra" manually, the state of the button does not change. Any idea wheat I am doing wrong?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Sun Apr 29, 2012 3:13 am   
 
I usually make such things a simple push button

#IF (%trigger(GoldrunTerra)) {#T- GoldrunTerra} {#T+ GoldrunTerra}
_________________
Discord: Shalimarwildcat
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Apr 29, 2012 3:44 am   
 
The expression field sets the button state, so essentially you're forcing the toggle state to remain in/revert to the upright position. Maybe remove the =1 part, but it's probably easier to do as Shalimar does and simply include a visual indicator (ie, button image or caption change).
_________________
EDIT: I didn't like my old signature
Reply with quote
acaykath
Wanderer


Joined: 03 Aug 2005
Posts: 84

PostPosted: Sun Apr 29, 2012 3:12 pm   
 
I don't mind doing it programatically but I have no idea how to change the caption of an already created button and I'd like to have the visual indication that it is on or off.

Without the =1, it just remains stuck in the off state instead of the on state, even though I've tested the expression and it gives 0 when off and 1 when on.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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