Fs2020 event

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

fs2020_event(event)
fs2020_event(event, value_1)
fs2020_event(event, value_1, value_2) (from AM/AP 4.1)

fs2020_event is used to send an event to FS2020. And can contain a value (this is optional).

You can find the available events for FS2020 here (official).

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 event String Reference to an event from Flight Simulator 2020. Use 'H:' prefix for H events, see example below.
2 value_1 Number (Optional) Send a value with the event. Some events support setting a value.
3 value_2 Number (Optional) Send a value with the event. Some events support setting a value.

Event types

Prefix Type Description
K: K event This is a regular FS2020 event, as shown in their documentation here. When no prefix is defined, this is used.
H: H event Local aircraft event. These are mostly defined in the aircraft model source code (XML).
B: B event FS2020 Input Event. These are mostly defined in the aircraft model source code (XML). Needs flight sim plugins 4.2 or higher.

Example

-- Toggle the Avionics Master switch
fs2020_event("TOGGLE_AVIONICS_MASTER")

-- Set stobe lights on
fs2020_event("STROBES_SET", 1)

-- Fire a H event
fs2020_event("H:AS1000_PFD_MENU_Push")

-- Fire a B event
fs2020_event("B:HANDLING_InertSep", 1)