Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance
- #Persistent
- ;;;;;;;;;;;;;;;;;;;;
- ;;; SET UP HERE! ;;;
- ; This is the sensitivity of the joystick.
- ; Must be between 0 (no input detected) and 49 (unbelievably sensitive)
- Sensitivity = 25
- ;;; ;;;
- ;;;;;;;;;;;;;;;;;;;;
- InverseSensitivity := 100 - Sensitivity
- wasHoldingRight = 0
- wasHoldingLeft = 0
- wasHoldingUp = 0
- wasHoldingDown = 0
- wasHoldingZ = 0
- wasHoldingX = 0
- wasHoldingC = 0
- SetTimer, Update, 10
- return
- Update:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Detect joystick input for each direction ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- GetKeyState, joyx, JoyX
- GetKeyState, joyy, JoyY
- GetKeyState, joypov, JoyPOV
- ; Tooltip, Left: %wasHoldingLeft%`nRight: %wasHoldingRight%`nDown: %wasHoldingDown%`nUp: %wasHoldingUp%
- ; Left
- if (joyx < Sensitivity and wasHoldingLeft == 0) then {
- wasHoldingLeft = 1
- Send, {Left down}
- } else if (joyx >= Sensitivity and wasHoldingLeft == 1) then {
- wasHoldingLeft = 0
- Send, {Left up}
- }
- ; Right
- if (joyx > InverseSensitivity and wasHoldingRight == 0) then {
- wasHoldingRight = 1
- Send, {Right down}
- } else if (joyx <= InverseSensitivity and wasHoldingRight == 1) then {
- wasHoldingRight = 0
- Send, {Right up}
- }
- ; Up
- if (joyy < Sensitivity and wasHoldingUp == 0) then {
- wasHoldingUp = 1
- Send, {Up down}
- } else if (joyy >= Sensitivity and wasHoldingUp == 1) then {
- wasHoldingUp = 0
- Send, {Up up}
- }
- ; Down
- if (joyy > InverseSensitivity and wasHoldingDown == 0) then {
- wasHoldingDown = 1
- Send, {Down down}
- } else if (joyy <= InverseSensitivity and wasHoldingDown == 1) then {
- wasHoldingDown = 0
- Send, {Down up}
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Detect 3 Joystick buttons ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- GetKeyState, z, Joy1
- GetKeyState, x, Joy2
- GetKeyState, c, Joy3
- ; Z
- if (z == "D" and wasHoldingZ == 0) then {
- wasHoldingZ = 1
- Send, {z down}
- } else if (z == "U" and wasHoldingZ == 1) then {
- wasHoldingZ = 0
- Send, {z up}
- }
- ; X
- if (x == "D" and wasHoldingX == 0) then {
- wasHoldingX = 1
- Send, {x down}
- } else if (x == "U" and wasHoldingX == 1) then {
- wasHoldingX = 0
- Send, {x up}
- }
- ; C
- if (c == "D" and wasHoldingC == 0) then {
- wasHoldingC = 1
- Send, {c down}
- } else if (c == "U" and wasHoldingC == 1) then {
- wasHoldingC = 0
- Send, {c up}
- }
- return
- ; Joy7::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement