In the Scripting Language Documentation, the callback “On Variation(oldVariation,newVariation)” states: “Called when you switch to another variation”.
I want to use this callback to notify me when the variation changes. It is confusing to me because I don’t have parameters I can pass to it … I just want to be notified when the variation changes. Can I pass null parameters?
For example, I tried using this code. It is looking for parameters to be passed and obviously I received a compile error:
On Variation ()
PutTriggerNotesInOrder(Trigger_Flat5AR, Flat5_Intervals)
End
The on variation callback has parameters which you can use or not.
You do not pass parameters to this callback as it is a callback which is called when a variation changes,
And the you can use the 2 parameters and do what you like.
Yes, I understand this As you can see above, I tried this, but I got a syntax error on “On Variation()”. Can you give me a short code example of how to code it properly to avoid the syntax error?
Usage (Rackspace, Global Rackspace and Gig file scripts):
on variation ( oldVariation : integer, newVariation : integer)
// Called when you switch to another variation
// The parameters indicate which one you’re in now
// and from which one you came
end
Those “parameters” are not to be provided from you - they are just values which are “delivered” each time the callback is triggered, and they have to be defined as the manual states - if you’ll need them or not.
So an empty bracket must not be used with this callback!
You’ll always get two integer values for “oldVariation and newVariation” from this callback.
Yep, I am expecting this callback to provide me the name of the old and new variations. So I tried this code in my Scriptlet and received a syntax error:
Example code:
var
OldVariation : Integer;
NewVariation : Integer;
on variation (OldVariation, NewVariation)
Print("OldVariation, NewVariation: “+OldVariation+” , "+ NewVariation)
End
SYNTAX ERROR: Scriptlet (Scriptlet) - - Syntax Error in “Main”: Line 663, Col 28: Unexpected or unrecognized token: ‘,’
Mismatched input ‘,’ expecting ‘:’
However, that being said, I know you are trying to help - so, I need to compute a variable in my Scriptlet that cannot be a parameter in the scriptlet. … and therefore when variations are changed, the Scriptlet does not remember the value of a variable. it only remembers the value of a Scriptlet parameter.