-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacs.ahk
432 lines (394 loc) · 15.2 KB
/
macs.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
;----------------------------------------------------------------------
; PoE Flasks macros for AutoHotKey
;
; Keys used and monitored:
; Enter - activate automatic flask usage
; right mouse button - primary attack skills
; 1-5 - number keys to manually use a specific flask
; ` (backtick) - use all flasks, now
; "e" and "r" for casting buffs
; Note - the inventory buttons assume a starting location based on screen
; resolution - you'll need to update some locations, see below.
; Alt+c to Ctrl-Click every location in the (I)nventory screen.
; Alt+m - Allow setting stash tab size as normal (12x12) or large (24x24)
; Alt+g - Get the current screen coordinates of the mouse pointer.
; Alt+s - Swap a skill gem with an alternate.
;----------------------------------------------------------------------
#IfWinActive Path of Exile
#SingleInstance force
#NoEnv
#Warn
#Persistent
FlaskDurationInit := []
;----------------------------------------------------------------------
; Set the duration of each flask, in ms, below. For example, if the
; flask in slot 3 has a duration of "Lasts 4.80 Seconds", then use:
; FlaskDurationInit[3] := 4800
;
; To disable a particular flask, set it's duration to 0
;
; Note: Delete the last line (["e"]), or set value to 0, if you don't use a buff skill
;----------------------------------------------------------------------
FlaskDurationInit[1] := 4400
FlaskDurationInit[2] := 7200
FlaskDurationInit[3] := 7200
FlaskDurationInit[4] := 7200
FlaskDurationInit[5] := 7000
FlaskDurationInit["e"] := 0 ; I use Steelskin here
FlaskDurationInit["r"] := 0 ; I use Molten Shell here
FlaskDurationInit[","] := 0 ; Segunda Barra
FlaskDurationInit["x"] := 0 ; Segunda Barra
FlaskDurationInit["."] := 7000 ; Segunda Barra
FlaskDurationInit["{Numpad2}"] := 0 ; Segunda Barra
FlaskDurationInit["{Numpad1}"] := 0 ; Segunda Barra
FlaskDuration := []
FlaskLastUsed := []
UseFlasks := false
HoldRightClick := false
LastRightClick := 0
loopstopper := true ; Initialize loopstopper to 1
loopcontrol := false ; Initialize loopcontrol to 1
;----------------------------------------------------------------------
; The following are used for fast ctrl-click from the Inventory screen
; using alt-c. The coordinates for ix,iy come from MouseGetPos (Alt+g)
; of the top left location in the inventory screen. The delta is the
; pixel change to the next box, either down or right.
;
; To get the correct values for use below, do the following:
; 1. Load the macro into AutoHotKey
; 2. open Inventory screen (I) and place the mouse cursor in the
; middle of the top left inventory box.
; 3. Press Alt+g and note the coordinates displayed by the mouse.
; 4. Replace the coordinates below.
; 5. To get the "delta", do the same for the next inventory box down
; and note the difference
;----------------------------------------------------------------------
ix := 953
iy := 435
delta := 38
;----------------------------------------------------------------------
; The following are used for fast ctrl-click from Stash tabs into the
; inventory screen, using alt-m.
; Stash top left and delta for 12x12 and 24x24 stash are defined here.
; As above, you'll use Alt+g to determine the actual values needed.
;
; To get these values, follow the instructions for the Inventory screen
; except use the stash tab boxes, instead. Note, the first COLUMN is
; for the 12x12 stash and the second COLUMN is for the 24x24 "Quad" stash.
;----------------------------------------------------------------------
StashX := [10, 20]
StashY := [110, 105]
StashD := [38, 19]
StashSize := [12, 24]
;----------------------------------------------------------------------
; The following are used for gem swapping. Useful
; when you use one skill for clearing and another for bossing.
; Put the coordinates of your primary attack skill in PrimX, PrimY
; Put the coordinates of alternate attack skill in AltX, AltY
; WeaponSwap determines if alt gem is in inventory or alternate weapon.
;----------------------------------------------------------------------
PrimX := 2080
PrimY := 334
AltX := 2505
AltY := 820
WeaponSwap := False
;----------------------------------------------------------------------
; Main program loop - basics are that we use flasks whenever flask
; usage is enabled via hotkey (default is F12), and we've attacked
; within the last 0.5 second (or are channeling/continuous attacking.
;----------------------------------------------------------------------
Loop {
if (UseFlasks) {
; have we attacked in the last 0.5 seconds?
if ((A_TickCount - LastRightClick) < 500) {
Gosub, CycleAllFlasksWhenReady
} else {
; We haven't attacked recently, but are we channeling/continuous?
if (HoldRightClick) {
Gosub, CycleAllFlasksWhenReady
}
}
}
}
Enter::
UseFlasks := not UseFlasks
if UseFlasks {
; initialize start of auto-flask use
ToolTip, UseFlasks On
; reset usage timers for all flasks
for i in FlaskDurationInit {
FlaskLastUsed[i] := 0
FlaskDuration[i] := FlaskDurationInit[i]
}
} else {
ToolTip, UseFlasks Off
}
SetTimer, RemoveToolTip, -2000
return
RemoveToolTip:
ToolTip
return
;----------------------------------------------------------------------
; To use a different moust button (default is right click), change the
; "RButton" to:
; RButton - to use the {default} right mouse button
; MButton - to use the {default} middle mouse button (wheel)
; LButton - to use the {default} Left mouse button
;
; Make the change in both places, below (the first is click,
; 2nd is release of button}
;----------------------------------------------------------------------
~w::
; pass-thru and capture when the last attack (Right click) was done
; we also track if the mouse button is being held down for continuous attack(s) and/or channelling skills
HoldRightClick := true
LastRightClick := A_TickCount
return
~w up::
; pass-thru and release the right mouse button
HoldRightClick := false
return
;----------------------------------------------------------------------
; The following 5 hotkeys allow for manual use of flasks while still
; tracking optimal recast times.
;----------------------------------------------------------------------
~1::
; pass-thru and start timer for flask 1
FlaskLastUsed[1] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[1] := FlaskDurationInit[1] + VariableDelay ; randomize duration to simulate human
return
~2::
; pass-thru and start timer for flask 2
FlaskLastUsed[2] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[2] := FlaskDurationInit[2] + VariableDelay ; randomize duration to simulate human
return
~3::
; pass-thru and start timer for flask 3
FlaskLastUsed[3] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[3] := FlaskDurationInit[3] + VariableDelay ; randomize duration to simulate human
return
~4::
; pass-thru and start timer for flask 4
FlaskLastUsed[4] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[4] := FlaskDurationInit[4] + VariableDelay ; randomize duration to simulate human
return
~5::
; pass-thru and start timer for flask 5
FlaskLastUsed[5] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[5] := FlaskDurationInit[5] + VariableDelay ; randomize duration to simulate human
return
~r::
; pass-thru and start timer for flask 5
FlaskLastUsed["r"] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[5] := FlaskDurationInit[5] + VariableDelay ; randomize duration to simulate human
return
~e::
; pass-thru and start timer for flask 5
FlaskLastUsed["e"] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[5] := FlaskDurationInit[5] + VariableDelay ; randomize duration to simulate human
return
;----------------------------------------------------------------------
; Use all flasks, now. A variable delay is included between flasks
; NOTE: this will use all flasks, even those with a FlaskDurationInit of 0
;----------------------------------------------------------------------
[::
if UseFlasks {
Send 1
Random, VariableDelay, -99, 99
Sleep, %VariableDelay%
Send 2
Random, VariableDelay, -99, 99
Sleep, %VariableDelay%
Send 3
Random, VariableDelay, -99, 99
Sleep, %VariableDelay%
Send 4
Random, VariableDelay, -99, 99
Sleep, %VariableDelay%
Send 5
Random, VariableDelay, -99, 99
Sleep, %VariableDelay%
Send e
Random, VariableDelay, -99, 99
Sleep, %VariableDelay%
Send r
}
return
CycleAllFlasksWhenReady:
for flask, duration in FlaskDuration {
; skip flasks with 0 duration and skip flasks that are still active
if ((duration > 0) & (duration < A_TickCount - FlaskLastUsed[flask])) {
Send %flask%
FlaskLastUsed[flask] := A_TickCount
Random, VariableDelay, -99, 99
FlaskDuration[flask] := FlaskDurationInit[flask] + VariableDelay ; randomize duration to simulate human
sleep, %VariableDelay%
}
}
return
;----------------------------------------------------------------------
; Alt+c to Ctrl-Click every location in the (I)nventory screen.
;----------------------------------------------------------------------
;!c::
Numpad7::
Loop, 11 {
col := ix + (A_Index - 1) * delta
Loop, 5 {
row := iy + (A_Index - 1) * delta
Send, ^{ Click, %col%, %row% }
}
}
return
;----------------------------------------------------------------------
; Alt+m - Allow setting stash tab size as normal (12x12) or large (24x24)
;
; vMouseRow := 1 (default) means starting in row 1 of stash tab
; always place mouse pointer in starting box
;
; ItemsToMove := 50 (default) is how many items to move to Inventory
;----------------------------------------------------------------------
!m::
Gui, Add, Radio, vSelStash checked, Norm Stash Tab (12x12)
Gui, Add, Radio, , Quad Stash Tab (24x24)
Gui, Add, Text, , &Clicks:
Gui, Add, Edit, w50
Gui, Add, UpDown, vClicks Range1 - 50, 50
Gui, Add, Text, , Mouse is in &Row:
Gui, Add, Edit, w50
Gui, Add, UpDown, vStartRow Range1 - 24, 1
Gui, Add, Button, default, OK
Gui, Show
return
ButtonOK:
GuiClose:
GuiEscape:
Gui, Submit ; Save each control's contents to its associated variable.
MouseGetPos, x, y ; start from current mouse pos
ClickCt := 0
Loop {
Send ^ { Click, %x%, %y% }
if (++ClickCt > StashSize[SelStash] - StartRow) {
StartRow := 1
x := x + StashD[SelStash]
y := StashY[SelStash]
ClickCt := 0
} else {
y := y + StashD[SelStash]
}
} until (--Clicks <= 0)
Gui, Destroy
return
;----------------------------------------------------------------------
; Alt+g - Get the current screen coordinates of the mouse pointer.
;----------------------------------------------------------------------
!g::
MouseGetPos, x, y
ToolTip, %x% %y%
SetTimer, RemoveToolTip, -5000
return
;----------------------------------------------------------------------
; Alt+s - Swap a skill gem with an alternate. Gems must be same color if alt
; weapon slot is used for holding gems.
;----------------------------------------------------------------------
!s::
MouseGetPos, x, y ; Save the current mouse position
Send i
Sleep 100
Send { Click Right, %PrimX%, %PrimY% }
Sleep 100
if (WeaponSwap) {
Send { x }
Sleep 100
}
Send { Click %AltX%, %AltY% }
Sleep 100
if (WeaponSwap) {
Send { x }
Sleep 100
}
Send { Click %PrimX%, %PrimY% }
Sleep 100
Send i
Sleep 100
MouseMove, x, y
Return
;----------------------------------------------------------------------
; Numpad1 to Ctrl-Click every 100ms.
;----------------------------------------------------------------------
Numpad1::
SetTimer, ClickLoop, 100
KeyWait, Numpad1
SetTimer, ClickLoop, Off
return
ClickLoop:
Send, ^{LButton}
Return
;----------------------------------------------------------------------
; MINE REDUX
;----------------------------------------------------------------------
Numpad6:: ; Deactivate the loop when Numpad6 is pressed
loopcontrol := not loopcontrol
if not loopcontrol {
ToolTip, Mine: Inactive
} else {
ToolTip, Mine: Active
}
SetTimer, RemoveToolTip, -2000
return
SendSpaceLoop:
if loopcontrol && not loopstopper
{
Random, VariableDelay, 0, 30
Sleep, %VariableDelay%
Send, {SPACE}
}
return
SendFinishSpaceLoopTime:
Random, VariableDelay, 0, 30
Sleep, %VariableDelay%
Send, {SPACE}
if (A_TickCount - spaceStartTime >= 2000) ; 2000 milliseconds (2 seconds)
SetTimer, SendFinishSpaceLoopTime, Off
return
~f:: ; Start the loop when F is held down
if loopcontrol {
loopstopper := false
Send, {SPACE}
SetTimer, SendSpaceLoop, 15
}
return
~f up:: ; Stop the loop when F is released
if loopcontrol {
SetTimer, SendSpaceLoop, Off
spaceStartTime := A_TickCount
SetTimer, SendFinishSpaceLoopTime, On
loopstopper := true
}
return
;----------------------------------------------------------------------
; PAUSAR
;----------------------------------------------------------------------
F5:: Suspend
;----------------------------------------------------------------------
; Smoke Mine REDUX
;----------------------------------------------------------------------
;~t::SmokeMine() ;
;SmokeMine(){
;if WinActive("Path of Exile")
; {
; Sleep 200
; Send, {space}
; Sleep 100
; Send, {space}
; Sleep 100
; Send, {space}
; return
; }
;}