Jump to content

PixelGetColor Always returns 0 or 0x000000(hex)


MagnumXL
 Share

Recommended Posts

Messing around with a helper for a game. I dont have any code yet except for a couple of tests. When those tests came back with the same results I tried the "AutoIt3 Active Window Info" tool. It gives the the same results. I think that the game is blocking pixel color in some way. The info tool picks up color fine in other screens.

I did use the search function but couldnt find anything on this issue. If i missed a post on this i am sorry and would love to be directed to it.

Has anyone else had this same problem with any game? Anyone know a workaround? I'll re-write my code and post it to make sure there is not a problem there. Thanks in advance for help.

Link to comment
Share on other sites

  • Moderators

Check your Opt("PixelCoordMode") settings to make sure they are the set to the same as how you got the coords in the AutoInfo.exe

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.

Link to comment
Share on other sites

  • Moderators

Again, does the 2 (meaning client coords) match your AutoInfo Window ?

$thex = Hex($tpix)

$thex = Hex($tpix, 6)

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.

Link to comment
Share on other sites

Well you were right i did have them set differently ><, but i still get the same results. I am using opttion 0 (active window) in both my code and the info tool now..

Info tool:

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x000000 Dec: 0

Code result:

Posted Image

I hope this helps.

Edited by MagnumXL
Link to comment
Share on other sites

What game is it? Some games block the APIs used for pixel color checking as part of their anti-cheating stuff.

Honestly, I'd rather not say. Only because my screenname here relates to my account name there. Sorry i dont mean to sound like an ass, I'll pm it too you though ;)

Automating games is like hiring someone to smoke your cigarettes

True! My problem is that i always get into a game and think "Why the hell did they do this this way?, I would have done it better!,... oh wait! maybe i still can!". I actually have more fun modifying games to my liking than actually playing them. Maybe I should just get into game design... Edited by MagnumXL
Link to comment
Share on other sites

I have a similar problem. I have a full screen application program; however, I can measure pixel values so it must be using the DC. I wrote the following program to monitor a single pixel and see if the value was actually changing. I attached a bit of the output and you can see that about 8-10% of the time the pixel value has changed.

So my question is what is causing this change? I see no change on the screen, but PixelGetColor sees something changing. The game is not in windowed mode. Is it a video refresh? If so, how would this affect a digital display buffer - I wouldn't think it mattered? Is there a computer graphics trick at play here to make the redisplay more seamless?

HotKeySet("^{F1}", "GetBasePixelColor")     
HotKeySet("^{F2}", "GetPixelColor")     
HotKeySet("^{F9}", "Idle")      

Global $pixelColorBase
Global $pixelColor

Idle()

;.....................................................................
Func Idle()
    While 1
    Wend
EndFunc

Func GetBasePixelColor()
    $pixelColorBase = PixelGetColor(760,1120)
    Idle()
EndFunc

Func GetPixelColor()
    $failures = 0
    $successes = 0
    While 1
        $pixelColor = PixelGetColor(760,1120)
        If ($pixelColor <> $pixelColorBase) Then
            $failures += 1
            ConsoleWrite("$pixelColorBase = " & $pixelColorBase & "   $pixelColor = " & $pixelColor & "   (" & $successes & "," & $failures & ")" & @CRLF)
        Else
            $successes += 1
        EndIf
    Wend
EndFunc

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,1)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,2)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,3)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,4)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,5)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,6)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,7)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,8)

$pixelColorBase = 16730442 $pixelColor = 5725274 (53,9)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,10)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,11)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,12)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,13)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,14)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,15)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,16)

$pixelColorBase = 16730442 $pixelColor = 5725274 (112,17)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,18)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,19)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,20)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,21)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,22)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,23)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,24)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,25)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,26)

$pixelColorBase = 16730442 $pixelColor = 5725274 (186,27)

$pixelColorBase = 16730442 $pixelColor = 5725274 (248,28)

$pixelColorBase = 16730442 $pixelColor = 5725274 (248,29)

$pixelColorBase = 16730442 $pixelColor = 5725274 (248,30)

$pixelColorBase = 16730442 $pixelColor = 5725274 (248,31)

$pixelColorBase = 16730442 $pixelColor = 5725274 (248,32)

Edited by mvriesen2004
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...