shade123 Posted March 2, 2009 Share Posted March 2, 2009 Okay, when i run this, nothing happens except for my msgbox. When i remove the If Not @error Then line, it gives me an error saying Error: Subscript used with non-Array Variable. Here is the code: MsgBox(0, "Insomnia Bot v2","Bot Launched - Taking effect in 10 seconds",10) while 1=1 sleep(10000) $coord = PixelSearch(0, 0, 100, 300, 0xF7A273) If Not @error Then Send("{F11}") sleep(1000) MouseMove($coord[0],$coord[1],0) MouseClick("right",$coord[0],$coord[1],1) EndIf if (PixelGetColor(254,87) = 0x5A3000) then sleep(3000) MouseMove(325,348,0) MouseClick("left",325,348,2) sleep(3000) MouseMove(645,229,0) MouseClick("left",645,229,2) EndIf WEnd how do i fix it? ty Link to comment Share on other sites More sharing options...
BlackPhoenix Posted March 2, 2009 Share Posted March 2, 2009 Okay, when i run this, nothing happens except for my msgbox. When i remove the If Not @error Then line, it gives me an error saying Error: Subscript used with non-Array Variable. Here is the code: MsgBox(0, "Insomnia Bot v2","Bot Launched - Taking effect in 10 seconds",10) while 1=1 sleep(10000) $coord = PixelSearch(0, 0, 100, 300, 0xF7A273) If Not @error Then Send("{F11}") sleep(1000) MouseMove($coord[0],$coord[1],0) MouseClick("right",$coord[0],$coord[1],1) EndIf if (PixelGetColor(254,87) = 0x5A3000) then sleep(3000) MouseMove(325,348,0) MouseClick("left",325,348,2) sleep(3000) MouseMove(645,229,0) MouseClick("left",645,229,2) EndIf WEnd how do i fix it? tyMaybe you could try this: MsgBox(0, "Insomnia Bot v2","Bot Launched - Taking effect in 10 seconds",10) while 1 sleep(10000) $coord = PixelSearch(0, 0, 100, 300, 0xF7A273) If @error Then Msgbox(0,'Error','Could not find the pixel') Endif Else Send("{F11}") sleep(1000) MouseMove($coord[0],$coord[1],0) MouseClick("right",$coord[0],$coord[1],1) EndIf if PixelGetColor(254,87) = 0x5A3000 then sleep(3000) MouseMove(325,348,0) MouseClick("left",325,348,2) sleep(3000) MouseMove(645,229,0) MouseClick("left",645,229,2) EndIf WEnd Link to comment Share on other sites More sharing options...
shade123 Posted March 2, 2009 Author Share Posted March 2, 2009 Maybe you could try this: MsgBox(0, "Insomnia Bot v2","Bot Launched - Taking effect in 10 seconds",10) while 1 sleep(10000) $coord = PixelSearch(0, 0, 100, 300, 0xF7A273) If @error Then Msgbox(0,'Error','Could not find the pixel') Endif Else Send("{F11}") sleep(1000) MouseMove($coord[0],$coord[1],0) MouseClick("right",$coord[0],$coord[1],1) EndIf if PixelGetColor(254,87) = 0x5A3000 then sleep(3000) MouseMove(325,348,0) MouseClick("left",325,348,2) sleep(3000) MouseMove(645,229,0) MouseClick("left",645,229,2) EndIf WEnd the problem is, it never finds the pixel... lol Link to comment Share on other sites More sharing options...
BlackPhoenix Posted March 2, 2009 Share Posted March 2, 2009 the problem is, it never finds the pixel... lolThen play with these vars: $coord = PixelSearch(0, 0, 100, 300, 0xF7A273)oÝ÷ ØƲmç!jx¶¬jëh×6$coord = PixelSearch(0, 0, 100, 300, 0xF7A273, 10)That gives it a range of 10 to search for. Or perhaps those coordinates aren't right, and if the bot shouldn't wait 10 secs everytime you perhaps might want to take sleep(10000) outside the while loop Link to comment Share on other sites More sharing options...
shade123 Posted March 3, 2009 Author Share Posted March 3, 2009 thanks i found a way another question - how do i make it so that once it has detected the pixel and done wat i want with it, it gets ignored from then on? Link to comment Share on other sites More sharing options...
BlackPhoenix Posted March 3, 2009 Share Posted March 3, 2009 Global $test=1 While $test=1 $coord = PixelSearch(0, 0, 100, 300, 0xF7A273, 10) if not @error then $test=0 ;some stuff here Wend Endfuncthanks i found a way another question - how do i make it so that once it has detected the pixel and done wat i want with it, it gets ignored from then on?Thats how i would do it but its possible on multiple ways: Link to comment Share on other sites More sharing options...
shade123 Posted March 4, 2009 Author Share Posted March 4, 2009 Global $test=1 While $test=1 $coord = PixelSearch(0, 0, 100, 300, 0xF7A273, 10) if not @error then $test=0 ;some stuff here Wend Endfunc Thats how i would do it but its possible on multiple ways: but would that ignore that very specific pixel or all pixels of that color? i just want it to ignore that very specific one so that it can then target the same pixel but in other spots Link to comment Share on other sites More sharing options...
Aceguy Posted March 4, 2009 Share Posted March 4, 2009 when the pixelsearch finds pixel you want within the parameters youset it return an array.....???? #include <array.au3> dim $array[101] $c=0 $coord = PixelSearch(0, 0, 100, 300, 0xF7A273, 10) if not @error then $c+=2 $array[$c-1]=$coord[0] $array[$c]=$coord[1] if _ArraySearch($array,$coord[0])=0 and _ArraySearch($array,$coord[1])=0 Then ;do whatever becasue the colour found @ $coord[0]&[1] hasnt been found EndIf EndIf youll need to incorperate this into your script, this will work, but you need your loops ect put in the right place.... build on what i have posted [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
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