GML Functions: Generating Events

As you know, Game Maker is completely event driven. All actions happen as the result of events. There are a number of different events. Creation and destroy events happen when an instance is created or destroyed. In each step, the system first handles the alarm events. Next it handles keyboard and mouse events and next the step event. After this the instances are set to their new positions after which the collision event is handled. Finally the draw event is used to draw the instances (note that when there are multiple views the draw event is called multiple times in each step). You can also apply an event to the current instance from within a piece of code. The following functions exist:


 * event_perform(type,numb) Performs event numb of the indicated type to the current instance. For an overview of all event types and numbers see the event type constants.
 * event_perform_object(obj,type,numb) This functions works the same as the function above except that this time you can specify events in another object. Note that the actions in these events are applied to the current instance, not to instances of the given object..
 * event_user(numb) In the other events you can also define 16 user events. These are only performed if you call this function. numb must lie in the range 0 to 15.
 * event_inherited Performs the inherited event. This only works if the instance has a parent object.

You can get information about the current event being executed using the following read-only variables:
 * event_type* Type of the current event begin executed.
 * event_number* Number of the current event begin executed.
 * event_object* The object index for which the current event is being executed.
 * event_action* The index of the action that is currently being executed (0 is the first in the event, etc.).