-
Notifications
You must be signed in to change notification settings - Fork 0
/
d2r-reset-macro.ahk
101 lines (87 loc) · 2.09 KB
/
d2r-reset-macro.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
/*
Settings
*/
; Hero positions
; Use Config hotkey (F7 by default) while inside D2R window to get mouse X and Y positions
; Hover the mouse on top of the classes and paste X positions for all classes
Amazon = 404
Assassin = 597
Necromancer = 782
Barbarian = 959
Paladin = 1167
Sorceress = 1380
Druid = 1555
HeroY = 590 ; Y-position can be the same for all classes
; Settings
Name = Helene
Hero := Sorceress
Hardcore := False
Classic := True
DeleteHero := False
; Timers
Delay = 100
LoadingDelay = 500
DeleteDelay = 5025
; Hotkeys
LiveSplit = F4
Hotkey, f7, Config
Hotkey, f8, Load
Hotkey, f9, Reset
Return
/*
Macro
*/
Reset:
Send {%LiveSplit%}
BlockInput, On
If DeleteHero
{
MouseClick, left, 1680, 1050 ; Click on delete icon
MouseMove, 840, 625 ; Move mouse to "Yes"
Send {LButton Down} ; Hold down left mouse
Sleep, %DeleteDelay%
Send {LButton Up} ; Release left mouse
}
MouseClick, left, 1725, 980 ; Click on "Create New"
Sleep, %LoadingDelay%
MouseClick, left, %Hero%, %HeroY% ; Click on the selected Hero
Sleep, %Delay%
If !DeleteHero ; Add random characters to "Name" if DeleteHero is false
{
Loop, 5 {
Letters := "bcdfghjklmnpqrstvwxz"
random, Rand, 1, % strlen(Letters)
randomLetter := strsplit(Letters)
Send, % randomLetter[Rand]
}
Send _%Name%
}
Else
{
Send %Name%
}
If Classic
{
MouseClick, left, 1014, 1005 ; Click on Pre-Expansion (Classic)
}
If Hardcore {
MouseClick, left, 941, 1005 ; Click on Hardcore
MouseClick, left, 1775, 1050 ; Click on "Create"
Sleep, %Delay%
MouseClick, left, 825, 625 ; Click on "OK" to confirm Hardcore
}
Else
{
MouseClick, left, 1775, 1050 ; Click on "Create"
}
Send {F3}
BlockInput Off
Return
Config: ; Show mouse position on hotkey to help with settings
MouseGetPos, xpos, ypos
MsgBox, Cursor X%xpos%, Y%ypos%.
Return
Load: ; Load settings on hotkey
ToolTip Loading...
Sleep, 500
Reload