I’m trying to write a bit of script which picks up the label value of a widget attached to a scriptlet on a variation change and then use that to change to a plugin preset - this is based on the this post.
However, what I am seeing is that whilst the script can read the correct, new, widget VALUE on a variation change, the LABEL corresponds to the value from the previous variation.
Attached is a simple Gig File - it has one rackspace with two variations. The rackspace has a single widget attached to a widget in the global rackspace that is attached to a scriptlet that only has code to set the parameter values (it doesn’t DO anything) - parameter values are 0.0 = Yesterday, 0.5 = Today, 1.0 = Tomorrow.
Widget Label Not Updated on Variation .gig (39.6 KB)
Simple code in the Global Rackspace:
var knob_day : Widget
// Called automatically after script is loaded
Initialization
Print("***Initialisation***")
Print(GetWidgetLabel(knob_day))
End
// Called when you switch variations
On Variation(oldVariationIndex : integer, newVariationIndex : integer)
Print("***Variation***")
Print(GetVariationName(newVariationIndex))
Print(GetWidgetLabel(knob_day))
End
On WidgetValueChanged(newValue : double) from knob_day
Print("****Widget Value Changed****")
Print(newValue)
Print(GetWidgetLabel(knob_day))
End
And likewise in the local rackspace:
var knob_day_local : Widget
Initialization
Print("**** LOCAL INIT *****")
Print(GetWidgetLabel(knob_day_local))
End
On Variation(oldVar : integer, newVar : integer)
Print("**** LOCAL VAR *****")
Print(GetWidgetValue(knob_day_local))
Print(GetWidgetLabel(knob_day_local))
End
On WidgetValueChanged(newValue: double) from knob_day_local
Print("***** LOCAL WIDGET ****")
Print(GetWidgetValue(knob_day_local))
Print(GetWidgetLabel(knob_day_local))
End
Variations are named as per the value set for the knob in that local rackspace (e.g. Var Yesterday means the widget is set to the parameter “Yesterday”)
Starting with the varation Var Yesterday and selecting Var Tomorrow and then back to Var Yesterday gives this output
You can hopefully see that it picks up the correct widget value (Tomorrow = 1.0, Yesterday = 0.0), but the widget label is from the previous value. This happens both in the local and global rackspaces.
I tried it with a plugin that produces text output to a widget label and the same thing happened so it is not related to the scriptlet.
So, what am I doing wrong?