Sign in to follow this  
Followers 0
vicev

Help Needed, Mouse Colour Under Pixel

27 posts in this topic

Using au3info when i load up Martial Heroes all i get is 0x000000. This happens whether i've alt-tabbed out and am running thr cursor around a windows application, or if i'm in full screen/windowed and am trying to find a specific colour of a pixel in game.

Upon closing down the application, "Pixel Colour Under Mouse" returns to functioning correctly.

This is backed up by using the following script

sleep(2000)
$col = PixelGetColor( 500 , 500 ) 
MsgBox( "", "test", $col)

Does anyone have any idea why this might be happening? Also it occurs on more than one computer, so therefore i'm pressuming it has something to do with the game. Is there a way around this?

Below is the entire script. Sloppy? most probably. but it will do the job perfectly if it would actually find the pixel colour.

sleep(2000)
HotKeySet("{ESC}", "Terminate")
$p = 0
Do
    $o = 0
    Do
        $i = 0
        Do
        If PixelGetColor( 138 , 313 ) = 0xff4142 Then
            MouseMove(170, 342, 0)
        Endif
        If PixelGetColor( 170 , 313 ) = 0xff4142 Then
            mouseclick("left", 170, 342, 1)
        Endif
        If PixelGetColor( 218 , 313 ) = 0xff4142 Then
            MouseMove(251, 342, 0)
        Endif
        If PixelGetColor( 251 , 313 ) = 0xff4142 Then
            mouseclick("left", 251, 342, 1)
        Endif
        If PixelGetColor( 299 , 313 ) = 0xff4142 Then
            MouseMove(333, 342, 0)
        Endif
        If PixelGetColor( 333 , 313 ) = 0xff4142 Then
            mouseclick("left", 333, 342, 1)
        Endif
        $i = $i + 1
        Until $i = 200
    sleep("100")
    mouseclick("right", 1307, 436, 1)
    sleep("100")
    mouseclick("left", 745, 655, 1)
    sleep("800")
    $o = $o + 1
    Until $o = 20
send("{ESC}")
sleep("2000")
mouseclick("right", 1307, 436, 1)
sleep("200")
mouseclick("left", 745, 655, 1)
sleep("800")
Until $p = 1

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites



Sorry about the placing of this thread under the wrong board. Just noticed, the big words "this is not a general support forum" staring me in the face after posting.

Share this post


Link to post
Share on other sites

The window must have focus in order for the Pixel functions to work:

1. Look at Opt('PixelCoordMode') in the help file.

2:

Do
        If Not WinActive('My Game Window Name') Then WinActivate('My Game Window Name')
        If PixelGetColor( 138 , 313 ) = 0xff4142 Then
            MouseMove(170, 342, 0)
        Endif
        If PixelGetColor( 170 , 313 ) = 0xff4142 Then
            mouseclick("left", 170, 342, 1)
        Endif
        If PixelGetColor( 218 , 313 ) = 0xff4142 Then
            MouseMove(251, 342, 0)
        Endif
        If PixelGetColor( 251 , 313 ) = 0xff4142 Then
            mouseclick("left", 251, 342, 1)
        Endif
        If PixelGetColor( 299 , 313 ) = 0xff4142 Then
            MouseMove(333, 342, 0)
        Endif
        If PixelGetColor( 333 , 313 ) = 0xff4142 Then
            mouseclick("left", 333, 342, 1)
        Endif
        $i = $i + 1
        Until $i = 200
That should help... Good luck...

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thanks for the quick reply.

I have just tested your suggestion.

Unfortunately it's the same story as before.

I had the sleep(2000) in to make sure the window was activated before by simply clicking. So your above comment is without a doubt going to come in handy, but it didn't solve my problem.

Again, forgetting about the script, if I just use au3info to try and get the pixel colour, when the game is open (active or not), the colour is returned as 0.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

PixelGetColor probably will not work with applications that write directly to video memory such as some games, Windows Media Player movies, etc.

Edit: I wonder what would happen if you went to Control Panel > Display > Advanced > Troubleshooting > and decreased the hardware acceleration.....

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Hardware Acceleration decreased as far as possible so the game still works. No change, still returning 0.

Yes i can take prntscrn screenshots without any hassles.

Again thanks for all your replies so far.

Share this post


Link to post
Share on other sites

Are there no other suggestions for me?

Share this post


Link to post
Share on other sites

Are there no other suggestions for me?

I would imagine that Larry's suggestion is the only way to go there.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Unfortunately Larry did not suggest a work around, or explain as to why autoit is not picking up the pixel colour when the game is running. He just said that it should work. I respect that this is a somewhat strange phenomena, and if there is no explaination that anyone can offer, i shall go back to doing things manually :-(

Thanks for your help. I wish there was a reason for this happening.

Edited by vicev

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

i think autoit will find it in game, just info tool cant. Try it out, make screenie and take pixels from there.

Edited by iverson_est

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

if you look in first post of the thread. i've checked it already, using au3info and running the script below, and all that is displayed is 0. Exit the game, and hey presto.

If Not Winactive('Do') Then WinActivate('Do')
Opt("PixelCoordMode", 0)
sleep(2000)
$col = PixelGetColor( 500 , 500 ) 
MsgBox( "", "", $col)
Edited by vicev

Share this post


Link to post
Share on other sites

read my post again

Share this post


Link to post
Share on other sites

now if you took the time to search the forum there are many that have had the same exact problem and thats because its a d3d game, so even with larrys suggestion, you may get the pixel color, BUT, its going to be IMPOSSIBLE to search the screen for that pixel, so pixel bots are completely RULED OUT. :) there are a few others such as memory bots, and finding the call that changes the graphics on the mouse and if it is called it will double click and such but you may need to use a different language if you want to use pixels

Share this post


Link to post
Share on other sites

Well quite frankly... what a load of ****. I was quite looking forward to using that.

Valuater i used your colour picker, it also just came back with 0x000000.

Thanks for your insight into this thatsgreat2345, and by the way i spent an hour looking into it before i posted.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

now if you took the time to search the forum there are many that have had the same exact problem and thats because its a d3d game, so even with larrys suggestion, you may get the pixel color, BUT, its going to be IMPOSSIBLE to search the screen for that pixel, so pixel bots are completely RULED OUT. :) there are a few others such as memory bots, and finding the call that changes the graphics on the mouse and if it is called it will double click and such but you may need to use a different language if you want to use pixels

It would stand to reason that using larry's method of getting the screen shot and then getting coords in retrospect to screen location would be quite pheasible. Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

It would stand to reason that using larry's method of getting the screen shot and then getting coords in retrospect to screen location would be quite pheasible.

Would this not be a time consuming method?

.Take screenshot

.Open screenshot

.Check pixel

.Activate game window

.Act accordingly

Or is there something I have not realised?

Share this post


Link to post
Share on other sites

Thankyou Larry, I will look into this, as it DOES take screenshots perfectly, but as my knowledge of scripting is such that i was actually proud of the initial script I wrote, I fear I'm going to be hitting a dead end with this one.

I'm surprised that this hasn't been looked into further already though. There are many d3d games, and many people that no doubt wish to utilise this function in there scripting. It's a bit more difficult when you have to develop a way yourself to do the job you want, but I guess all the more rewarding.

Share this post


Link to post
Share on other sites

well im saying is yes you may accomplish getting the correct pictures, but if u use pixel search it still wont find it, but if you developed a program fast enough to take a screenshot, save it splash it on the screen search for the pixel splash it off then double click there quickly then u may be able to do so, now if the game has some sort of protection such as nrpotect gameguard or hack shield then it will also block any mouse input other then straight from the mouse, thus ur screwed

Share this post


Link to post
Share on other sites

:) I didn't really read your post but try this

WinActivate ("program")
WinWaitActive ("program")
$Timer = TimerInit ()
While TimerDiff ($Timer) < 3000
    TrayTip ("Pixel Grabbing", "In " & 3 - Int (TimerDiff ($Timer)/1000) & " seconds", 10)
    Sleep (250)
WEnd
TrayTip ("", "", 1)
$Color = PixelGetColor (77, 540)
MsgBox (0, "Pixel Grabbed", "Pixel Color for: (77, 540) is:" & @CRLF & "Dec: " & $Color & @CRLF & "Hex: " & Hex ($Color, 6))

this will open the program wait ten seconds then give you a pop of the pixel


Thanks in advance

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