qbasic.hlp (Topic list)
STRIG, ON STRIG Statements
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
STRIG enables, disables, or suspends joystick event trapping.
If event trapping is enabled, ON STRIG branches to a subroutine whenever
a specified joystick trigger is pressed.
 
STRIG(n%) ON
STRIG(n%) OFF
STRIG(n%) STOP
ON STRIG(n%) GOSUB line
 
    ■ n%                A value that specifies a joystick trigger:
 
                        n%    Trigger
                        ══    ═════════════════════════
                        0     Lower trigger, joystick A
                        2     Lower trigger, joystick B
                        4     Upper trigger, joystick A
                        6     Upper trigger, joystick B
 
    ■ STRIG(n%) ON      Enables joystick event trapping.
    ■ STRIG(n%) OFF     Disables joystick event trapping.
    ■ STRIG(n%) STOP    Suspends joystick event trapping. Events are
                        processed once event trapping is enabled by STRIG ON.
    ■ line              The label or number of the first line of the
                        event-trapping subroutine.
 
Example:
    'This example requires a joystick.
    ON STRIG(0) GOSUB Handler
    STRIG(0) ON
    PRINT "Press Esc to exit."
    DO UNTIL INKEY$ = CHR$(27): LOOP
    END
 
Handler:
    PRINT "Joystick trigger is depressed."
    RETURN
 
See Also    STICK    STRIG Function