XPLMProcessing


Register flight-loop callbacks that fire before or after X-Plane integrates the flight model each frame.


Enumerations

XPLMFlightLoopPhaseType

You can register a flight loop callback to run either before or after the flight model is integrated by X-Plane.

Constant Value Description
xplm_FlightLoop_Phase_BeforeFlightModel 0 Your callback runs before X-Plane integrates the flight model.
xplm_FlightLoop_Phase_AfterFlightModel 1 Your callback runs after X-Plane integrates the flight model.

Functions

XLuaGetElapsedTime()

Returns: number

This routine returns the elapsed time since the sim started up in decimal seconds. This is a wall timer; it keeps counting upward even if the sim is pasued. WARNING: XPLMGetElapsedTime is not a very good timer! It lacks precision in both its data type and its source. Do not attempt to use it for timing critical applications like network multiplayer.

XLuaGetCycleNumber()

Returns: integer

This routine returns a counter starting at zero for each sim cycle computed/video frame rendered.

XLuaCreateFlightLoop({k})

Returns: XPLMFlightLoopID

This routine creates a flight loop callback and returns its ID. The flight loop callback is created using the input param struct, and is inited to be unscheduled. Use XPLMScheduleFlightLoop to schedule it.

Argument Type Notes
params {k} Hash table — {{ field = value, ... }} (see SDK docs for fields)
XLuaDestroyFlightLoop(flightLoopID)

Returns: (returns nothing)

This routine destroys a flight loop callback by ID. Only call it on flight loops created with the newer XPLMCreateFlightLoop API.

Argument Type Notes
flightLoopID XPLMFlightLoopID Enum — use a constant from XPLMFlightLoopID
XLuaScheduleFlightLoop(flightLoopID, interval, relativeToNow)

Returns: (returns nothing)

This routine schedules a flight loop callback for future execution. If inInterval is negative, it is run in a certain number of frames based on the absolute value of the input. If the interval is positive, it is a duration in seconds. If inRelativeToNow is true, times are interpreted relative to the time this routine is called; otherwise they are relative to the last call time or the time the flight loop was registered (if never called).

Argument Type Notes
flightLoopID XPLMFlightLoopID Enum — use a constant from XPLMFlightLoopID
interval number
relativeToNow boolean

Examples

Examples coming soon.