Code:
[VarDef,text,"First text "]
[VarDef,OnOff,0]
//initialize code to set appropriate button text:
[If,[MemGetSize,GM_textchange],
[VarSet,OnOff,[MVarGet,GM_textchange,0]]
[If,[Var,OnOff],[VarSet,text,"Second text"]
,//else
[VarSet,text,"First text "]
]//end if
,//else
[MVarDef,GM_textchange,1][MVarSet,GM_textchange,0,0]
]//end if
[IButton,text,"Info text",
[Note,"Hello world"]
]
[IButton,"Change button text",,
//code for changing text follows. This could be in a routine.
[If,[MVarGet,GM_textchange,0],
[MVarSet,GM_textchange,0,0],
[MVarSet,GM_textchange,0,1]]
[IPress,zscript:reload]
]
I find it useful when testing code of this sort to add a temporary button to delete the memory block so that if I reload the script after changes it starts afresh. Otherwise you have to restart ZB to clear the memory.