Autohotkey (Boost while X/Y axis at max distance)

Autohotkey (Boost while X/Y axis at max distance)

Postby SC-Maik » Sat Apr 11, 2015 10:14 am

Greeting fellow citizens,

I am using autohotkey (http://www.autohotkey.com/) for a lot of macroing.

Here is a sample script so when either X or Y axis is at max distance (0 or 255), it sets Boost on

Code: Select all
#Persistent  ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return

WatchAxis:
GetKeyState, 2JoyX, 2JoyX  ; Get position of X axis.
GetKeyState, 2JoyY, 2JoyY  ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown%  ; Prev now holds the key that was down before (if any).

if 2JoyX = 0
    KeyToHoldDown = LShift
else if 2JoyX = 100
    KeyToHoldDown = LShift
else if 2JoyY = 0
    KeyToHoldDown = LShift
else if 2JoyY = 100
    KeyToHoldDown = LShift
else
    KeyToHoldDown =

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.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return
SC-Maik
 
Posts: 142
Joined: Tue Mar 03, 2015 3:20 pm

Return to Star Citizen

Who is online

Users browsing this forum: No registered users and 0 guests

cron