Trouble understanding basic GPScript syntax

Hi all, I’m new to both GP and GPScript and struggling finding the resources to fully get the syntax and how things are referenced. I’ve been looking through the main manual, scripting manual for 4.7 and the language reference as well as various entries in the blog as well as this scripting thread without luck for what I’m looking for. I suspect I’m at too basic a level of understanding the syntax for it to be mentioned there.

In particular the scriptlet I’m experimenting with uses:

On ControlChangeMessage(m : ControlChangeMessage) Matching 12

I can get it to start doing things like playing notes when I activate the pedal that sends that message but need to know how to parse the message.

Presumably this returns a variable “m” of type ControlChangeMessage, so how do I access the components of that object like value of m so I can, for example, have a conditional that is only called if the m[value] == 127 (for example if the language was JavaScript or PHP which I am fairly proficient with). I believe I know how to write the conditional itself, just not how to grab the value.

And if someone can point me to the resource that answers that it’d be appreciated.


From the Gig Performer menu, if you go to Help > Documentation, there is a link to the GP script function list. I use this all the time to look through the complete list of functions. It’s conveniently grouped by major area, and is easily searchable.

e.g. under MIDI you will see functions such as GetCCNumber and GetCCValue.

if GetCCNumber(m) == 12 then ... end
if GetCCValue(m) == 127 then ... end

If course, if you’re using the “Matching 12” in the callback, then you never have to check the CC Number, as it will always be 12.

Thanks, I have actually been perusing that function list extensively but somehow my brain just isn’t getting how to use that so your answer is super helpful.

1 Like