I’m trying to use “OnSystemEvent Matching GigLoaded” in order to set a boolean variable in the global rackspace. My global rackspace script handles OnWidgetChanged events but the trouble is when the gig loads the code is executing in OnWidgetChanged and I don’t want that code to execute while the gig is loading and setting the initial widget values.
I am hoping to use a boolean variable, isGigLoaded, which is initially set to false. Then, do not execute the code in OnWidgetChanged until the GigLoaded system event is received and the isGigLoaded boolean is set to true.
Please advise if this approach is possible or if there is an alternative implementation.
You may try this. I put it in my global rackspace. Basically I look for loaded as part of a conditional for widget change to work.
Var
aa : Widget
bb : Widget
cc : Widget
stat: boolean
filename: String = "racks.txt"
rs: String
var Loaded : boolean
initialization
rs = LoadStringFromTextFile(filename)
Print("rackspace number=" + rs)
SwitchToRackspace(StringToInt(rs),1)
End
// The below will not execute until the Entire Gig is loaded
On WidgetValueChanged(newValue : double) from aa
if newValue==1 and Loaded then
SwitchToRackspace(2, 1)
stat = SaveStringToTextFile(filename,"2")
End
End
On WidgetValueChanged(newValue : double) from bb
//Print ("Widget value bb changed. Newvalue is " + newValue)
if newValue==1 and Loaded then
SwitchToRackspace(1, 1)
stat =SaveStringToTextFile(filename,"1")
End
End
On WidgetValueChanged(newValue : double) from cc
//Print ("Widget value cc changed. Newvalue is " + newValue)
if newValue==1 and Loaded then
SwitchToRackspace(0, 1)
stat =SaveStringToTextFile(filename,"0")
End
End
On SystemEvent Matching GigLoaded
Loaded = True
Print ("Gig Loaded " + Loaded)
End