This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
utility.ahk
673 lines (588 loc) · 10.8 KB
/
utility.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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
#NoEnv
#SingleInstance force
SendMode Input
SetNumlockState, AlwaysOn
SetCapsLockState, Off
SetWorkingDir %A_ScriptDir%
#IfWinActive Dota 2
SetTitleMatchMode, 2
DetectHiddenWindows, On
;var
timerPaused = 0
workStatus = 1
runStatus = 0
displayX = 1366
displayY = 768
;icon
I_Default = icons/dota2.png
IfExist, %I_Icon%
Menu, Tray, Icon, %I_Icon%
IfNotExist, %I_Icon%
Menu, Tray, Icon, %I_Default%
;Config
;------------------------------
global directional_move = "h"
global move_to = "m"
global attack = "a"
global stop = "s"
global selectHero = "1"
global selectAll = "2"
global lastActions = "l"
;Item
global item1 = "WheelUp"
global item2 = "WheelDown"
global item3 = "g"
global item4 = "c"
global item5 = "v"
global item6 = "t"
;camera
global camera_9 = "Numpad7"
global camera_10 = "Numpad8"
;teleport
global tp = "3"
;Ability
global ability1 = "q"
global ability2 = "w"
global ability3 = "e"
global ability4 = "d"
global ability5 = "f"
global ability6 = "r"
;courier
global pickCourier = "4"
global deliveItem = "x"
global openShop = "b"
global courierAbility1 = "q"
global courierAbility2 = "w"
global courierAbility3 = "e"
global courierAbility4 = "d"
global courierAbility5 = "f"
global courierAbility6 = "r"
; kill another script
CloseScript(Name)
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
IfWinExist, i)%Name%.* ahk_class AutoHotkey
{
WinClose
WinWaitClose, i)%Name%.* ahk_class AutoHotkey, , 2
If ErrorLevel
return "Unable to close " . Name
else
return "Closed " . Name
}
else
return Name . " not found"
}
F7::
imageLoad()
run timer.ahk
return
space & F7::
CloseScript("timer.ahk")
return
F6::
imageLoad()
return
PgUp::
gosub timerToggle
return
imageLoad()
{
iX1 = 700
iY1 = 700
iX2 = 1200
iY2 = 800
imageToSearch = %A_ScriptDir%/bmp/backpack.bmp
ImageSearch, findX, findY, %iX1%, %iY1%, %iX2%, %iY2%, %imageToSearch%
global slot4x := findX + 26
global slot4y := findY - 16
global slot1x := slot4x
global slot1y := slot4y - 35
global slot2x := slot1x + 45
global slot2y := slot1y
global slot3x := slot2x + 45
global slot3y := slot2y
global slot5x := slot4x + 45
global slot5y := slot4y
global slot6x := slot5x + 45
global slot6y := slot5y
; backpack
global slot7x := slot4x
global slot7y := findY + 14
global slot8x := slot7x + 45
global slot8y := slot7y
global slot9x := slot8x + 45
global slot9y := slot7y
return
}
;Delay
delay()
{
Sleep, 50
}
{
Sleep, 100
}
delayT(delayTime)
{
Sleep, %delayTime%
}
;Direct
direct()
{
Send, {%directional_move% Down}{Click, R}{%directional_move% Up}
}
backWingBroke(){
Send, %move_to%
sleep, 10
MouseClick, left
Send, %stop%
}
directedAbility(i)
{
direct()
sleep, 50
ability(i)
}
directedItem(i)
{
direct()
sleep, 50
item(i)
}
;Press Item
item(i)
{
delay()
if i = 1
Send, {%item1%}
else if i = 2
Send, {%item2%}
else if i = 3
Send, {%item3%}
else if i = 4
Send, {%item4%}
else if i = 5
Send, {%item5%}
else if i = 6
Send, {%item6%}
}
altItem(i)
{
delay()
Send, {Alt down}
delay()
if i = 1
Send, {%item1%}
else if i = 2
Send, {%item2%}
else if i = 3
Send, {%item3%}
else if i = 4
Send, {%item4%}
else if i = 5
Send, {%item5%}
else if i = 6
Send, {%item6%}
delay()
Send, {Alt up}
}
ability(i)
{
delay()
if i = 1
Send, {%ability1%}
else if i = 2
Send, {%ability2%}
else if i = 3
Send, {%ability3%}
else if i = 4
Send, {%ability4%}
else if i = 5
Send, {%ability5%}
else if i = 6
Send, {%ability6%}
}
altAbility(i)
{
Send, {Alt down}
delay()
if i = 1
Send, {%ability1%}
else if i = 2
Send, {%ability2%}
else if i = 3
Send, {%ability3%}
else if i = 4
Send, {%ability4%}
else if i = 5
Send, {%ability5%}
else if i = 6
Send, {%ability6%}
delay()
Send, {Alt up}
}
tpBase()
{
Send, {Alt down}
delay()
Send, {%tp%}
delay()
Send, {Alt up}
}
repeater(key, host)
{
Loop
{
Send, {%key%}
sleep 10
If (!GetKeyState(host,"p"))
break
}
}
drag(x1,y1,x2,y2)
{
;Sleep,200
SendEvent {Click %x1%, %y1%, down}{click %x2%, %y2%, up}
}
dragr(x2,y2,x1,y1)
{
;Sleep,200
SendEvent {Click %x1%, %y1%, down}{click %x2%, %y2%, up} ; reversed
}
space & 3:: tpBase()
alt & MButton::
Send, %selectHero%
delay()
Send, %selectHero%
drag(slot1x, slot1y, displayX/2 -20, displayY/2 -30)
drag(slot2x, slot2y, displayX/2 -20, displayY/2 -20)
drag(slot3x, slot3y, displayX/2 -20 , displayY/2 -15)
drag(slot4x, slot4y, displayX/2 +20, displayY/2 -30)
drag(slot5x, slot5y, displayX/2 +20, displayY/2 -20)
drag(slot6x, slot6y, displayX/2 +20, displayY/2 -15)
sleep, 3000
Send, %selectHero%
delay()
Send, %selectHero%
delay()
mouseMove, displayX/2 -20, displayY/2 -30
Send, {RButton}
mouseMove, displayX/2 -20, displayY/2 -20
Send, {RButton}
mouseMove, displayX/2 -20 , displayY/2 -15
Send, {RButton}
mouseMove, displayX/2 +20, displayY/2 -30
Send, {RButton}
mouseMove, displayX/2 +20, displayY/2 -20
Send, {RButton}
mouseMove, displayX/2 +20, displayY/2 -15
mouseMove, displayX/2 +20, displayY/2 -15
Send, {RButton}
return
space & MButton::
Send, %selectHero%
delay()
Send, %selectHero%
delay()
drag(slot1x, slot1y, slot7x, slot7y)
delay()
drag(slot2x, slot2y, slot8x, slot8y)
delay()
drag(slot3x, slot3y, slot9x, slot9y)
delay()
dragr(slot1x, slot1y, slot7x, slot7y)
delay()
dragr(slot2x, slot2y, slot8x, slot8y)
delay()
dragr(slot3x, slot3y, slot9x, slot9y)
delay()
drag(slot4x, slot4y, slot7x, slot7y)
delay()
drag(slot5x, slot5y, slot8x, slot8y)
delay()
drag(slot6x, slot6y, slot9x, slot9y)
delay()
dragr(slot4x, slot4y, slot7x, slot7y)
delay()
dragr(slot5x, slot5y, slot8x, slot8y)
delay()
dragr(slot6x, slot6y, slot9x, slot9y)
delay()
return
; express gem delivery
; use ONLY when courier on base and you have 1200 gold
; need buy hotkeys!!
Numpad7::
; buy iron branch
sleep 25
sendPlay {%openShop%}
loop 6
{
sleep 25
sendPlay w1
}
sleep 25
sendPlay {%deliveItem%}
sendPlay r- ; gem
sendPlay {%openShop%}
sleep 3000
sendPlay {%deliveItem%}
sleep 30
sendPlay {%pickCourier%}
sleep 25
sendPlay {%courierAbility3%}
sleep 25
sendPlay {%selectHero%}
return
; Right click spammer (10ms delay)
$LWin::
repeater("RButton","LWin")
return
; Switcher
space & Numpad0::
if runStatus
runStatus = 0
else
runStatus = 1
return
:*:kun::
if runStatus
{
loadedScript = kunka.ahk
Run %loadedScript%
runStatus = 0
loadText = Kunka will be loaded beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:sf::
if runStatus
{
loadedScript = sf.ahk
Run %loadedScript%
runStatus = 0
loadText = Shadow Field will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:sky::
if runStatus
{
loadedScript = sky.ahk
Run %loadedScript%
runStatus = 0
loadText = Sky will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:magn::
if runStatus
{
loadedScript = magnus.ahk
Run %loadedScript%
runStatus = 0
loadText = Magnus will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:lega::
if runStatus
{
loadedScript = legion.ahk
Run %loadedScript%
runStatus = 0
loadText = Legion will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:mars::
if runStatus
{
loadedScript = mars.ahk
Run %loadedScript%
runStatus = 0
loadText = Mars will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:wr::
if runStatus
{
loadedScript = windranger.ahk
Run %loadedScript%
runStatus = 0
loadText = Windranger will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:es::
if runStatus
{
loadedScript = earthsoirit.ahk
Run %loadedScript%
runStatus = 0
loadText = Earthspirit will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:cm::
if runStatus
{
loadedScript = cm.ahk
Run %loadedScript%
runStatus = 0
loadText = Cristal Maiden will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:axe::
if runStatus
{
loadedScript = axe.ahk
runStatus = 0
loadText = Axe will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:io::
if runStatus
{
loadedScript = io.ahk
runStatus = 0
loadText = Io will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:sand::
if runStatus
{
loadedScript = sand.ahk
runStatus = 0
loadText = Sand King will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:ta::
if runStatus
{
loadedScript = templar.ahk
runStatus = 0
loadText = Templar Assassin will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:inv::
if runStatus
{
loadedScript = invoker.ahk
runStatus = 0
loadText = Shitty Wizard will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
:*:br::
if runStatus
{
loadedScript = bristleback.ahk
runStatus = 0
loadText = Bristleback will be loaded after beep
displayText(loadText)
sleep, 2000
SoundBeep, 200, 200
ExitApp
}
return
;Display Text
displayText(textToDisplay)
{
#Persistent
ToolTip, %textToDisplay%
}
; Pause / Unpause Script
Numpad0::
suspend
if workStatus
{
SoundBeep, 444, 100
sleep, 80
SoundBeep, 555, 90
sleep, 80
SoundBeep, 333, 80
sleep, 80
workStatus = 0
}
else
{
SoundBeep, 640, 120
sleep, 55
SoundBeep, 400, 80
workStatus = 1
}
return
timerToggle:
PostMessage, 0x111, 65306,,, timer.ahk ahk_class AutoHotkey ; Pause, Toggle
if timerPaused
{
SoundBeep, 700, 120
sleep, 100
SoundBeep, 700, 180
timerPaused = 0
}
else
{
SoundBeep, 700, 120
sleep, 200
SoundBeep, 500, 120
sleep, 200
SoundBeep, 400, 120
timerPaused = 1
}
return
LAlt & Numpad0::
Reload
return
; start there