Mutalgaettae Posted October 19, 2009 Share Posted October 19, 2009 (edited) I have this code While 1 $var1 = PixelSearch ( 642, 102, 646, 107, 0x181818 ) $var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840 ) If NOT $var1 OR $var2 Then Send("{o}") EndIf Sleep(250) WEnd This is for health bar in a game.... imagename... hon.exe and i also have other codes for automatic attacking. But when i use it the window must be at front. is there anyway i can do this without making the game window on top? for example, i want to surf on the internet while the macro is working. PS.. i am not going to block the pixel part.. for example, when i surf it will not block the game screen If there is a such way... please help me with above code and also a general code so that i can apply it to other codes as well. thank you in advance Edited October 19, 2009 by Mutalgaettae Link to comment Share on other sites More sharing options...
Demonic Posted October 19, 2009 Share Posted October 19, 2009 I don't know about searching for the pixels because you'd have to have them on the screen to find them, but you can replace Send with ControlSend to automate the sending. Link to comment Share on other sites More sharing options...
Mutalgaettae Posted October 19, 2009 Author Share Posted October 19, 2009 I don't know about searching for the pixels because you'd have to have them on the screen to find them, but you can replace Send with ControlSend to automate the sending.i am not going to block the screen.. so the pixel would still be there to be detected Link to comment Share on other sites More sharing options...
Bowmore Posted October 19, 2009 Share Posted October 19, 2009 (edited) You need to use the last parameter of PixelSearch to specify the handle of the game window.$hWndGame = WinGetHandle( "Insert game window title here") While 1 $var1 = PixelSearch ( 642, 102, 646, 107, 0x181818, 0, 1, $hWndGame) $var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840, 0, 1, $hWndGame) If NOT ($var1 OR $var2) Then ControlSend ( "Insert game window title here", "", "", "{o}" ) EndIf Sleep(250) WEnd Edited October 19, 2009 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
AwAke Posted October 19, 2009 Share Posted October 19, 2009 You need to use the last parameter of PixelSearch to specify the handle of the game window. $hWndGame = WinGetHandle( "Insert game window title here") While 1 $var1 = PixelSearch ( 642, 102, 646, 107, 0x181818, 0, 1, $hWndGame) $var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840, 0, 1, $hWndGame) If NOT ($var1 OR $var2) Then ControlSend ( "Insert game window title here", "", "", "{o}" ) EndIf Sleep(250) WEnd I believe that still wont work, I may be wrong but when the application is minimized then there is no rendering taken place thus no pixels. I think its (impossible?) to detect pixels unless the window is active or being displayed. Link to comment Share on other sites More sharing options...
Mutalgaettae Posted October 19, 2009 Author Share Posted October 19, 2009 It worked perfectly! however there is a weird problem. i use that for automatic health. when my health is low enough to trigger the code, it doesn't fill the health. however, during that time if i open a conversation box, i can see o constantly typing... so it does work in game while i browse... but y not actually heal? 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