Sign in to follow this  
Followers 0
Xav

How can it looks at x2 color

7 posts in this topic

If pixel search see 0x5C0000 or 0x18480C , It will sleep wait 2secondes....

Something like that but it has to work xD! :

$Life = 0x5C0000 , 0x18480C

PixelSearch( 735, 585 , 735, 585 ,$life )
  If Not @Error Then 
  Sleep (2000)
 Endif

Share this post


Link to post
Share on other sites



$Life = PixelGetColor(735, 585)
If $Life = 0x5C0000 Or $Life = 0x18480C Then
  _somefunction()
Else 
  Sleep (2000)
Endif

How can i do / If @Error / If it doesnt get the color

$Life = PixelGetColor(735, 585)
If $Life = 0x5C0000 Or $Life = 0x18480C [b]@error[/b] Then
  _somefunction()
Else 
  Sleep (2000)
Endif

I Have tried to add "@error" and it does not work too

Share this post


Link to post
Share on other sites

The else statement gives you the the opportunity to run the code you want if it doesnt detect the color.

Share this post


Link to post
Share on other sites

You just have to use your first code but have say life2 as the second colour, as pixelgetcolor does not set @error according to helpfile, and you cannot declare a variable with two values as far as I know

$Life = 0x5C0000

$life2 = 0x18480C

PixelSearch( 735, 585 , 735, 585 ,$life )

If Not @Error Then

Sleep (2000)

Else

PixelSearch( 735, 585 , 735, 585 ,$life2 )

If Not @Error Then

Sleep (2000)

Endif


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

From what i understand, JohnOne's code does what you want, just reverse the If and Else conditions like this:

$Life = PixelGetColor(735, 585)

If $Life = 0x5C0000 Or $Life = 0x18480C Then

Sleep (2000)

Else

_somefunction()

Endif

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

$Life = "0x" & Hex(PixelGetColor(735, 585), 6)

If $Life = 0x5C0000 Or $Life = 0x18480C Then
    Sleep(2000)
Else
    _DoSomethingElse()
EndIf

:D

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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