Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Persistent ; Keep this script running until the user explicitly exits it.
- #SingleInstance force
- SetKeyDelay -1
- turboDelay = 50
- ; JOYSTICK 2
- ; joystick 2 - axis x, y
- joy2up = w
- joy2left = a
- joy2down = s
- joy2right = d
- ; joystick 2 - buttons
- joy2b1 = Numpad4
- joy2b2 = Numpad6
- joy2b3 = Numpad0
- joy2b4 = Numpad5
- joy2b5 = Numpad8
- joy2b6 = Numpad0
- joy2b7 = NumpadAdd
- joy2b8 = Numpad1
- joy2b9 = Numpad9
- joy2b10 = esc
- joy2b11 = Numpad2
- joy2b12 = enter
- ; joystick 2 - turbo button (true = yes, false = no)
- joy2b1turbo = true
- joy2b2turbo = false
- joy2b3turbo = false
- joy2b4turbo = true
- joy2b5turbo = false
- joy2b6turbo = false
- joy2b7turbo = false
- joy2b8turbo = false
- joy2b9turbo = false
- joy2b10turbo = false
- joy2b11turbo = false
- joy2b12turbo = false
- ; joystick 2 - POV (Point Of View), D-PAD or PAD
- joy2PovUp := joy2up
- joy2PovLeft := joy2left
- joy2PovDown := joy2down
- joy2PovRight := joy2right
- joy2PovIdle = -1 ; Only change if you are sure what you are doing.
- joy2PovUpNumber = 0 ; Only change if you are sure what you are doing.
- joy2PovLeftNumber = 27000 ; Only change if you are sure what you are doing.
- joy2PovDownNumber = 18000 ; Only change if you are sure what you are doing.
- joy2PovRightNumber = 9000 ; Only change if you are sure what you are doing.
- j2direction := 1
- SetTimer, WatchAxis2, 5
- WatchAxis2:
- GetKeyState, 2JoyX, 2JoyX ; Get position of X axis.
- GetKeyState, 2JoyY, 2JoyY ; Get position of Y axis.
- GetKeyState, POV2, 2JoyPOV ; Get position of the POV control.
- j2directionPrevious := j2direction
- if (POV2 <> joy2PovIdle) {
- ;diagonal - up + left
- if (POV2 > joy2PovLeftNumber) ; 31500
- {
- j2key1 := joy2PovUp
- j2key2 := joy2PovLeft
- j2direction := 1
- }
- ;left
- else if (POV2 = joy2PovLeftNumber) ; 27000
- {
- j2key1 := joy2PovLeft
- j2direction := 6
- }
- ;diagonal - down + left
- else if (POV2 > joy2PovDownNumber) ; 22500
- {
- j2key1 := joy2PovDown
- j2key2 := joy2PovLeft
- j2direction := 3
- }
- ;down
- else if (POV2 = joy2PovDownNumber) ; 18000
- {
- j2key1 := joy2PovDown
- j2direction := 7
- }
- ;diagonal - down + right
- else if (POV2 > joy2PovRightNumber) ; 13500
- {
- j2key1 := joy2PovDown
- j2key2 := joy2PovRight
- j2direction := 4
- }
- ;right
- else if (POV2 = joy2PovRightNumber) ; 9000
- {
- j2key1 := joy2PovRight
- j2direction := 5
- }
- ;diagonal - up + right
- else if (POV2 > joy2PovUpNumber) ; 4500
- {
- j2key1 := joy2PovUp
- j2key2 := joy2PovRight
- j2direction := 2
- }
- ;up
- else if (POV2 = joy2PovUpNumber) ; 0
- {
- j2key1 := joy2PovUp
- j2direction := 8
- }
- else
- {
- j2key1 =
- j2key2 =
- j2direction := 0
- }
- }
- else
- {
- ;diagonal - up + left
- if (2JoyY < 30) and (2JoyX < 30)
- {
- j2key1 := joy2up
- j2key2 := joy2left
- j2direction := 1
- }
- ;diagonal - up + right
- else if (2JoyY < 30) and (2JoyX > 70)
- {
- j2key1 := joy2up
- j2key2 := joy2right
- j2direction := 2
- }
- ;diagonal - down + left
- else if (2JoyY > 70) and (2JoyX < 30)
- {
- j2key1 := joy2down
- j2key2 := joy2left
- j2direction := 3
- }
- ;diagonal - down + right
- else if (2JoyY > 70) and (2JoyX > 70)
- {
- j2key1 := joy2down
- j2key2 := joy2right
- j2direction := 4
- }
- ;right
- else if 2JoyX > 70
- {
- j2key1 := joy2right
- j2direction := 5
- }
- ;left
- else if 2JoyX < 30
- {
- j2key1 := joy2left
- j2direction := 6
- }
- ;down
- else if 2JoyY > 70
- {
- j2key1 := joy2down
- j2direction := 7
- }
- ;up
- else if 2JoyY < 30
- {
- j2key1 := joy2up
- j2direction := 8
- }
- else
- {
- j2key1 =
- j2key2 =
- j2direction := 0
- }
- }
- if j2direction <> %j2directionPrevious%
- {
- Send, {%joy2up% up}
- Send, {%joy2left% up}
- Send, {%joy2down% up}
- Send, {%joy2right% up}
- if (j2direction >= 1) and (j2direction <= 4)
- {
- Send, {%j2key1% down}
- Send, {%j2key2% down}
- }
- else
- {
- Send, {%j2key1% down}
- }
- }
- return ; WatchAxis2 end
- ; BUTTON 1
- ; joystick 2
- 2Joy1::
- if (%joy2b1turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy1, 2Joy1, P ; Get the state of button (U = Up and D = Down)
- if state2Joy1 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b1% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b1% up}
- } ;loop end
- } else {
- send {%joy2b1% down}
- KeyWait 2Joy1
- send {%joy2b1% up}
- } ; if end
- return
- ; BUTTON 2
- ; joystick 2
- 2Joy2::
- if (%joy2b2turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy2, 2Joy2, P ; Get the state of button (U = Up and D = Down)
- if state2Joy2 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b2% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b2% up}
- } ;loop end
- } else {
- send {%joy2b2% down}
- KeyWait 2Joy2
- send {%joy2b2% up}
- } ; if end
- return
- ; BUTTON 3
- ; joystick 2
- 2Joy3::
- if (%joy2b3turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy3, 2Joy3, P ; Get the state of button (U = Up and D = Down)
- if state2Joy3 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b3% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b3% up}
- } ;loop end
- } else {
- send {%joy2b3% down}
- KeyWait 2Joy3
- send {%joy2b3% up}
- } ; if end
- return
- ; BUTTON 4
- ; joystick 2
- 2Joy4::
- if (%joy2b4turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy4, 2Joy4, P ; Get the state of button (U = Up and D = Down)
- if state2Joy4 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b4% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b4% up}
- } ;loop end
- } else {
- send {%joy2b4% down}
- KeyWait 2Joy4
- send {%joy2b4% up}
- } ; if end
- return
- ; BUTTON 5
- ; joystick 2
- 2Joy5::
- if (%joy2b5turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy5, 2Joy5, P ; Get the state of button (U = Up and D = Down)
- if state2Joy5 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b5% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b5% up}
- } ;loop end
- } else {
- send {%joy2b5% down}
- KeyWait 2Joy5
- send {%joy2b5% up}
- } ; if end
- return
- ; BUTTON 6
- ; joystick 2
- 2Joy6::
- if (%joy2b6turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy6, 2Joy6, P ; Get the state of button (U = Up and D = Down)
- if state2Joy6 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b6% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b6% up}
- } ;loop end
- } else {
- send {%joy2b6% down}
- KeyWait 2Joy6
- send {%joy2b6% up}
- } ; if end
- return
- ; BUTTON 7
- ; joystick 2
- 2Joy7::
- if (%joy2b7turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy7, 2Joy7, P ; Get the state of button (U = Up and D = Down)
- if state2Joy7 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b7% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b7% up}
- } ;loop end
- } else {
- send {%joy2b7% down}
- KeyWait 2Joy7
- send {%joy2b7% up}
- } ; if end
- return
- ; BUTTON 8
- ; joystick 2
- 2Joy8::
- if (%joy2b8turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy8, 2Joy8, P ; Get the state of button (U = Up and D = Down)
- if state2Joy8 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b8% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b8% up}
- } ;loop end
- } else {
- send {%joy2b8% down}
- KeyWait 2Joy8
- send {%joy2b8% up}
- } ; if end
- return
- ; BUTTON 9
- ; joystick 2
- 2Joy9::
- if (%joy2b9turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy9, 2Joy9, P ; Get the state of button (U = Up and D = Down)
- if state2Joy9 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b9% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b9% up}
- } ;loop end
- } else {
- send {%joy2b9% down}
- KeyWait 2Joy9
- send {%joy2b9% up}
- } ; if end
- return
- ; BUTTON 10
- ; joystick 2
- 2Joy10::
- if (%joy2b10turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy10, 2Joy10, P ; Get the state of button (U = Up and D = Down)
- if state2Joy10 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b10% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b10% up}
- } ;loop end
- } else {
- send {%joy2b10% down}
- KeyWait 2Joy10
- send {%joy2b10% up}
- } ; if end
- return
- ; BUTTON 11
- ; joystick 2
- 2Joy11::
- if (%joy2b11turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy11, 2Joy11, P ; Get the state of button (U = Up and D = Down)
- if state2Joy11 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b11% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b11% up}
- } ;loop end
- } else {
- send {%joy2b11% down}
- KeyWait 2Joy11
- send {%joy2b11% up}
- } ; if end
- return
- ; BUTTON 12
- ; joystick 2
- 2Joy12::
- if (%joy2b12turbo%) {
- loop { ; loop the script untill broken
- GetKeyState, state2Joy12, 2Joy12, P ; Get the state of button (U = Up and D = Down)
- if state2Joy12 = U
- break ; its been released so break the loop
- sleep, turboDelay
- send {%joy2b12% down}
- sleep, turboDelay ; This is the time between presses, after its slept it will return to the top of the loop and start again
- send {%joy2b12% up}
- } ;loop end
- } else {
- send {%joy2b12% down}
- KeyWait 2Joy12
- send {%joy2b12% up}
- } ; if end
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement