mrnoob Posted December 4, 2007 Share Posted December 4, 2007 (edited) So, I am trying to automate this flash game(http://www.newgrounds.com/portal/view/410537) just for fun and practice. Basically what you have to do is shoot the target before the computer, and the close you are to the bullseye, the more damage you do.However, the games cursor has a delay on it, and more much slower then your mouses cursor; this makes it more difficult to program a bot. If you play the game once, it will be much easier to see what my code it doing, but if you dont have time, this image will help. http://img80.imageshack.us/my.php?image=shootgamebs5.jpgRight now, my problem is with this line of code : CODE($farY - 654) = $slope($farx - 367)It work if the above line is altered such that $farY is less then 357 rather then greater :CODEWhile $farY < 357 AND $farX < 934CODEOpt("MouseCoordMode", 1) ;screen modeHotKeySet("z","_set")HotKeySet("x", "_shoot")HotKeySet("p", "_pause")HotKeySet("t", "_close")func _set() mousemove(367, 654, 40)EndFunc;==>EndFuncFunc _shoot() local $left = $Bulleye[0]-15 local $top = $Bulleye[1]-30 local $right = $Bulleye[0]-5 local $bottom = $Bulleye[1]+30 local $slope = abs(($Bulleye[1]-654)/($Bulleye[0]-367)) local $farX = $bulleye[1] local $fary = $bulleye[0] local $Bulleye = PixelSearch(480, 383, 778, 661, 0xD8681F, 0, 1) While $farY > 357 AND $farX < 934 ($farY - 654) = $slope($farx - 367) $Farx=$farx+1 WEnd MouseMove($farX, $farY, 1) Sleep(30) $curSum = PixelChecksum($left, $top, $right, $bottom, 1) Do ;these lines are just for testing ;mousemove($left, $top, 40) ;mousemove($right, $top, 40) ;mousemove($right, $bottom, 40) ;mousemove($left, $bottom, 40) ;nmousemove($left, $top, 40) $curCheck = PixelChecksum($left, $top, $right, $bottom, 1) until $curSum <> $curCheck MouseClick("$farY",$bulleye[0], $Bulleye[1], 1, 0)EndFunc ;==>EndFuncFunc _close() ExitEndFunc;==>EndFuncFunc _Pause() while 1 sleep(50) WendEndFunc;==>EndFunc While 1 sleep(50)WEnd Edited December 4, 2007 by mrnoob 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