Guest h1pp0 Posted March 6, 2005 Posted March 6, 2005 Hey all I've been working on a script for fishing on gaiaonline. I've run into a little issue with pixelsearch and mousemove. Here's the code so far (work in progress) Func Get_Fish() While 1 $grid_loc = PixelSearch (340,450,430,595,0xA50000,2,2) ; check if PixelSearch found the lure If UBound($grid_loc) > 0 and $grid_loc[0] > 340 Then ; Move mouse to the Left MouseMove (230,560,5) ; Move mouse to the origin MouseMove (380,560,2) EndIf ; check if PixelSearch found the lure If UBound($grid_loc) > 0 and $grid_loc[0] < 360 Then ; Move mouse to the Right MouseMove (490,560,5) ; Move mouse to the origin MouseMove (435,560,2) EndIf If PixelGetColor(357,375) = 16746000 Then TrayTip("","Fish Caught!",1) Sleep(2000) return EndIf If PixelGetColor(512,428) = 0 Then TrayTip("","Fish Lost!",1) Sleep(2000) return EndIf WEnd EndFunc The basic idea is: 1) Search the box for the lure: PixelSearch (340,450,430,595) 2) Once the lure if found, move the mouse to the left or right x number of pixels then go back to the original position. 3) Recalculate the possition of the lure again and move the mouse left or right The Problem: The script finds the lure but only moves the mouse in one direction (right). I've also tried a select clause and got the same result. Basically I'm stumpted as to why it's not moving to the left
phillip123adams Posted March 6, 2005 Posted March 6, 2005 The Problem:The script finds the lure but only moves the mouse in one direction (right). I've also tried a select clause and got the same result. Basically I'm stumpted as to why it's not moving to the left <{POST_SNAPBACK}>I think it will move left if you change the comparison to $grid_loc[0] >= 340, so that it honors a color match that occurs at x-340.Similarly, the other comparison should be $grid_loc[0] <= 360, so that it honors a color match that occurs at x-360.At least, this worked for me when I simulated the condition. Phillip
Guest h1pp0 Posted March 6, 2005 Posted March 6, 2005 (edited) I think it will move left if you change the comparison to $grid_loc[0] >= 340, so that it honors a color match that occurs at x-340.Similarly, the other comparison should be $grid_loc[0] <= 360, so that it honors a color match that occurs at x-360.At least, this worked for me when I simulated the condition.<{POST_SNAPBACK}>I figured out that the reason the script keeps going to the left is that the PixelSearch array isn't updated in this line:$grid_loc = PixelSearch (340,450,430,595,0xA50000,2,2)I thought it would update every time the loop ran, any idea how to correct this?Edit: Seems the color value was picking up a static pixel and not being changed. Found one that fixes the problem. Thanks for the help. Edited March 6, 2005 by h1pp0
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