-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathjoyfocus.ahk
77 lines (72 loc) · 1.8 KB
/
joyfocus.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
; joyfocus 1.1 LazyTech
; A public domain work under the UnLicense. See LICENSE for details.
#Persistent
SetTimer, WatchAxis, 100 ; milliseconds
return
; If this doesn't work with your stick/throttle/gamepad/edtracker, use
; the joylist.ahk script to find out what numbers AHK thinks your devices
; are on.
; Please check the README at https://github.com/RetroRodent/joyfocus before using.
; To change any of these checks, insert your detected device number from joylist.ahk
; This would monitor Yaw on device 2 and Throttle on device 5
; GetKeyState, JoyX, 2JoyX
; GetKeyState, JoyZ, 5JoyZ
WatchAxis:
GetKeyState, JoyX, JoyX ; Get position of stick Roll.
GetKeyState, JoyY, JoyY ; Get position of stick Pitch.
GetKeyState, JoyZ, JoyZ ; Get position of Throttle.
RollWatcherPrev := RollWatcher
PitchWatcherPrev := PitchWatcher
ThrottleWatcherPrev := ThrottleWatcher
JoyXf := Floor(JoyX)
JoyYf := Floor(JoyY)
JoyZf := Floor(JoyZ)
if (JoyXf - RollWatcherPrev > 10 || JoyXf - RollWatcherPrev < -10) or (JoyYf - PitchWatcherPrev > 10 || JoyYf - PitchWatcherPrev < -10) or (JoyZf - ThrottleWatcherPrev > 10 || JoyZf - ThrottleWatcherPrev < -10)
{
IfWinExist, Elite - Dangerous (CLIENT)
{
RollWatcher := JoyXf
PitchWatcher := JoyYf
ThrottleWatcher := JoyZf
WinActivate
;ToolTip, %RollWatcherPrev% %RollWatcher%`n%PitchWatcherPrev% %PitchWatcher%`n%ThrottleWatcherPrev% %ThrottleWatcher%
return
}
}
else
{
;ToolTip, Same
return
}
; To check buttons on a different device, insert your detected device number from joylist.ahk
; This would monitor button 5 on device 2:
; 2Joy5::
Joy1::
Joy2::
Joy3::
Joy4::
Joy5::
Joy6::
Joy7::
Joy8::
Joy9::
Joy10::
Joy11::
Joy12::
Joy13::
Joy14::
Joy15::
Joy16::
Joy17::
Joy18::
Joy19::
IfWinExist, Elite - Dangerous (CLIENT)
{
WinActivate
; ToolTip, Click
return
}
else
{
return
}