Some musings about On Variation

Hello, my friends. I’m putting this out there in case it helps anyone, and also in the hopes of starting a discussion to further my own understanding of a very confusing aspect of GP script-writing.

When you’re in Panels mode, “On Rackspace” gets called every time you change rackspaces, and doesn’t get called if you change variations within a given rackspace. In Setlist mode, likewise, “On Rackspace” gets called only when you switch to a song or songpart that uses a different rackspace than the one you’re coming from. So far, so good. This is the behaviour one would expect.

Furthermore, in Panels mode, “On Variation” only gets called when you switch variations within the same rackspace. Again, this is the expected behaviour.

However, in Setlist mode, “On Variation” gets called every time you change songs or songparts. This is true if you switch to a songpart that uses the very same variation as the one you’re coming from and there are no songpart snapshots, which might be counterintuitive if you were thinking that it would only get called when you change variations. And furthermore, “On Variation” gets called even when you switch to a songpart that uses a completely different rackspace, which might be counterintuitive if you were thinking it would only be called when you switch variations within a single rackspace.

So, if you have code in your global rackspace script which you want to run every time the uses switches rackspaces or variations, you have to run that code from both callbacks, which means it will run twice in Setlist mode but only once in Panels mode. If it’s important that this code only execute one time, then you’ll have to do some fancy footwork, and I haven’t yet figured out how to achieve this. It would appear that “On Variation” gets called first, followed immediately by “On Rackspace”, but this behaviour is not guaranteed.

To make matters even more confusing, it’s also the case that “On Variation” gets called many times during gigfile load, not for every single rackspace but for many of them. The precise rackspaces that trigger an “On Variation” call during gigfile load are unpredictable and appear to be different each time you load the gig.

I would love to hear abouth others’ experiences and strategies regarding the above, and any corrections you may have to what I’ve outlined. It’s possible that some of my findings are somehow specific to my particular configuration so I’d love to hear how it works for you.

Solomon