Constant

From ENIGMA
Jump to navigation Jump to search

Constants refer to "variables" that are accessible everywhere, but whose value cannot change. That is, all constants are read-only. Because of this, a constant isn't technically a variable, but it is included with them for completeness and categorization.

Special object-placeholder constants

Constant Description
self -1; Represents this object. Useful for referring to the original object while inside a with construct.
other -2; Represents the other object in a collision event.
all -3; Represents all objects. Can be used in a with construct to execute code on all active instances in the room. Can also be used in many functions in place of an object argument.
noone -4; Represents a null object, or that no object or instance is stored.
global -5; Used with dot access to globally access a variable. Also used as a keyword to define such variables so that dot access is not needed.
local -7; Used to allow otherwise scoped variables to continue to exist throughout other events of an instance. Otherwise, it is used in Game Maker with dot access to refer to variables local to the current scope (declared with var).

Global constants

Below is a complete list of constants and pages with lists of constants.

Constant Description
pi and M_PI 3.14...; The mathematical pi constant represents the ratio of the circumference of a circle to its diameter, and is used in many trigonometric calculations. The M_PI constant is specific to ENIGMA.
Boolean true (1) and false (0) which indicate that a condition is met or not, respectively.
Color wherever a color is needed, such as arguments to drawing and blending functions. All color constants are prefixed with c_, for example c_blue.
DLL dll_stdcall and dll_cdecl define the type of dll cleanup method, while ty_real and ty_string define the data types.
File start with fa_, for example fa_hidden.
Font related to fonts and text such as alignment
Event alarm, step, user defined and other events
Particle related to particle effects, types, and emitters
Render state used when rendering, for instance to switch to wireframe mode
Blend mode for changing the source and destination color and alpha blending for various image effects
Keyboard keycodes for input from the keyboard
Gamepad keycodes for input from a gamepad/controller
Cursor mouse cursors
Textures textures and filtering
Audio audio falloff references and other constants
Display constants related to display orientation and other settings
Device operating systems and embedded devices
Physics physics related systems
Networking multiplayer and other networking
Buffers buffers that can be used with networking
Vertex describe the format of vertex buffer contents
Shader graphics hardware programs
Primitives primitive shapes and construction
Asset different resource type identifiers