Data fields in lumps which specify a script to trigger (such as the map auto-run trigger) don't store script ID numbers. Script ID numbers are only found in lumps directly containing script data and indices (HS, LOOKUP1.BIN, etc.). Instead, script triggers are stored, which are INT fields contains integers between 0 and 32767:
|0||No script, do nothing|
|1-16383||Script ID number, run script n.HSZ|
|16384-32767||Script trigger number + 16384, look up record (n - 16384) in LOOKUP1.BIN to get a script ID number|
If multiple scripts are triggered at once and would start running on the same tick, they get to run in the following order (the first to run, at the top, is actually the last to be triggered). Most scripts will actually start to run on the tick *after* they are triggered. This is because the script interpreter is one of the first things to run on a tick. Anything triggered afterwards is delayed until the next tick.
The first four trigger types run on the same tick they are triggered:
- Note: on-keypress scripts run *after* the player menu controls are handled (but before all other controls, such as player movement). So if the player presses ESC to close a menu and an on-close script gets triggered, the menu is already closed before the on-keypress script sees the ESC!
- Menu-triggered scripts, e.g. attached to menu item, on-close (unless triggered by script, eg "close menu" - that runs immediately) but not Menu-action
- The map autorun script for the map on which a game starts/is loaded from
All other trigger types run on the next tick:
- Instead of battle/After battle
- Map autorun
- Step-on-activated NPC scripts
- Touch-activated NPC scripts
- Textbox scripts
- Use-activated NPC scripts
- Note: "use npc" causes an implicit wait(1)
- Menu-action script (ESC/right click, overriding the main menu)
- Unlike on-keypress scripts, the Menu action script actually runs on the *next* tick (like
- Maybe you were looking for: Other ways to start a script ?