Jump to content

pixelgetcolor


Recommended Posts

hi,

i have to find the color of a pixel in a game. i used this script

sleep(7000)
; now get in the game
$pos = MouseGetPos()
$var = PixelGetColor($pos[0],$pos[1])
$var2 = PixelGetColor(150,180)
MsgBox(0,"mousposition: ",$pos[0] &" "& $pos[1])
MsgBox(0,"The decmial color is", $var)
MsgBox(0,"The hex color is", Hex($var, 6))
MsgBox(0,"var2 (dec): ", $var2)
MsgBox(0,"var2 (hex):", Hex($var2, 6))
exit

i always get the answer of color dec:0 hex:000000

when im outside of the game it works and i get a color back.

what should i do to get the right color?

bye

bartmon

ps: sry for my bad english

Link to comment
Share on other sites

Well dec 0 and hex 0x000000 are the same color (pure black). Could it be that your game has a black pixel where you're getting the color?

You might also want to have a hotkey set up so you can get the pixels at any given time, not just after 7 seconds.

HotKeySet ("~", "GetMeSomePixels")
HotKeySet ("{ESC}", "quitme")

While 1
    Sleep (1000)
WEnd

Func GetMeSomePixels()
    $pos = MouseGetPos()
    $var = PixelGetColor($pos[0],$pos[1])
    $var2 = PixelGetColor(150,180)
    MsgBox(0,"mousposition: ",$pos[0] &" "& $pos[1])
    MsgBox(0,"The decmial color is", $var)
    MsgBox(0,"The hex color is", Hex($var, 6))
    MsgBox(0,"var2 (dec): ", $var2)
    MsgBox(0,"var2 (hex):", Hex($var2, 6))
EndFunc

Func quitme()
    Exit
EndFunc
Link to comment
Share on other sites

  • Moderators

maybe look at Opt('MouseCoordMode', 'Number') and Opt('PixelCoordMode', 'Number') in the help file too.

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

hello,

thx for the hotkeytip.

i test AutoItSetOption ('MouseCoordMode', 'Number') and AutoItSetOption ('PixelCoordMode', 'Number') and there is no chance.

there is definitely no black pixel =`(

but its able that hackshield blocks autoit. because when i start the game in windowmode and make a screenshot i get only a text in the screen shot --> "hackshield"

can anyone help me?

Link to comment
Share on other sites

  • Moderators

Well I'll say this... hope you didn't do 'Number' and you used 0, or 1, or 2 rather than just 'Number' :o, on the other stuff... I guess I find my self fortunate that I don't play these type of games to run into that problem. Sorry.

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

pls dont spam i need some help and no spam

Are you kidding me? Don't spam? I was trying to be helpful for a SPECIFIC situation that it looked like you were doing wrong (AND PROBABLY ARE)!

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

When getting pixel color in a game ive found that most games end up getting pixel color of the tip of the cursor instead of the actual game gui try adding a slight sleep to your code

$somevar = MouseGetPos

Sleep(5000) ;allows you five second to move the cursor out of the way

$somevar = PixelGetColor($somevar[0], $somevar[1])

hope that helps

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...