-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame_GPL.ahk
91 lines (71 loc) · 2.61 KB
/
Game_GPL.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#Include <_COMMON_SETTINGS_>
Menu, Tray, Icon
;Reload_AsAdmin()
GEM := "ahk_exe GEMP2.exe"
Folder := "GPL ahk_exe explorer.exe"
;IfWinExist, %Folder%
WinClose, %Folder%
IfWinNotExist, %GEM%
Run, "E:\GAMES\GPLSecrets\GEM+\GEMP2.exe", E:\GAMES\GPLSecrets\GEM+
SendMode, Event ; нужен Event режим, т.к. только в этом режиме можно задать задержки для клавиш
SetMouseDelay, 50 ; Sets the delay that will occur after each mouse movement or click.
SetDefaultMouseSpeed, 0 ; Sets the mouse speed that will be used if unspecified in Click and MouseMove/Click/Drag.
SetTitleMatchMode, RegEx
GroupAdd, GPL, ahk_exe i)\\GPL\w{3}\.exe$
JoyNumber = 1
Hotkey, IfWinNotActive, ahk_group GPL
Hotkey, F1, Help
lX := 30 ; left "Red" icon
lY := 473
rX := 610 ; right "Green" icon
rY := lY
SetTimer, WatchPOV, 10
return
;==============================================================================================
;Joystick POV to Keyboard and Mouse
WatchPOV:
if WinActive("ahk_group GPL") {
GetKeyState, POV, %JoyNumber%JoyPOV ; Get position of the POV control.
KeyToSendPrev = %KeyToSend% ; Prev now holds the key that was down before (if any).
; Some joysticks might have a smooth/continuos POV rather than one in fixed increments.
; To support them all, use a range:
if POV < 0 ; No angle to report
KeyToSend =
else if POV > 31500 ; 315 to 360 degrees: Forward
KeyToSend = Up
else if POV between 0 and 4500 ; 0 to 45 degrees: Forward
KeyToSend = Up
else if POV between 4501 and 13500 ; 45 to 135 degrees: Right
KeyToSend = Right
else if POV between 13501 and 22500 ; 135 to 225 degrees: Down
KeyToSend = Down
else ; 225 to 315 degrees: Left
KeyToSend = Left
if KeyToSend = %KeyToSendPrev% ; The correct key is already down (or no key is needed).
return ; Do nothing.
if KeyToSend = Left
Send, {Esc}{Enter} ; back
else if KeyToSend = Right
Click, %rX%, %rY% ; forward
;else if KeyToSend = Up
;Send, ;
else if KeyToSend = Down
Send, +r ; reset car to track
}
return
;==============================================================================================
Help()
{
ShowHelpWindow("
(LTrim
POV Left -> Go back in menu.
POV Right -> Click 'Green' icon in menu.
POV Down -> Reset car to track.
)")
}
;==============================================================================================
#IfWinNotActive, ahk_group GPL
!z:: Reload
!x::
WinClose, %GEM%
ExitApp