Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Persistent ; Keep this script running until the user explicitly exits it.
- CurrentState = 0
- SetTimer, WatchPOV, 5
- return
- WatchPOV:
- GetKeyState, POV, JoyPOV ; Get position of the POV control.
- KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
- GetKeyState, JoyZ, JoyZ ; Get position of Z axis.
- Move1Prev = %Move1%
- Move2Prev = %Move2%
- ; Some joysticks might have a smooth/continous POV rather than one in fixed increments.
- ; To support them all, use a range:
- ToolTip %POV%
- if POV < 0 ; no angle
- {
- Move1 =
- Move2 =
- }
- else if POV > 32500
- {
- Move1 = w
- Move2 =
- }
- else if POV < 4000
- {
- Move1 = w
- Move2 =
- }
- else if POV < 8000
- {
- Move1 = w
- Move2 = d
- }
- else if POV < 12500
- {
- Move1 =
- Move2 = d
- }
- else if POV < 17000
- {
- Move1 = s
- Move2 = d
- }
- else if POV < 22000
- {
- Move1 = s
- Move2 =
- }
- else if POV < 26000
- {
- Move1 = s
- Move2 = a
- }
- else if POV < 30500
- {
- Move1 =
- Move2 = a
- }
- else if POV > 28000
- {
- Move1 = w
- Move2 = a
- }
- ;if POV < 0 ; No angle to report
- ; KeyToHoldDown =
- ;else if POV > 31500 ; 315 to 360 degrees: Forward
- ; KeyToHoldDown = w
- ;else if POV between 0 and 4500 ; 0 to 45 degrees: Forward
- ; KeyToHoldDown = w
- ;else if POV between 4501 and 13500 ; 45 to 135 degrees: Right
- ; KeyToHoldDown = d
- ;else if POV between 13501 and 22500 ; 135 to 225 degrees: Down
- ; KeyToHoldDown = s
- ;else ; 225 to 315 degrees: Left
- ; KeyToHoldDown = a
- if JoyZ < 40 OR JoyZ > 55
- Send {Shift}
- SetKeyDelay -1
- CurrentState = 0
- if Move1 = %Move1Prev%
- {
- ;do nothing
- }
- else
- {
- if Move1Prev
- {
- Send, {%Move1Prev% up}
- }
- if Move1
- {
- Send, {%Move1% down}
- CurrentState = %CurrentState% | 1
- }
- }
- if Move2 = %Move2Prev%
- {
- ;do nothing
- }
- else
- {
- if Move2Prev
- {
- Send, {%Move2Prev% up}
- }
- if Move2
- {
- Send, {%Move2% down}
- CurrentState = %CurrentState% | 2
- }
- }
- ;if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down (or no key is needed).
- ; return ; Do nothing.
- ; Otherwise, release the previous key and press down the new key:
- ;SetKeyDelay -1 ; Avoid delays between keystrokes.
- ;if KeyToHoldDownPrev ; There is a previous key to release.
- ;{
- ; Send, {%KeyToHoldDownPrev% up} ; Release it.
- ; CurrentState = 0
- ;}
- ;
- ;if KeyToHoldDown ; There is a key to press down.
- ;{
- ; Send, {%KeyToHoldDown% down} ; Press it down.
- ; CurrentState = 1
- ;}
- return
- Joy4::
- moveData =
- moveData2 =
- if CurrentState > 0
- {
- if CurrentState & 1 > 0
- {
- moveData = %moveData%{%Move1% down}
- moveData2 = %moveData2%{%Move1% up}
- Send {%Move1% up}
- }
- if CurrentState & 2 > 0
- {
- moveData = %moveData%{%Move2% down}
- moveData2 = %moveData2%{%Move2% up}
- Send {%Move2% up}
- }
- sleep 10
- }
- Send {shift}
- sleep 10
- Send %moveData%{x}%moveData2%
- if CurrentState > 0
- {
- if CurrentState & 1 > 0
- {
- Send {%Move1% down}
- }
- if CurrentState & 2 > 0
- {
- Send {%Move2% down}
- }
- }
- Joy1:: Send {space}
- Joy2:: Send {x}
- Joy3:: Send {c}
- Joy5:: Send {v}
- Joy6:: Send {v}
- Joy10:: ;stick rechts
- Send {shift}
- sleep 100
- Send {up down}{x}{up up}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement