STRIG(n): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "The {{KW|STRIG(n)}} statement controls event trapping for a particular joystick or game pad device button. {{PageSyntax}} ::STRIG({{Parameter|button%}}) {ON|OFF|STOP} QB64 {{PageSyntax}} ::STRIG[(''button_function%''[, ''device_number%''])] {ON|OFF|STOP} {{PageDescription}} * {{Parameter|button function}} specifies the device's button function. Even functions record events while odd ones read the actual presses. * '''QB64''' can designate a button function and cont...")
 
No edit summary
Line 20: Line 20:


''Example:''
''Example:''
{{CodeStart}} '' ''
{{CodeStart}}
{{Cl|ON STRIG(n)|ON STRIG}}(0) {{Cl|GOSUB}} 10
{{Cl|ON STRIG(n)|ON STRIG}}(0) {{Cl|GOSUB}} 10
{{Cl|STRIG(n)|STRIG}}(0)ON
{{Cl|STRIG(n)|STRIG}}(0)ON
Line 36: Line 36:
     {{Cl|_DELAY}} 0.02
     {{Cl|_DELAY}} 0.02
{{Cl|NEXT}}
{{Cl|NEXT}}
{{Cl|RETURN}} '' ''
{{Cl|RETURN}}
{{CodeEnd}}
{{CodeEnd}}



Revision as of 02:48, 23 January 2023

The Template:KW statement controls event trapping for a particular joystick or game pad device button.


Syntax

STRIG(button%) {ON|OFF|STOP}


QB64

Syntax

STRIG[(button_function%[, device_number%])] {ON|OFF|STOP}


Description

  • button function specifies the device's button function. Even functions record events while odd ones read the actual presses.
  • QB64 can designate a button function and controller device number from 0 to 256.
  • When no parameters are used QB64 enables, disables or suspends the reading of ALL button events.
  • ON specifies that event trapping is turned on for the specified button.
  • OFF specifies that event trapping is turned off for the specified button.
  • If Template:KW is specified, event trapping is suspended for the specified button. Further joystick button events are remembered and trapped, in order, after the next Template:KW statement is used.


Example:

ON STRIG(0) GOSUB 10
STRIG(0)ON

DO
    PRINT ".";
    _LIMIT 30
LOOP UNTIL INKEY$ <> ""
END

10
a$ = "[STRIG 0 EVENT]"
FOR x = 1 TO LEN(a$)
    PRINT MID$(a$, x, 1);
    _DELAY 0.02
NEXT
RETURN


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link