ddr4lyfe Posted December 31, 2008 Share Posted December 31, 2008 (edited) I'm trying to make an auto-clicker for a game, and it uses a combination of PixelGetColor and MouseGetPos. I basically want it to do something when a color at a certain point is a certain color. The only problem I'm having is that although it's picking the right pixel coordinate, it's picking up a color from a different coordinate. Everything is coded right, but why would something like this happen? Could it have something to do with the game having it's own custom cursor that masks the Windows cursor once the Windows cursor enters the game window? Just need some input on this so I could see if I could get it working correctly. Hmm...I made an entire debug program for it and now it seems to work fine....I have no idea what's going on.. Edited December 31, 2008 by ddr4lyfe Link to comment Share on other sites More sharing options...
Achilles Posted December 31, 2008 Share Posted December 31, 2008 Some more detail and there might be somebody who can help you. (e.g. What game? Where's your code?) My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
ddr4lyfe Posted December 31, 2008 Author Share Posted December 31, 2008 (edited) I've decided to completely recode my auto-clicker, I'll post back with my redone code if it still doesn't work. Ok, I've redone the program, but I'm stuck still. Now no matter what I seem to do, I always run into the branch in the _FeedHom function that occurs if $BarColor <> $BarRed. Maybe someone can help out with what's going on. expandcollapse popup;;FeelRO Homunculus Feeder ;;================================================================================= ;;Variable Declarations ;;================================================================================= Global $StartUp ;StartUp choice Global $FeedNum ;Amount of feed Global $Counter ;Feed counter Global $BarColor;Color of hunger bar Global $BarRed ;Red color of hunger bar Global $BarBlue ;Blue color of hunger bar Global $BarPos ;Position of hunger bar Global $FeedPos ;Position of feed button Global $YesPos ;Position of yes button ;;================================================================================= ;;Variable Definitions ;;================================================================================= $BarRed = 7798784;Sets red color of hunger bar $BarBlue = 4802912;Sets blue color of hunger bar ;BarColor = $BarRed OR $BarBlue ;;================================================================================= ;;Functions ;;================================================================================= Func _StartUp ();StartUp 'tutorial' window $StartUp = MsgBox (1, "FeelRO Homunculus Feeder", "Thank you for using the FeelRO Homunculus Feeder. To view the readme, click OK. To skip to the program, click Cancel.") If $StartUp == 1 Then;If OK is pressed Run ("notepad.exe readme.txt");Open readme file EndIf EndFunc Func _GetFeedNum ();Gets amount of feed $FeedNum = InputBox ("FeelRO Homunculus Feeder", "How much feed do you have?") TrayTip ("FeelRO Homunculus Feeder", "Feed amount: " & $FeedNum, 1) Return $FeedNum EndFunc Func _GetBarPos ();Gets hunger bar position ;User points cursor to hunger bar $BarPos = MouseGetPos () TrayTip ("FeelRO Homunculus Feeder", "Hunger bar position: " & $BarPos[0] & ", " & $BarPos[1], 1) Return $BarPos EndFunc Func _GetBarColor ();Gets hunger bar color ;Using position from _GetBarPos $BarColor = PixelGetColor ($BarPos[0], $BarPos[1]) TrayTip ("FeelRO Homunculus Feeder", "Hunger bar color: " & $BarColor, 1) Return $BarColor EndFunc Func _CheckBarRed ();Checks hunger bar for red color ;Using position from _GetBarPos $BarColor = PixelGetColor ($BarPos[0], $BarPos[1]) If $BarColor == $BarRed Then;If hunger bar is Red TrayTip ("FeelRO Homunculus Feeder", "Hunger bar is red", 1) Else ;If hunger bar is not Red TrayTip ("FeelRO Homunculus Feeder", "Hunger is not red", 1) EndIf EndFunc Func _CheckBarBlue ();Checks hunger bar for red color ;Using position from _GetBarPos $BarColor = PixelGetColor ($BarPos[0], $BarPos[1]) If $BarColor == $BarBlue Then;If hunger bar is Blue TrayTip ("FeelRO Homunculus Feeder", "Hunger bar is blue", 1) Else ;If hunger bar is not Blue TrayTip ("FeelRO Homunculus Feeder", "Hunger is not blue", 1) EndIf EndFunc Func _GetFeedPos ();Gets feed button position ;User points cursor to feed button $FeedPos = MouseGetPos () TrayTip ("FeelRO Homunculus Feeder", "Feed button position: " & $FeedPos[0] & ", " & $FeedPos[1], 1) Return $FeedPos EndFunc Func _GetYesPos ();Gets yes button position ;User points cursor to yes button $YesPos = MouseGetPos () TrayTip ("FeelRO Homunculus Feeder", "Yes button position: " & $YesPos[0] & ", " & $YesPos[1], 1) Return $YesPos EndFunc Func _FeedHom ($FeedNum, $Counter, $BarColor, $BarRed, $BarBlue, $BarPos, $FeedPos, $YesPos);Feeds homunculus $Counter = $FeedNum Do ;Do the following until feed runs out While 1;While hunger bar color is not red $BarColor = PixelGetColor ($BarPos[0], $BarPos[1]) If $BarColor == $BarRed Then;If hunger bar color is red TrayTip ("FeelRO Homunculus Feeder", "Hunger bar is red, will feed in 3 seconds", 1) Sleep (3000) ExitLoop Else ;If hunger bar color is not red TrayTip ("FeelRO Homunculus Feeder", "Hunger bar is blue, will try again in 3 seconds", 1) Sleep (3000) ContinueLoop EndIf WEnd ;Sleep (3000) MouseClick ("left", $FeedPos[0], $FeedPos[1], 1, 5);Click feed button MouseClick ("left", $YesPos[0], $YesPos[1], 1, 5);Click yes button $Counter = $Counter - 1;Keep track of one feed used Until $Counter == 0 EndFunc ;;================================================================================= ;;Program Section ;;================================================================================= Call ("_StartUp") While 1 AutoItSetOption ("MouseCoordMode", 1);Sets mouse coord mode to window HotKeySet ("{F2}", "_GetFeedNum") HotKeySet ("{F3}", "_GetBarPos") HotKeySet ("{F4}", "_GetBarColor") HotKeySet ("{F5}", "_CheckBarRed") HotKeySet ("{F6}", "_CheckBarBlue") HotKeySet ("{F7}", "_GetFeedPos") HotKeySet ("{F8}", "_GetYesPos") HotKeySet ("{F9}", "_FeedHom") WEndrohomfeeder.au3 Edited January 1, 2009 by ddr4lyfe Link to comment Share on other sites More sharing options...
ddr4lyfe Posted January 2, 2009 Author Share Posted January 2, 2009 I decided to look at it some more, but I still can't seem to get it to register that the hunger bar is red... Any ideas? 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