Search the Community
Showing results for tags 'nesting'.
-
Okay so here's the problem. I have a script I'm testing out where I want it to search for a certain color and if it finds that certain color I want it to check for a second color. I only want it to check for the second color after checking for the first color. If it finds the first color it will check for the second color and whether or not that second color is present it will cause certain actions to be undertaken. Well at least that's what I want it to do. I want this all to be done in a loop where it's constantly checking for the first color. However, once it does find the first color and it executes one of the actions regarding the second, I want the program to quit. I'm having trouble figuring out how to nest conditional statements here. If anyone could help me out it would be much appreciated. HotKeySet("{ESC}", "Terminate") HotKeySet("!c", "getColor") HotKeySet("!l", "ClickPositions") Global $color Global $interval $interval = "10000" MsgBox (0, "Starting Up", "Starting, use ESC to quit, Alt + C to get color, and Alt + L to begin Test") Func Terminate() Exit 1 EndFunc Func ClickPositions() MsgBox(0, "Beginning Test", "Hope to god this works") While 1 $Coords = PixelSearch(1006, 48, 1074, 79, 0xECECEC) $1stcoords = PixelSearch(930, 621, 1066, 649, 0x8A211E) $point = MouseGetPos() $posx = Random(930, 1066) $posy = Random(621, 649) $clicklogx = Random(1076, 1093) $clicklogy = Random(38, 54) If IsArray($Coords) Then ;check to see if the first color is there If IsArray($1stcoords) Then ;if it is check for the second color and if that one is there: MouseClick( "left", $point[0], $point[1], 1) If IsArray(<>$1stcoords) Then ;if the second color is not there: MouseClick("left", $clicklogx, $clicklogy, 1, Random(1000, 2500)) Sleep(3000) MouseClick( "left" , $posx, $posy, 1, Random ( 1000 , 2500)) EndIf EndIf EndIf Sleep(2000) WEnd EndFunc While 1 Sleep(250) WEnd