I am having trouble with one part of the code, It is made to detect a pixel on the screen that is given a set color. I want it to give 2 scripts (one if it finds the pixel, and another if it doesnt.)
I have "If @error then" and the script, IF it did not find the pixel.
I have "If Not @error Then" and the script, IF it found the pixel.
It just seems to continue the whole script in order, ignoring the "If @error then" & "If Not @error Then"
Plain Text
Global $Runner HotKeySet("{ESC}", "Terminate") HotKeySet("{F1}", "Click") Func Terminate() Exit 0 EndFunc Func Click() PixelSearch(1233, 826, 1386, 852, 0xFFCC00) If @error then MouseClick("left", 716, 698, 10) Sleep (500) Send("{a down}") Sleep (800) Send("{a up}") Sleep (500) MouseClick("left", 716, 698, 10) Sleep (500) Send("{d down}") Sleep (800) Send("{d up}") Sleep (500) MouseClick("left", 716, 698, 10) Sleep (500) EndIf If Not @error Then Sleep (500) MouseClick("left", 863, 697, 3) Sleep (500) MouseClick("left", 701, 750, 3) Sleep (500) MouseClick("left", 863, 697, 3) Sleep (500) MouseClick("left", 701, 750, 3) Sleep (500) MouseClick("left", 1095, 873, 3) Send("{@ 1}") Sleep (100) Send("{c 1}") Sleep (100) Send("{o 1}") Sleep (100) Send("{n 1}") Sleep (100) Send("{f 1}") Sleep (100) Send("{l 1}") Sleep (100) Send("{i 1}") Sleep (100) Send("{c 1}") Sleep (100) Send("{t 1}") Sleep (100) Send("{s 1}") Sleep (100) Send("{o 1}") Sleep (100) Send("{u 1}") Sleep (100) Send("{l 1}") Sleep (100) Send("{Space 1}") Sleep (100) Send("{d 1}") Sleep (100) Send("{Enter 1}") Sleep (500) Send("{@ 1}") Sleep (100) Send("{c 1}") Sleep (100) Send("{o 1}") Sleep (100) Send("{n 1}") Sleep (100) Send("{f 1}") Sleep (100) Send("{l 1}") Sleep (100) Send("{i 1}") Sleep (100) Send("{c 1}") Sleep (100) Send("{t 1}") Sleep (100) Send("{s 1}") Sleep (100) Send("{o 1}") Sleep (100) Send("{u 1}") Sleep (100) Send("{l 1}") Sleep (100) Send("{Space 1}") Sleep (100) Send("{d 1}") Sleep (100) Send("{Enter 1}") Sleep (500) Send("{@ 1}") Sleep (100) Send("{c 1}") Sleep (100) Send("{o 1}") Sleep (100) Send("{n 1}") Sleep (100) Send("{f 1}") Sleep (100) Send("{l 1}") Sleep (100) Send("{i 1}") Sleep (100) Send("{c 1}") Sleep (100) Send("{t 1}") Sleep (100) Send("{s 1}") Sleep (100) Send("{o 1}") Sleep (100) Send("{u 1}") Sleep (100) Send("{l 1}") Sleep (100) Send("{Space 1}") Sleep (100) Send("{d 1}") Sleep (100) Send("{Enter 1}") Sleep (500) EndIf EndFunc While 1 Sleep(100) WEnd