Jump to content

Recommended Posts

Posted

I tried using PixelGetColor but the results were 0 and i guess the game disables pixel color grabbing thingy. So is there anyway i can get the true color of the pixel ?

Posted (edited)

Hi!

From the help file:

Return Value

Success: Returns decimal value of pixel's color.

Failure: Returns -1 if invalid coordinates.

...

$var = PixelGetColor( 10 , 100 )

MsgBox(0,"The decmial color is", $var)

MsgBox(0,"The hex color is", Hex($var, 6))

The return values 1 and 0 indicate black and white pixels.

Good luck with further scripting, peethebee

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Posted

Yeah, but the problem is the pixel color is clearly not black/white, its some other. I guess the game could have some protection that makes all pixel grabbing programs to think that its a black/white pixel.

Posted

Hi!

I can rarely imagine this. Could you please post your code aroun this function call and a jpeg screenshot i possible?

Thank you, peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Posted (edited)

You are very likely checking the colour of the tip of your mouse pointer. Does this work for you? --

Edit: It seems that this mouse-moving procedure is only really needed if you're in some form of game where the mouse pointer is custom-drawn. PixelGetColor() doesn't seem to notice the cursor when dealing with ordinary Windows.

local $pos = mouseGetPos()
mouseMove($pos[0] + 1, $pos[1] + 1)
local $color = pixelGetColor($pos[0] , $pos[1])
mouseMove($pos[0], $pos[1])
Msgbox(0x40, "Colour at Cursor", $color)
Edited by LxP
Posted (edited)

Hi!

What would this line (instead of your debug line) produce:

MsgBox(0,"The hex color is", Hex($color, 6))

?

Edit: very nice idea of LxP. Please test his solution first.

peethebee

p.s. no screenshot possible?

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Posted (edited)

Thanks alot for all of your reply. I really appreciate it.

I tried LxP code and it work ! Thanks alot dude ! and not forgetting peethebee ;)

Thanks both of you !

EDIT:

i tried it and it gave me the true pixel color, but if i run the program twice with the code below

local $pos = mouseGetPos()
mouseMove(515, 133)
sleep(1000)
local $color = pixelGetColor($pos[0] , $pos[1])
Msgbox(0x40, "Colour at Cursor", $color)

It gave me 2 different color *answer*. Everytime i run it, it would give me a different color. How do i go about solving that ?

Thanks once again

Edited by steelys
Posted

Hi!

It is depending on the MousePos and if you position it by hand, you cannot (or almost not) be pover the same pixel...

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Posted

Another thought: games often use antialiasing which results in subtle variations of colours at any one time. 3D games are particularly hard to process (although not impossible) because there are always different shades of the colour in question.

You may want to consider PixelSearch() with a 1x1 search rectangle as a solution as you will be able to specify an acceptable shade variation.

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
  • Recently Browsing   0 members

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