forked from ialsaud/PianoTilesAutoit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiano-tiles7.au3
104 lines (73 loc) · 1.79 KB
/
piano-tiles7.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
98
99
100
101
102
103
104
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.2
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#include "AutoItConstants.au3"
; Script Start - Add your code below here
HotKeySet("{ESC}", "Terminate")
HotKeySet("!a", "musicLoop")
HotKeySet("!s", "setupButtons")
Global $point
MsgBox(0, "Starting Up", "Starting, first set up color locations.")
Func Terminate()
Exit 1
EndFunc
Func setupButtons()
MsgBox(0, "Setup", "Setup button A location.")
$point = MouseGetPos()
EndFunc
Func musicLoop()
MsgBox(0, "Music Loop", "Playing piano music")
$i = 0
$j = 0
$wait = 150
While 1
; find black button.
if PixelGetColor($point[0], $point[1]) == 1118481 then
; button A
send("a")
ConsoleWrite ("a")
$i = $i + 1
ElseIf PixelGetColor($point[0]+100, $point[1]) == 1118481 then
; button S
send("s")
ConsoleWrite ("s")
$i = $i + 1
ElseIf PixelGetColor($point[0]+200, $point[1]) == 1118481 then
; button D
send("d")
ConsoleWrite ("d")
$i = $i + 1
ElseIf PixelGetColor($point[0]+300, $point[1]) == 1118481 then
; button F
send("f")
ConsoleWrite ("f")
$i = $i + 1
EndIf
; delay increment
if ($i = 9) then
if ( $wait > 0 ) then
$wait = $wait - 2
Else
$wait = 1
EndIf
ConsoleWrite ('\n')
ConsoleWrite ($wait)
$i = 0
EndIf
; delay
sleep($wait)
if PixelGetColor($point[0]+300, $point[1]) == 0xFB3E38 then
; Reset
$i = 0
$j = 0
$wait = 150
MouseClick($MOUSE_CLICK_LEFT)
EndIf
WEnd
EndFunc
While 1
sleep(250)
WEnd