QBasic 1.1: ON STRIG Statement
Explanation
STRIG, ON STRIG Statements
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.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
STRIG(n%) ON |
STRIG(n%) OFF |
STRIG(n%) STOP |
ON STRIG(n%) GOSUB line |
Description / Parameter(s)
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