QBasic 1.1: STRIG Function
Explanation
STRIG Function
Returns the status of a joystick trigger.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
Description / Parameter(s)
n% |
A value that specifies a joystick status condition: |
|
n% | Condition |
0 | Lower joystick A trigger was pressed since last STRIG(0) |
1 | Lower joystick A trigger is currently pressed |
2 | Lower joystick B trigger was pressed since last STRIG(2) |
3 | Lower joystick B trigger is currently pressed |
4 | Upper joystick A trigger was pressed since last STRIG(4) |
5 | Upper joystick A trigger is currently pressed |
6 | Upper joystick B trigger was pressed since last STRIG(6) |
7 | Upper joystick B trigger is currently pressed |
|
STRIG returns -1 if the condition is true, 0 otherwise. |
Example
PRINT "Press Esc to exit."
DO
IF STRIG(0) OR INKEY$ = CHR$(27) THEN EXIT DO
LOOP
DO
BEEP 'BEEP while trigger A is pressed.
LOOP WHILE STRIG(1)