And another version…
you’ll need a small “Global Script”, the “From Rackspaces” block in your local rackspaces and a parameter-connection for the Global widget to the local one (the Global widget has to have a OSC/Script name which must match the variable name in the script! → widget/Advanced tab).
You can view/edit this Global script under Menu/Window/Show Global Rackspace Script Editor
Remember to press the “Compile” button if you made some changes!
var
global_exp1 : widget
On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
SetWidgetValue (global_exp1, GetWidgetValue(global_exp1) +0.000001)
End
The trick i use in the global script, is to induce a slight change to the global pedal widget (+0.000001) on every rackspace change… this forces the the global parameter to be updated each time this happens and nobody will ever notice the 0.000001 ).
Here is the gig file to try… if this suits your needs, you can then copy the code block and change the regarding names and add the additional two expression pedal widgets as new variables (remember to give them corresponding names in the widget/Advanced tab first!).
We could also check if the NewRackspace is smaller than the OldRackspace and the subtract, other way add 0.00001, plus check for 0 and 1.0 and change polarity of the increment according to the situation.
Thanks so much. I tried to do it myself (best way to learn) and I think this worked. Any reason why it wouldn’t? THANKS for all the help!!
var
global_exp1 : widget
global_exp2 : widget
global_exp3 : widget
On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
If GetWidgetValue(global_exp1)==1 Then
SetWidgetValue (global_exp1, GetWidgetValue(global_exp1) -0.000001) Else
SetWidgetValue (global_exp1, GetWidgetValue(global_exp1) +0.000001)
End
If GetWidgetValue(global_exp2)==1 Then
SetWidgetValue (global_exp2, GetWidgetValue(global_exp2) -0.000001) Else
SetWidgetValue (global_exp2, GetWidgetValue(global_exp2) +0.000001)
End
If GetWidgetValue(global_exp3)==1 Then
SetWidgetValue (global_exp3, GetWidgetValue(global_exp3) -0.000001) Else
SetWidgetValue (global_exp3, GetWidgetValue(global_exp3) +0.000001)
End
End
Yes, what you wrote will work – however it will be a little bit slower because you’re making multiple function calls, e.g. GetWidgetValue(global_exp1) that always return the same value. The slowdown won’t be much (and mightn’t even matter at all) but using a local variable is still a little easier to manage.
That’s precisely why I wrote the line
var
newValue : double = GetWidgetValue(global_exp1)
so that I could use a simple variable, newValue, rather than calling the function three times.
However, if you have to repeat the same code multiple times (you’re doing it for three different widgets) then it’s worth creating a function call to do the work.
For example,
var
global_exp1 : widget
global_exp2 : widget
global_exp3 : widget
Function UpdateWidget(aWidget : Widget)
var
newValue : double = GetWidgetValue(aWidget)
if newValue == 1.0
then newValue = newValue - 0.000001
else newValue = newValue + 0.000001
End
SetWidgetValue (aWidget, newValue)
End
On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
UpdateWidget(global_exp1)
UpdateWidget(global_exp2)
UpdateWidget(global_exp3)
End
Try to use 1.0, which means a double (floating point) value, instead of just 1, which implies an integer value which is not allowed as a widget value. I could imagine that this might be an issue.