Sign in to follow this  
Followers 0
Amh.p

Hex Colour code

7 posts in this topic

Hello,

I am new to Autoit

and can juse some help

I want to fix a script i fount ( for a game )

This is the part where it dusent work the string creature need to be red to be exekly see bottom of my post

Local $pix

Local $creature = 0xFF0000

$pix = PixelGetColor ()

If $pix = $creature Then

I need the colour red, and as far i know is the code right

but it looks like it see 0x as the first two numbers in this case wil red be 0x and x dusent exist in hex

so it dusent show up eny red at all

I jused colour detector v2.0 to see the exact colour i need

It says

HEX: 1000D6

RGB: 214, 0, 16

HTML: #D60010

LONG: 1048790

Can enyone tel me how to get these colours ?

Share this post


Link to post
Share on other sites



Try using the AutoInfo.exe tool provided in the AutoIt v3 download. You will see what you need.


[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

Thank you for the tip

But i stil have a problem

It only reed Green and blue colours

Let me give you some more code maybe you can see the problem

Func _FindCreature(ByRef $x, ByRef $y)

Local $pix

Local $creature = 0xFF0000 ;<-------- there the colour only display back green and blue but i need red color

$pix = PixelGetColor($offset[1] + 300, $offset[2] + 151)

If $pix = $creature Then

$x = $offset[1] + 300

$y = $offset[2] + 151

Return 1

EndIf

$pix = PixelGetColor($offset[1] + 320, $offset[2] + 151)

If $pix = $creature Then

$x = $offset[1] + 320

$y = $offset[2] + 151

Return 1

EndIf

$pix = PixelGetColor($offset[1] + 320, $offset[2] + 161)

If $pix = $creature Then

$x = $offset[1] + 320

$y = $offset[2] + 161

Return 1

EndIf

$pix = PixelGetColor($offset[1] + 300, $offset[2] + 161)

If $pix = $creature Then

$x = $offset[1] + 300

$y = $offset[2] + 161

Return 1

EndIf

Local $loopcount = 2

Local $ix, $iy

$ix = $offset[1] + 310

$iy = $offset[2] + 146

While $loopcount < 30

For $i = 1 To $loopcount

$pix = PixelGetColor($ix, $iy)

If $pix = $creature Then

$x = $ix

$y = $iy

Return $loopcount

EndIf

$ix = $ix + 10

$iy = $iy + 5

Next

For $i = 1 To $loopcount

$pix = PixelGetColor($ix, $iy)

If $pix = $creature Then

$x = $ix

$y = $iy

Return $loopcount

EndIf

$ix = $ix - 10

$iy = $iy + 5

Next

For $i = 1 To $loopcount

$pix = PixelGetColor($ix, $iy)

If $pix = $creature Then

$x = $ix

$y = $iy

Return $loopcount

EndIf

$ix = $ix - 10

$iy = $iy - 5

Next

For $i = 1 To $loopcount

$pix = PixelGetColor($ix, $iy)

If $pix = $creature Then

$x = $ix

$y = $iy

Return $loopcount

EndIf

$ix = $ix + 10

$iy = $iy - 5

Next

Sleep(5)

$iy = $iy - 5

$loopcount = $loopcount + 1

WEnd

$x = 0

$y = 0

Return 0

EndFunc ;==>_FindCreature

IF you find the problem or know how to fix it can you give me the right code please?

Share this post


Link to post
Share on other sites

If ($pix == $creature) Then


[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

Thank you Dhat works also but i stil have the same problem.

The colour red " 0xFF0000 " Dusent work

It only see Green and Blue so " 0x00FF00 and 0x0000FF "

Its in RGB I see in the AutoInfo.exe tool dhat you can chance the colour code from RGB to BGR

Does enyone know how to chance dhat in my script dhat it reed BGR ( Blue Green Red )

becouse my script work with green just not with red and red is what i need

Local $creature = 0xFF0000 Dusent work

Local $creature = 0x00FF00 Works but i need the red colour

So i tougt if i make the Code to

BGR

wil this be the code

Local $creature = 0x0000FF

if there are eny sugestions or if you know how to solfe this problem let me know please

Share this post


Link to post
Share on other sites

Run this and observe the difference

$pix = PixelGetColor(100,100)
MsgBox(0,"",Hex($pix, 6))
$pix1 = "0x" & Hex($pix, 6)
MsgBox(0,"",$pix1)


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thank you i have the problem fixed

Thanks agen !

:whistle:

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