So I am attempting to make a simple button that, basically, turns my skin's "edit mode" on if its off, and off if its on. I found
this thread from several years ago on this very topic and it has been very enlightening for getting me this far, but I have hit a bit of a snag. To my eyes I have followed the instructions to the letter, but the button is still not working and I don't know why at this point. I am hoping that someone here will be able to look at my script and see where I went wrong.
Code: Select all
[MeasureEditMode]
Measure=Calc
Formula=#EditMode#
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption MeterEditModeButton LeftMouseUpAction "[!SetVariable Variables EditMode 0 "Settings.inc"]"][!SetOption MeterEditModeButtonText Text "Turn Edit Mode OFF"][!UpdateMeter "MeterEditModeButton"][!UpdateMeter "MeterEditModeButtonText"][!Redraw]
IfFalseAction=[!SetOption "MeterEditModeButton" LeftMouseUpAction "[!SetVariable Variables EditMode 1 "Settings.inc"]"][!SetOption MeterEditModeButtonText Text "Turn Edit Mode ON"][!UpdateMeter "MeterEditModeButton"][!UpdateMeter "MeterEditModeButtonText"][!Redraw]
DynamicVariables=1
Here is what I have for my measure. I'm storing the variable being changed within a separate .inc file for various settings, but that aside as far as I can tell, the measure is identical to the example balala gave. Funnily enough, the text on the button
does actually change dependent on the state of the variable, but otherwise the measure doesn't seem to be doing anything. And yes the variables section does have DynamicVariables set to 1.
Code: Select all
[MeterEditModeButton]
Meter=Shape
Shape=Rectangle 0,0, 80,50 | Fill Color 0,0,0,1 | StrokeWidth 3 | StrokeColor #BaseColor#
X=5
Y=230
LeftMouseUpAction=[!SetVariable EditMode "(1-#EditMode#)" "Settings.inc"][!UpdateMeasure "MeasureEditMode"][!UpdateMeter "#CURRENTSECTION#"]
DynamicVariables=1
[MeterEditModeButtonText]
Meter=String
MeterStyle=StyleString
StringAlign = centercenter
FontSize=6
clipString = 2
H =30
W =50
X=40r
Y=25r
Text=
DynamicVariables=1
And here is what I have for the button, nothing too noteworthy going on here. I'm not entirely sure what "(1-#EditMode#)" is doing since the variable being changed has already been defined as #EditMode#, but thats how it was in balala's example. I was able to make it kinda work by defining LeftMouseUpAction as
Code: Select all
LeftMouseUpAction=[!WriteKeyVariable EditMode 1 "Settings.inc"][!UpdateMeasure "MeasureEditMode"][!UpdateMeter "#CURRENTSECTION#"]
but that only get me as far as editing the variable in that direction, and since I want to be able to toggle it both ways with the same button, thats not that helpful. I hope y'all are able to see whats probably a really simple step I missed somewhere in here, because I can't find the mistake. Thank you.