Onexp_True...GoSub Command

Adds the subsequent event to the event list: If expression is not False, label1 is called. If label2 is provided, it is called when expression is False. See the topic Event-Driven Programming for more information about event-driven commands and how frequently the interpreter tests the value of expression.

Syntax

Onexp_True expression GoSub label1, [label2]

Example

DECLARE iAlt_Time

ONEXP_TRUE NOT INRANGE(PLANE_ALT, 4800, 5200) GOSUB subAlt_Msg, subAlt_Reset

subAlt_Msg:

IF ELAPSED_TIME > iAlt_Time

PRINT "Check your altitude."

iAlt_Time = ELAPSED_TIME + 15

ENDIF

RETURN

subAlt_Reset:

IF INRANGE(PLANE_ALT, 4900, 5100) THEN

iAlt_Time = 0

ENDIF

RETURN