Event (Click)

From Mario Fan Games Galaxy Wiki

Events are the Click products' general programming interface. They are comprised of conditions and actions, and can be organized into groups. TGF/MMF execute programs by checking each event, in order, from top to bottom. If the conditions in that event are true, the actions will be run, again from top to bottom.

Conditions

Conditions are basically just tests: if the requirements of the condition are met, the condition is considered true and TGF/MMF evaluates the next condition, if there is one; if a condition is not met, it is false, and TGF/MMF immediately skip to the next event. In order for the actions to be run, all of the conditions in the event must be true. Because of this, it is good practice to make sure conditions that are most likely to be false are put on top of the event list, to minimize the number of conditions TGF/MMF must test should the event ultimately be false.

There are two types of conditions, evaluated and triggered. Evaluated conditions are by far the most common; like their name states, MMF/TGF must evaluate the expressions the condition contains, to determine if the condition is true or false. Triggered conditions give MMF/TGF a true or false immediately; in TGF2/MMF2, they appear in red text by default, if they are on top of the condition list. Triggered conditions actually "remove" their entire event from the event list; the event is not evaluated unless the triggered event itself is called. Triggered events have the ability to be run out-of-order from the main event loop; they are basically functions. Like the main event loop, they are executed from top-to-bottom. For example, in a list of triggered events like so:

"Object A" collides with "Object B"
--> Object A - Set AV A: 0

"Object A" collides with "Object B"
--> Object A - Set AV A: 3

"Object A" collides with "Object B"
--> Object A - Set AV A: 1

AV A of Object A will be set 0, 3, 1 in that order.

Actions

Actions do things; when an event is true, the actions in that event will run. The objects that are actually affected by the actions are chosen through object selection. Only the objects within that selection will be affected by the actions; others will be ignored. For the most part, the results of actions take effect immediately. In some cases, however, they are delayed, notably the Destroy action.