Scripting: Script Editor

*GG Maker* uses ‘Event-Driven Programming’, which is a form of coding where pre-written pieces of code (or ‘Events’) are used to build scripts in a more visually efficient way for the user. In *GG Maker*, all scripts have a root which is the ‘Start’ event. Events connected to ‘Start’ will begin when the script Is ran and flow in order, like a flowchart. Anything not connected to this event will be ignored.

By clicking ‘Expand Events’, you can view a longer list of pre-built scripts.  Each of these comes with a small description which tells you what each event does when attached to ‘Start’.

When adding new events, they will automatically attach themselves to the last event selected, or ‘Start’ if no events have been placed. The links between events can be broken by right-clicking on them. You can reattach these links by clicking and holding the desired node and moving the cursor until a red line appears. Drag this red line to the desired node and release the cursor.

Some events have parameters that can be changed to produce your desired result. For instance, the ‘Change Existence’ event has the option to change whether an actor ‘exists’ or not. To change these options, double-click on the event or right-click and select ‘edit’ once the event has been placed.

Some events also have a sub directory where scripts are stored, and if these events have parameters then they can only be edited by using ‘edit’. Double-clicking these will open the sub directory.

**Textual Scripting**

If you are a newcomer to *GG Maker* or are unfamiliar with Visual Basic, it is not recommended that you use Textual Scripting. By clicking ‘Mode’ in a script and selecting ‘Textual’, all of your events will convert over into code, HOWEVER this will not work in the opposite direction. Your events may be lost if you choose to return to graphical mode.

**Using Values**

A lot of events in Graphical Scripting will give you the option to retrieve data from different use values by clicking on the clear white box next to an event parameter. These are useful for retrieving all kinds of data which have their uses in scripts, such as items, player health, maps, etc.

**Identifiers**

These include: Global Variables, Local Variables, Switches, Collections and Tables. An identifier is used for storing and retrieving types of information for use in-game.

**String/Numeric Literals**

When referring to string literals, enclose the string with quotations (“ “). For example, when displaying the player’s name, you would first store the name in a Global Variable. You could then call this name in dialogue by using “& strPlayersName”. The concatenate operator (&) is used alongside the name of the Global Variable, retrieving the name data from the variable.

**Operators**

* [+] - is used to add two values together.
* [-] - is used to subtract two values from each other.
* [\*] - is used to multiply two values together.
* [/] - is used to divide two values from each other.
* [=] - is used to determine if one value is equal to another.
* [<] - is used to determine if one value is less than another.
* [>] - is used to determine if one value is greater than another.
* [<=] - is used to determine if one value is less than or equal to another.
* [>=] - is used to determine if one value is greater than or equal to another.
* [<>] - is used to determine if one value is not equal to another.

* And - is used to determine if two or more values are true (for example; Player1.NonExistent = Existent And Player1.Name = “Bob”- the script won't execute unless 'Player1' is both existent AND called Bob)
* Or - is used to determine if one or the other values are true (for example; Player1.NonExistent = Existent Or Player1.Name = “Bob”- the script will execute if 'Player1' is either existent OR called Bob)
* Xor - is used to determine if one and only one of the two values being compared is true. If you use the regular 'Or' operator and both values it compares are true it'll return as being true, however with the 'Xor' operator the value will return false because only one of the two values can be true.
* Not - is used with 'And' or 'Or' operators to determine if a value is not true (for example; Player1.NonExistent = Existent And Not Player1.Name = “Bob”- the script will only execute if 'Player1' is existent AND is NOT called Bob)
* Concatenate (&) - is used to join multiple values together (for example; “My name is ” & strPlayersName - with 'strPlayersName' being a Global Variable that stores the main players name) Not to be mistaken by the add operator. The add operator will literally try to add the two values together as if it's a mathematical equation whereas the concatenate operator is used as a means of joining values together and then comparing the expression as a whole.
* Imp - is used to determine an implication of two values.
* Eqv - is used to determine an equivalent of two values.
* Mod - is used to divide two values and only return the remainder.

**Units of Measurement**

Pixels: The very small squares used to make up an image are called pixels. If you have a screen resolution of 800x600, the game will show 900 pixels running horizontally and 600 running vertically.

Milliseconds: This is 1/1000th of a second. 1000 milliseconds are equivalent to 1 second.

Pixels Per Millisecond (px/ms): This is the amount of pixels an object will move by per millisecond. This is used for things such as Actor Speed.

Pixels Per Millisecond Squared (px/ms/ms): This is the amount of pixel an object will move by per millisecond, per millisecond. An Actor’s Acceleration and Velocity  are measured using this.