Language changes in GPScript

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Language changes in GPScript

As of Gig Performer 4, there are some syntactical enhancements to simplify some common operations. There are also many more system functions. This means that while GPScript 4 and later can compile scripts created with earlier versions of GPScript, earlier versions of GPScript will not be able to compile most scripts created with GPScript 4.

Multiple initialization sections

You can now create multiple initialization callbacks in a script. The main purpose of this is to allow you to declare global variable where you need them, with initialization code directly afterward. This provides for some easier maintenance as you can defer declarations to be closer to the code that actually needs them. The initialization sections will be called in the same order in which they are seen in the script.

Combining declarations with initialization

It is now possible to combine some variable declarations with initialization. For example, we can redefine the first example above as follows:

var pi : double = 3.14159

initialization

   Print(pi)

end

 
In many cases, the initialization part can be a function call. Initialization of variables is allowed for both global and local variables. However, you must be careful to ensure that global variables used by such a function call have themselves been initialized otherwise the results are undefined.

Referencing the Global rackspace

Some GPScript functions, such as the BindExternalWidget can explicitly refer to other rackspaces by name. If you need to refer to the Global rackspace in such a function, the name of the Global rackspace is "GLOBAL RACKSPACE".

The SendOSCMessage statement

This statement was added in GP 4.7 and is more convenient than using multiple GP Script system functions to create and send out OSC messages and bundles. This statement is described in more detail here.  

Deprecated functions

Some system functions have been updated and/or their names have been changed to better reflect their purpose. The old versions will remain for a short time, marked as deprecated. If your scripts use functions that have been deprecated, you will see warnings in the Script Logger window. In such cases, we strongly encourage you to update your script as soon as possible to use the new functions so as to avoid problems when the deprecated functions are actually removed.