GML Language overview

Game Maker contains a built-in programming language. This programming language gives you much more flexibility and control than the standard actions. This language we will refer to as GML (the Game Maker Language). There are a number of different places where you can type programs in this language. First of all, when you define scripts. A script is a program in GML. Secondly, when you add a code action to an event. In a code action you again have to provide a program in GML. Thirdly, in the room creation code. And finally, wherever you need to specify a value in an action, you can also use an expression in GML. An expression, as we will see below is not a complete program, but a piece of code resulting in a value.

In this chapter we will describe the basic structure of programs in GML. When you want to use programs in GML, there are a couple of things you have to be careful about. First of all, for all your resources (sprites, objects, sounds, etc.) you must use names that start with a letter and only consist of letters, digits and the underscore '_' symbol. Otherwise you cannot refer to them from within the program. Make sure all resources have different names. Also be careful not to name resources self, other, global, or all because these have special meaning in the language. Also you should not use any of the keywords, indicated below.

Information on the GML language can be found in the following pages:

A Program
Variables
Assignments
Expressions
Extra Variables
Addressing Variables in Other Instances
Arrays
If Statement
Repeat Statement
While Statement
Do Statement
For Statement
Switch Statement
Break Statement
Continue Statement
Exit Statement
Functions
Scripts
With Construction
Comment
Functions and Variables in GML
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)