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
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Sep 10, 2011 2:25 pm   

#BU syntax for gauge
 
I've been playing with the syntax for #BUTTON trying to create gauges from within an Event, but I can't figure out how to make it a gauge with my specified parameters. I used the Package Editor to manually create one such button. Here is the XML:
Code:
<button name="KhriCalmButton" type="Gauge" autosize="false" width="150" height="15" toolbar="3" color="#993366" textcolor="#CC99FF" gaugelowcol="red" priority="998957" id="1196">
  <caption>@KhriButtonCaption(Calm)%if(@CorePulse,,)</caption>
  <value>#UNBUTTON KhriCalmButton</value>
  <expr>@KhriButtonExpr(Calm)</expr>
  <gaugemax>@KhriButtonMax(Calm)</gaugemax>
  <gaugelow>@KhriButtonLow(Calm)</gaugelow>
</button>

How can I have my Event create this when passed the parameter "Calm"? Here's how it starts, but can't figure out what parameter goes where...
Code:
#BU {%concat("Khri",%1,"Button")} {@KhriButtonCaption(%1)} {#UNBUTTON %concat("Khri",%1,"Button")} {...??...}

Note that the @KhriButton___(%1) are Functions and should remain as such so the buttons will update, but all of the %concat()s should parse on creation so the actual %concat function doesn't appear in the created button.

Ultimately, I will move the code from the functions into the button creating Event, and may have further questions about parsing, but being able to create the gauge from command line is a good start...
_________________
.geniusclown
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Sep 10, 2011 4:24 pm   
 
Try using the #GAUGE command instead. It is possible to make gauges with the #BUTTON command, but it's much more complicated that way.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Sep 10, 2011 6:01 pm   
 
That's what I needed, thanks! Didn't realize there was a separate command.
_________________
.geniusclown
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Sep 10, 2011 6:10 pm   
 
Is there a way using #GAUGE to set which toolbar the button is created on?
_________________
.geniusclown
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sun Sep 11, 2011 7:52 pm   
 
I've found that to overcome the limitations of #BU and #GAUGE, I can create the setting with size, position, toolbar, etc parameters using #BU, then use #GAUGE to adjust the gauge-specific parameters. This is slightly impractical in the plan of creating and deleting gauges as needed, so I'm falling back on having the buttons already created, and use #T+ and #T- to make them visible, as I was doing initially.

The big problem with this is that I'm still coding how the buttons behave, and there are a total of 29 buttons that are identical except for the ability they report. If I tweak the code, I don't want to have to change the code for 29 buttons, possibly making errors through the repetition. Part of the problem is that each gauge has 3 states, and the gauge behaves differently for each state.

SOLUTION 1: Create functions that dictate the button behavior, and have all of my permanent buttons call those functions. The buttons' code is static, regardless of the state - the Functions handle different states.
NEW PROBLEM: This works perfect for the captions, but the gauge specific parameters don't call the Functions.

SOLUTION 2: When the state changes, use the #GAUGE to redefine the parameters for the new state.
NEW PROBLEM: When defining the gauge specific parameters, the #GAUGE command either does not expand anything, which leaves "%1" in the expression instead of the ability name, or evaluates completely so the gauge does not update with the variable. I've tried various syntax using brackets, braces, parenthesis, %expand... I just can't figure out how to make it adjust the gauges as needed.

So, I need either a way to get the gauges to call the functions (I don't expect this is possible), or a way to make it so an Event can adjust the Gauge code by expanding only the %1 while leaving everything else intact.
_________________
.geniusclown
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Sep 17, 2011 1:48 pm   
 
I'm still seeking a solution to this: how can I force expansion on "%1" only within a #GAUGE command?
_________________
.geniusclown
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Sep 17, 2011 3:55 pm   
 
Try compiling the #GAUGE command as a string, and executing it. Would look something like #EXECUTE %concat("#GAUGE id caption ",%1," maxvalue ....").
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sun Sep 18, 2011 9:29 pm   
 
Brilliant! Worked like a charm!
_________________
.geniusclown
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