-
Notifications
You must be signed in to change notification settings - Fork 0
/
SnakeBot.au3
97 lines (79 loc) · 1.55 KB
/
SnakeBot.au3
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
Global $locs[3][2]
Global $notFinished = True
;Hard-coding coordinate for bottom left corner
$locs[0][0] = 597
$locs[0][1] = 706
;bottom right (one square to the left)
$locs[1][0] = 1093
$locs[1][1] = 706
;top right corner
$locs[2][0] = 1101
$locs[2][1] = 458
HotKeySet("{PAUSE}", "startLaundry")
Func startLaundry()
Send("{SPACE}")
Sleep(60)
Send("{RIGHT}")
Sleep(1900)
Send("{DOWN}")
Sleep(40)
Send("{LEFT}")
For $i = 0 To 300
For $height = 0 To 30
$direction = Mod($height, 2)
While (PixelGetColor($locs[$direction][0], $locs[$direction][1] - $height * 8) <> 5592456)
Sleep(10)
WEnd
turn($direction)
Sleep(3500)
Next
While (PixelGetColor($locs[2][0], $locs[2][1]) <> 5592456)
Sleep(10)
WEnd
Send("{DOWN}")
Sleep(500)
While (PixelGetColor($locs[2][0], $locs[0][1]) <> 5592456)
Sleep(10)
WEnd
Send("{LEFT}")
Next
$notFinished = False
EndFunc
Func turn($dir)
Send("{UP}")
Sleep(40)
If ($dir = 1) Then
Send("{LEFT}")
Else
Send("{RIGHT}")
EndIf
EndFunc
;~ HotKeySet("a", "addLocation")
;~ Func addLocation()
;~ $loc = MouseGetPos(0)
;~ $loc2 = MouseGetPos(1)
;~ MsgBox(1, "a", $loc &" "& $loc2)
;~ EndFunc
While ($notFinished)
sleep(100)
WEnd
;~ Func startTest()
;~ $x = $locs[0][0]
;~ $y = $locs[0][1]
;~
;~ $tempY = $y
;~
;~ While (PixelGetColor($x, $tempY) = $snakeBlue)
;~ $pixelTotal += 1
;~ $tempY -= 1
;~ WEnd
;~
;~ $tempY = $y + 1
;~
;~ While (PixelGetColor($x, $tempY) = $snakeBlue)
;~ $pixelTotal += 1
;~ $tempY += 1
;~ WEnd
;~
;~ MsgBox(1, "A", $pixelTotal)
;~ EndFunc