Language changes in GPScript v4

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Language changes in GPScript v4

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 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 afterwards. 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".

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 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.