Page tree
Skip to end of metadata
Go to start of metadata

Introduction

System event handlers are different from addGlobalEventHandler or VBS Custom Event Handlers event handlers by being mission-independent, i.e. they are not reset when existing or restarting a mission, and will even fire outside of a mission (e.g. in the main menu).

Definition

System event handlers are added via addSystemEventHandler (multiple handlers can be added to the same kind of event - e.g. two different actions when the mouse is clicked, each defined via a separate addSystemEventHandler).

They are removed either individually (via their index number), with removeSystemEventHandler, or, if all handlers of a specific type should be cleared, with removeAllSystemEventHandlers.


Event Handlers by Category

Mouse Events


The possible return values are:

  • displayID: Display - Display object of selected dialog
  • controlID: Control - Control object of selected dialog ("No control" if not above a control)
  • mouse_Button: Number - Number indicating mouse button pressed. 0=left, 1=right, 2=middle
  • cursorX: Number - Horizontal mouse position relative to the screen's center (with the upper left corner being [-1,-1], and the lower right corner being [1,1].
  • cursorY: Number - Vertical mouse position relative to the screen's center.
  • shiftPressed: Boolean - Returns true if the either <Shift> button was pressed during the event.
  • controlPressed: Boolean - Returns true if the either <Control> button was pressed during the event.
  • altPressed: Boolean - Returns true if the either <Alt> button was pressed during the event.
  • mouseZ: [Number]] - The number of "lines" moved by the scrollwheel

MouseButtonDown

Runs once when the mouse button is pressed.

Passed array: [displayID, controlID, mouse_Button, cursorX, cursorY, shiftPressed, ctrlPressed, altPressed]

MouseButtonUp

Runs once when the mouse button is released.

Passed array: [displayID, controlID, mouse_Button, cursorX, cursorY, shiftPressed, ctrlPressed, altPressed]

MouseButtonClick

Runs once when the mouse button is pressed and released.

Passed array: [displayID, controlID, mouse_Button, cursorX, cursorY, shiftPressed, ctrlPressed, altPressed]

MouseButtonDblClick

Runs once when the mouse button is quickly pressed and released twice.

Passed array: [displayID, controlID, mouse_Button, cursorX, cursorY, shiftPressed, ctrlPressed, altPressed]

MouseMoving

Runs when the mouse is moved. (5th returned element is unutilized, and always false)

Passed array: [displayID, controlID, cursorX, cursorY, false]

MouseZChanged

Runs when the mouse's scrollwheel is moved.

Passed array: [displayID, controlID, mouseZ]