Event Sheets are lists of events and actions that form the logic for a Construct project.






Include Event Sheets


By default Construct places "Include Event Sheet" statements at the top of an event sheet for legibility. Although these statements can be moved around and even placed under conditionals, these actions only affect the order of execution. All event sheets (which are represented as XML) are converted to Javascript and bundled in the final exported code during the build process.

The include statements are not processed at a run-time conditional level. All event sheets are bundled into the final JS code of a project irrespective of whether they are explicitly included. Remember, there is a difference between the inclusion of event sheet code, and the execution of said code. An event sheet's code will not be executed unless it is either the primary Event Sheet for an Active Layout or is included in the primary Event Sheet.

twVs5zq[1].png
Event sheet 2 is included even though the conditional is false.





Order of Execution



Events are processed in the event sheets in the order in which they are included in the master event sheet, that is, the event sheet assigned from the layout's properties. When an event sheet includes other event sheets, those event sheets are executed in the order in which they are included, top to bottom.

For example, if the Layout Event Sheet is set to some "Master Event Sheet", and the Master Event Sheet looks like the following:
  • Include PlayerEvents
  • Include EntityEvents
  • Rest of Code

Processing order is:
  1. PlayerEvents Triggers (such as Start of Layout)
  2. EntityEvents Triggers (such as Start of Layout)
  3. MasterEvents Triggers (such as Start of Layout)
  4. Events inside Player Sheet
  5. Events inside Entity Sheet
  6. Remaining Events inside Master Sheet


Although it was previously mentioned that conditional inclusion of event sheets has no effect on the final JS code, it most certainly can and will impact the event sheet's execution. In the following example, the player can toggle the execution of the code within event sheet 2 by clicking the right mouse button. The SecondSheetFunction will *always* run assuming an "Include: Event Sheet 2" statement exists regardless of the placement of the include statement since a function is a trigger.

Event Sheet Inclusion Execution.png