Sign in to follow this  
Followers 0
Mutalgaettae

macro only on certain windows

6 posts in this topic

#1 ·  Posted (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 by Mutalgaettae

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0