Jump to content

Recommended Posts

Posted

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 ?

  • Moderators
Posted

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

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.

Posted

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?

  • Moderators
Posted

If ($pix == $creature) Then

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.

Posted

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

Posted

Run this and observe the difference

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


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

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