furrycow Posted September 8, 2008 Posted September 8, 2008 OK, here's my code, and i keep getting the same error... MouseClick("Left", $PixSearch[0], $PixSearch[1]) MouseClick("Left", $PixSearch^ ERROR The thing is i do have x and y coords from $pixsearch. Am i using @error correctly?? If not, how would i go about searching for the pixelcolour "255"? I want it to roughly check the page quickly, thats why i have it as a random number between 0 and 50. However, if it doesnt find it, i want it to check again, as it is very likely there is one there. However in the event that there isnt one, i want it to just continue. Many Thanks...Here's my code: If $Percentclick < $Clicksearch[1][1] Then Sleep (1000) $Box = IniReadSection ( "setup.ini", "Click" ) $randomstep = Random(0,50) $PixSearch = pixelsearch($Box[4][1],$Box[5][1],$Box[6][1],$Box[7][1],255,35,$randomstep) $attempt=0 If @error Then Do $randomstep = Random(0,50) $PixSearch = pixelsearch($Box[4][1],$Box[5][1],$Box[6][1],$Box[7][1],255,35,$randomstep) $attempt=$attempt+1 If $attempt = 50 Then ExitLoop EndIf Until Not @Error Endif If Not @Error Then Sleep(2000) MouseClick("Left", $PixSearch[0], $PixSearch[1]) $actualclick=$actualclick+1 EndIf EndIf Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Moderators SmOke_N Posted September 8, 2008 Moderators Posted September 8, 2008 @error is used directly after the function you are calling.... PixelSearch(... If @error Then etc.. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Andreik Posted September 8, 2008 Posted September 8, 2008 if color is not found then you don't have an array $PixSearch. Use @error to be sure that your color was found.
furrycow Posted September 8, 2008 Author Posted September 8, 2008 @error is used directly after the function you are calling....PixelSearch(...If @error Then etc..So Smoke, youre saying that i need to move the variable $attempt out from in between the pixelsearch and the @error?? And so does that mean that the Do loop would work or not as it has an "until not @error"? and theres a variable in the Do loop? Sorry, just reading back on that it doesnt sound that clear but i cant think of how else to phrase it :SThanks for getting back so quick Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Andreik Posted September 8, 2008 Posted September 8, 2008 So Smoke, youre saying that i need to move the variable $attempt out from in between the pixelsearch and the @error?? And so does that mean that the Do loop would work or not as it has an "until not @error"? and theres a variable in the Do loop? Sorry, just reading back on that it doesnt sound that clear but i cant think of how else to phrase it :S Thanks for getting back so quick Try this: If $Percentclick < $Clicksearch[1][1] Then Sleep (1000) $Box = IniReadSection ( "setup.ini", "Click" ) $randomstep = Random(0,50) $PixSearch = pixelsearch($Box[4][1],$Box[5][1],$Box[6][1],$Box[7][1],255,35,$randomstep) If @error Then $attempt = 0 $OUT = 0 Do $randomstep = Random(0,50) $PixSearch = pixelsearch($Box[4][1],$Box[5][1],$Box[6][1],$Box[7][1],255,35,$randomstep) If Not @error Then $OUT = 1 $attempt=$attempt+1 If $attempt = 50 Then ExitLoop EndIf Until $OUT = 1 Endif Else Sleep(2000) MouseClick("Left", $PixSearch[0], $PixSearch[1]) $actualclick=$actualclick+1 EndIf EndIf
furrycow Posted September 8, 2008 Author Posted September 8, 2008 Try this: If $Percentclick < $Clicksearch[1][1] Then Sleep (1000) $Box = IniReadSection ( "setup.ini", "Click" ) $randomstep = Random(0,50) $PixSearch = pixelsearch($Box[4][1],$Box[5][1],$Box[6][1],$Box[7][1],255,35,$randomstep) If @error Then $attempt = 0 $OUT = 0 Do $randomstep = Random(0,50) $PixSearch = pixelsearch($Box[4][1],$Box[5][1],$Box[6][1],$Box[7][1],255,35,$randomstep) If Not @error Then $OUT = 1 $attempt=$attempt+1 If $attempt = 50 Then ExitLoop EndIf Until $OUT = 1 Endif Else Sleep(2000) MouseClick("Left", $PixSearch[0], $PixSearch[1]) $actualclick=$actualclick+1 EndIf EndIf Thanks Andreik, however, when i run this code, it does not click at all even on the times that there is a lot of colour 255. Do you have any more suggestions? Thanks for taking your time out to do this! Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now