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
miegorengman
Beginner


Joined: 05 Sep 2008
Posts: 19

PostPosted: Wed Jun 08, 2022 6:34 pm   

getting my syntax right
 
i have many buttons that share variables with aliases and triggers. for these i avoid using toggle buttons as the variable will refresh but not the toggle state, forcing me to click cmud toggles twice to change the state. my homemade toggles look something like this.

Code:

#if (@activitiesonoff < 100) {
  #t- activities
  #VAR showonoff {inactive}
  #variable activitiesonoff {101}
  } {
  #t+ activities
  #var showonoff {ACTIVE}
  #variable activitiesonoff {99}
  }


this setup has 2 separate variables, one string to display the state and one integer allowing the if to change the state.

some years later i think i have learned more, so i decide to use a single string variable....just the string, but no worky


i have a button captioned: autoSC with the
with script text: #if (@autosc = "on"){#var autosc {off}}{#var autosc {on}}

or

Code:
<button autosize="false" width="87" height="16" color="black" textcolor="#339966" priority="34610" id="3461">
  <caption>autoSC @autosc</caption>
  <value>#if (@autosc = "on"){#var autosc {off}}{#var autosc {on}}</value>
</button>

[code]

I have referred to the CMUD Manual and a comparable example is: [code]#IF (@line =~ "You receive (%d) coins") {split %pat(1)}[/code]

and I have tried a number of variations but as far as I can tell my syntax within the first set of brackets is wrong...but I can't tell how.

I have tried the following variations and more:
(@autosc =~ "on")
(@autosc = {"on"})
(@autosc = {on})
(@autosc = ("on"))
(@autosc = on)
(@autosc =~ "on")
(@autosc = "on")


if anyone has any suggestions that would be wonderful.
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jun 08, 2022 7:27 pm   
 
Your issue seems to be one of spacing. Or rather, its lack.
Try:

#if (@autosc = "on") {#var autosc {off}} {#var autosc {on}}
_________________
Discord: Shalimar#3679
Reply with quote
miegorengman
Beginner


Joined: 05 Sep 2008
Posts: 19

PostPosted: Wed Jun 08, 2022 10:19 pm   
 
thank you for the quick response and thank you for the detail :)
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