 |
miegorengman Beginner
Joined: 05 Sep 2008 Posts: 19
|
Posted: 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. |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4525 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
 |
miegorengman Beginner
Joined: 05 Sep 2008 Posts: 19
|
Posted: Wed Jun 08, 2022 10:19 pm |
thank you for the quick response and thank you for the detail :)
|
|
|
 |
|
|