I need your help. CONTROLLER/GAMEPAD

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Stinjere
Posts: 19
Joined: 28 Nov 2022, 02:00

I need your help. CONTROLLER/GAMEPAD

08 Mar 2023, 16:04

EN: I need your help, how do I combine these 2 scripts in 1 script and that both work without any conflict between them 2.
ES: Necesito su ayuda, como combino estos 2 scripts en 1 script y que ambos funcionen sin ningun conflicto entre ellos 2.


Script 1:

Code: Select all

#Persistent  
SetTimer, WatchPOV, 5
return

WatchPOV:
POV := GetKeyState("JoyPOV")  
KeyToHoldDownPrev := KeyToHoldDown  

if (POV < 0)   
    KeyToHoldDown := ""
else if (POV > 31500)               
    KeyToHoldDown := "Up"
else if POV between 0 and 4500      
    KeyToHoldDown := "Up"
else if POV between 4501 and 13500  
    KeyToHoldDown := "Right"
else if POV between 13501 and 22500 
    KeyToHoldDown := "Down"
else                                
    KeyToHoldDown := "Left"

if (KeyToHoldDown = KeyToHoldDownPrev)  
    return  

if KeyToHoldDownPrev   
    Send, {%KeyToHoldDownPrev% up}  
if KeyToHoldDown   
    Send, {%KeyToHoldDown% down}  
return
Scripy 2:

Code: Select all

#Persistent  
SetTimer, WatchAxis, 5
return

WatchAxis:
JoyX := GetKeyState("JoyX")  
JoyY := GetKeyState("JoyY")  
KeyToHoldDownPrev := KeyToHoldDown  

if (JoyX > 70)
    KeyToHoldDown := "Right"
else if (JoyX < 30)
    KeyToHoldDown := "Left"
else if (JoyY > 70)
    KeyToHoldDown := "Down"
else if (JoyY < 30)
    KeyToHoldDown := "Up"
else
    KeyToHoldDown := ""

if (KeyToHoldDown = KeyToHoldDownPrev)  
    return  

SetKeyDelay -1  
if KeyToHoldDownPrev   
    Send, {%KeyToHoldDownPrev% up}  
if KeyToHoldDown   
    Send, {%KeyToHoldDown% down}  
return
EN: I don't know how combine them, I tried everything but I only got 1 of the 2 to work. I never got both to work. thank you so much.
ES: No se como combinarlos, probé de todo pero solo conseguí que funcionara 1 de los 2. Nunca conseguí que ambos funcionaran. muchas gracias.
Last edited by gregster on 08 Mar 2023, 16:27, edited 1 time in total.
Reason: Topic moved from AHK v2 'Scripts and Functions'. Please use the appropriate forums for help requests and AHK versions.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: SmithyZoomZoom and 157 guests