-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCanineMacro.ahk
More file actions
275 lines (253 loc) · 6.82 KB
/
CanineMacro.ahk
File metadata and controls
275 lines (253 loc) · 6.82 KB
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
; Set some settings we need
#Requires AutoHotkey v2.0
#SingleInstance Force
CoordMode "Mouse", "Window"
CoordMode "Pixel", "Window"
SetMouseDelay 10
#Include "%A_ScriptDir%\Utils"
#Include "Movement.ahk"
#Include "Hotkeys.ahk"
#Include "CordsManager.ahk"
#Include "OCR.ahk"
#Include "Pin.ahk"
#Include "ScanScreen.ahk"
; Setup some globals
global BEST_AREA := "Aether Colosseum"
global POTIONS := ["Coins Potion", "Diamonds Potion", "Damage Potion", "Lucky Eggs Potion", "Treasure Hunter Potion"]
global disconnects := 0
global loops := 0
; Set the icon
iconFile := A_WorkingDir . "\Utils\wolf.ico"
TraySetIcon iconFile
F8:: {
MsgBox("Disconnects: " disconnects "`nLoops: " loops, "CanineMacro Results")
Sleep 10000
ExitApp
}
F5:: {
global loops
setup() ; Run setup for cords loading
; The main loop
Loop {
checkStatus()
selectRoblox()
eatFruit()
usePotions()
;claimGifts() - broken, will fix
teleportToBest()
moveToCenter()
clickAutoFarm() ; Turn on
placeFlag()
placeSprinkler()
useAbility()
useItems()
moveToEgg()
hatch()
moveAwayFromEgg()
clickAutoFarm() ; Turn off
teleportToVoid()
loops:= loops + 1
}
}
; Make sure we did not disconnect
checkStatus() {
global disconnects
ToolTip "Checking status"
disconnected := checkRobloxDisconnect("Disconnected|Reconnect|Leave")
if (disconnected) {
disconnects:= disconnects + 1
ToolTip "Disconnected, restarting"
Run "roblox://placeID=8737899170"
Sleep 95000
}
}
; Start auto hatching eggs
hatch() {
ToolTip "Hatching eggs"
; Make sure our toggles are set
clickSpot(CORDS["Game"]["AutoHatch"], 300)
clickSpot(CORDS["Game"]["AutoHatchOn"], 300)
clickSpot(CORDS["Game"]["ChargedOn"], 300)
clickSpot(CORDS["MessageBox"]["Close"], 150)
; Hatch for 15 minutes, each minute restarting the hatch
Loop 5 {
; Open the hatch menu
Send "{e}"
Sleep 300
; Start hatching
clickSpot(CORDS["Game"]["StartHatch"], 300)
Sleep 60000
}
}
; Use potions from inventory
usePotions() {
Send(INVENTORY)
Sleep 200
clickSpot(CORDS["Inventory"]["Potions"], 300)
for value in POTIONS {
clickSpot(CORDS["Inventory"]["Search"], 300)
Send(value)
Sleep 400
clickSpot(CORDS["Inventory"]["Use"], 300)
}
Sleep 500
Send(INVENTORY)
Sleep 1000
}
; Place flags
placeFlag() {
ToolTip "Placing flags"
Loop 50 {
Send "{" MAGNET_FLAG " down}"
Sleep 150
Send "{" MAGNET_FLAG " up}"
Sleep 400
cannotPlace := checkMessageBox("flag|place|different")
if (cannotPlace) {
clickSpot(CORDS["MessageBox"]["Accept"], 150)
Sleep 1000
break
}
}
Sleep 1000
}
placeSprinkler() {
ToolTip "Placing sprinkers"
Loop 50 {
Send "{" SPRINKLER " down}"
Sleep 150
Send "{" SPRINKLER " up}"
Sleep 400
cannotPlace := checkMessageBox("place|sprinklers")
if (cannotPlace) {
clickSpot(CORDS["MessageBox"]["Accept"], 150)
Sleep 1000
break
}
}
Sleep 1000
}
; Use items for rank
useItems() {
ToolTip "Spawning comet"
Send(COMET)
Sleep 150
clickSpot(CORDS["MessageBox"]["Accept"], 300)
Sleep 15000 ; Give Comet 15 seconds to break
ToolTip "Spawning lucky block"
Send(LUCKY_BLOCK)
Sleep 150
clickSpot(CORDS["MessageBox"]["Accept"], 300)
Sleep 15000 ; Give Lucky Block 15 seconds to break
ToolTip "Spawning coin jar"
Send(COIN_JAR)
Sleep 150
clickSpot(CORDS["MessageBox"]["Accept"], 300)
Sleep 15000 ; Give Coin Jar 15 seconds to break
ToolTip "Spawning Pinata"
Send(PINATA)
Sleep 150
clickSpot(CORDS["MessageBox"]["Accept"], 300)
Sleep 10000 ; Give Pinata 7 seconds to break
; Force a dialog close at the end just in case
clickSpot(CORDS["MessageBox"]["Accept"], 300)
}
; Toggle AutoFarm
clickAutoFarm() {
ToolTip "Toggling autofarm"
clickSpot(CORDS["Game"]["AutoFarm"], 1000)
}
; Teleport to the best area
teleportToBest() {
ToolTip "Teleporting to best"
clickSpot(CORDS["Game"]["TeleportButton"], 1000)
clickSpot(CORDS["Game"]["BestArea"], 10000)
}
; Teleport to the void
teleportToVoid() {
ToolTip "Teleporting to void"
clickSpot(CORDS["Game"]["TeleportButton"], 1000)
clickSpot(CORDS["Game"]["TeleportVoid"], 10000)
}
; Use ability
useAbility() {
ToolTip "Using ultimate"
Send(ABILITY)
Sleep 500
}
; Eat all fruits
eatFruit() {
Loop 5 {
ToolTip "Eating fruit"
Send(BANANA)
clickSpot(CORDS["MessageBox"]["Close"], 500)
Send(PINEAPPLE)
clickSpot(CORDS["MessageBox"]["Close"], 500)
Send(MELON)
clickSpot(CORDS["MessageBox"]["Close"], 500)
Send(APPLE)
clickSpot(CORDS["MessageBox"]["Close"], 500)
Send(ORANGE)
clickSpot(CORDS["MessageBox"]["Close"], 500)
Send(RAINBOW_FRUIT)
clickSpot(CORDS["MessageBox"]["Close"], 500)
Sleep 2000
}
}
; Claim the free gifts
; THIS IS BROKEN CURRENTLY, WILL FIX
claimGifts() {
ToolTip "Claiming gifts"
clickSpot(CORDS["Game"]["FreeGifts"], 300)
xPos := CORDS["Game"]["FreeGiftsStartPos"][1]
yPos := CORDS["Game"]["FreeGiftsStartPos"][2]
Sleep 300
; Loop 3 times, for each row
Loop 3 {
; Loop 4 times to click each present
Loop 4 {
; Click the item in row
clickSpotPos(xPos, yPos, 500)
scanBorder := Pin(1069, 572, 1500, 838, 0, "b3 flash0")
scanResult := OCR.FromRect(1069, 572, 1500, 838)
cannotClaim := RegExMatch(scanResult.Text, "redeem|gift")
scanBorder.Destroy()
if (cannotClaim) {
clickSpot(CORDS["MessageBox"]["Accept"], 300)
clickSpot(CORDS["MessageBox"]["Close"], 300)
Sleep 1000
return
}
; Move to right one spot
xPos += 200
}
; After row is done, move to next one
xPos := CORDS["Game"]["FreeGiftsStartPos"][1]
; Move down one row
yPos += 200
}
; Close the gifts window
clickSpot(CORDS["MessageBox"]["Close"], 3000)
}
; Click by position from CORDS
clickSpot(CORDS, wait) {
SendEvent "{Click, " CORDS[1] ", " CORDS[2] ", 1}"
Sleep wait
}
; Click by x and y positions
clickSpotPos(x, y, wait) {
SendEvent "{Click, " x ", " y ", 1}"
Sleep wait
}
; Make sure Roblox is selected
selectRoblox() {
ToolTip "Selecting Roblox"
try {
WinActivate "ahk_exe RobloxPlayerBeta.exe"
} catch {
ToolTip "Restarting game"
Run "roblox://placeID=8737899170"
Sleep 65000
}
Sleep 4000
}