forked from mxsuifeng/d2r-multijoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultijoin 1080p.ahk
105 lines (101 loc) · 2.05 KB
/
multijoin 1080p.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
;设置按键和鼠标点击的随机延时
ClickDelay()
{
return Random(175,200)
}
;设置退出游戏的随机延时
QuitDelay()
{
return Random(200,300)
}
;设置创建游戏的随机延时,不用对话框的时候用这个设置delay
CreateDelay()
{
return Random(1500,2000)
}
;设置加入游戏的随机延时
JoinDelay()
{
return Random(200,300)
}
;设置切换窗口的随机延时
SwitchDelay()
{
return Random(200,300)
}
;设置游戏末位更新,取各位数字
GetNumber(x)
{
x++
return SubStr(String(x), -1)
}
;创建游戏,需要有原来游戏设置,并且末位更新,0-9循环
CreateGame(num)
{
Click Random(1400,1550),Random(170,180) ;1920*1080 建游戏名称输入框的坐标范围
Sleep ClickDelay()
Send "{Backspace}"
Sleep ClickDelay()
Send num
Sleep ClickDelay()
Click Random(1420,1525),Random(655,680) ;1920*1080 创建游戏按钮的坐标范围
}
;加入游戏
JoinGame(num)
{
Click Random(1300,1430),Random(145,155) ;1920*1080 加入游戏名称输入框的坐标范围
Sleep ClickDelay()
Send "{Backspace}"
Sleep ClickDelay()
Send num
Sleep ClickDelay()
Click Random(1425,1510),Random(660,685) ;1920*1080加入游戏按钮的坐标范围
}
;退出游戏
ExitGame()
{
Send "{Esc}"
Sleep QuitDelay()
Click Random(900,1010),Random(460,485) ;1920*1080储存并离开游戏按钮的鼠标点击范围
}
#HotIf WinActive("ahk_exe D2R.exe") ;热键仅对D2R游戏窗口生效
global count
count := 0
;F1一键加游戏
F1::
{
global count
gamenumber :=GetNumber(count)
main_id := WinActive("ahk_exe D2R.exe")
other_ids := WinGetList("ahk_exe D2R.exe")
CreateGame(gamenumber)
result := MsgBox(("Game ready now?"),,4 )
if (result = "Yes")
{
for this_id in other_ids
{
if (this_id = main_id)
continue
WinActivate this_id
Sleep SwitchDelay()
ExitGame()
Sleep QuitDelay()
}
for this_id in other_ids
{
if (this_id = main_id)
continue
WinActivate this_id
Sleep SwitchDelay()
JoinGame(gamenumber)
Sleep JoinDelay()
}
}
WinActivate main_id
count++
}
;F4退游戏
F4::
{
ExitGame()
}