-
Notifications
You must be signed in to change notification settings - Fork 1
/
norecoil.ahk
247 lines (202 loc) · 4.73 KB
/
norecoil.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#NoEnv
#SingleInstance force
#maxthreadsperhotkey 5
#InstallKeybdHook
#InstallMouseHook
SendMode Input
SetKeyDelay, 0
SetMouseDelay, 0
;SetWorkingDir %A_ScriptDir%
;ScriptName := A_ScriptName
;StringReplace, ScriptName, ScriptName, .ahk,, All
;StringReplace, ScriptName, ScriptName, .exe,, All
;-------------------------------------------------------------------------------
; Vars
;-------------------------------------------------------------------------------
rpm = 5
NoRecoil = 1
enough = 1
period = 0
;xhair = 0
PixelUp = pgup
PixelDown = pgdn
PixelLeft = del
PixelRight = end
ToggleNoRecoil = Numpad2
DelayUp = Numpad8
DelayDown = Numpad7
PeriodUp =
PeriodDown =
LargeRecoilPreset = Numpad0
SmallRecoilPreset = Numpad1
MoveY = LButton
;-------------------------------------------------------------------------------
; Hotkeys
;-------------------------------------------------------------------------------
Hotkey, ~*$%PixelLeft%, DoPixelLeft
Hotkey, ~*$%PixelRight%, DoPixelRight
Hotkey, ~*$%PixelUp%, DoPixelUp
Hotkey, ~*$%PixelDown%, DoPixelDown
HotKey, ~*$%ToggleNoRecoil%, DoToggleNoRecoil
HotKey, ~*$%DelayUp%, DoDelayUp
HotKey, ~*$%DelayDown%, DoDelayDown
HotKey, ~*$%PeriodUp%, DoPeriodUp
HotKey, ~*$%PeriodDown%, DoPeriodDown
HotKey, ~*$%LargeRecoilPreset%, GetFromINI
HotKey, ~*$%SmallRecoilPreset%, SaveToINI
HotKey, ~*$%MoveY%, DoMoveY
;-------------------------------------------------------------------------------
; Functions
;-------------------------------------------------------------------------------
TipRPS(PopupText)
{
Gui, Destroy
Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
Gui, Color, 000000
WinSet, Transparent, 100
Gui, Font, s8, norm, Verdana
Gui, Add, Text, x5 y5 c00ff00, %PopupText%
Gui, Show, NoActivate X0 Y36
}
TipOn(PopupText)
{
Gui, Destroy
Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
Gui, Color, 000000
WinSet, Transparent, 100
Gui, Font, s8, norm, Verdana
Gui, Add, Text, x5 y5 c00ff00, %PopupText%
Gui, Show, NoActivate X0 Y18
}
TipOff(PopupText)
{
Gui, Destroy
Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
Gui, Color, 000000
WinSet, Transparent, 100
Gui, Font, s8, norm, Verdana
Gui, Add, Text, x5 y5 cff0000, %PopupText%
Gui, Show, NoActivate X0 Y54
}
;-------------------------------------------------------------------------------
; Hotkey labels
;-------------------------------------------------------------------------------
TipClear:
loop
{
Gui, Destroy
sleep 5000
}
return
DoToggleNoRecoil:
if NoRecoil < 1
{
NoRecoil += 1
if NoRecoil = 1
{
SoundBeep, 800, 200
TipOn("ON")
}
}
else
{
NoRecoil := 0
SoundBeep, 200, 100
SoundBeep, 200, 100
TipOff("OFF")
}
return
DoPixelLeft:
if pixelx < 1000
pixelx += 1
TipOn("Pixel X Is " pixelX)
return
DoPixelRight:
if pixelx > -1000
pixelx -= 1
TipOn("Pixel X Is " pixelX)
return
DoPixelUp:
if pixely < 1000
pixely += 1
TipOn("Pixel Y Is " pixelY)
return
DoPixelDown:
if pixely > -1000
pixely -= 1
TipOn("Pixel Y Is " pixelY)
return
DoDelayUp:
if rpm > 100
rpm -= 1
TipRPS("RPM: " rpm " " "RPS:" f(rpm))
return
DoDelayDown:
if rpm < 100
rpm += 1
TipRPS("RPM: " rpm " " "RPS:" f(rpm) )
return
DoPeriodUp:
if period > 100
period -= 100
TipOn("PERIOD IS " period)
return
DoPeriodDown:
if period < 6000
period += 100
TipOn("PERIOD IS " period)
return
GetFromINI:
{
InputBox, WeaponCall, WeaponCall, , Show, 200, 100
if ErrorLevel
return
else
IniRead,pixely,%A_WorkingDir%\config.ini,%WeaponCall%,Y
IniRead,pixelx,%A_WorkingDir%\config.ini,%WeaponCall%,X
IniRead,rpm,%A_WorkingDir%\config.ini,%WeaponCall%,rpm
TipRPS(" Loaded!! Weapon : " WeaponCall " " "Y : "pixely " " "X : "pixelx " " "RPM : " rpm)
}
sleep 0
Gui, destroy
return
;put in name of weapon before write to INI, every preset can be saved seperate.
SaveToINI:
{
InputBox, WeaponSend, WeaponSend, , Show, 200, 100,
if ErrorLevel
return
else
IniWrite,%pixely%,%A_WorkingDir%\config.ini,%WeaponSend%,Y
IniWrite,%pixelx%,%A_WorkingDir%\config.ini,%WeaponSend%,X
IniWrite,%rpm%,%A_WorkingDir%\config.ini,%WeaponSend%,rpm
TipRPS(" Saved!! Weapon :" WeaponSend " " "Y :" pixely " " "X : " pixelx " " "RPM :" rpm)
}
sleep 0
Gui, Destroy
return
DoMoveY:
if NoRecoil = 1
{
xhair = 0
enough = 0
GetKeyState, state, LButton, P
if state = U
return
sleep % f(rpm)
loop
{
GetKeyState, state2, LButton, P
if state2 = U
break
if enough = 1
break
DllCall("mouse_event", uint, 1, int, pixelx, int, pixely, uint, 0, int, 0)
f(n)
{
return Round(100/n/1)
}
sleep % f(rpm)
}
}
return