Xav Posted February 1, 2010 Posted February 1, 2010 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
JohnOne Posted February 1, 2010 Posted February 1, 2010 $Life = PixelGetColor(735, 585) If $Life = 0x5C0000 Or $Life = 0x18480C Then _somefunction() Else Sleep (2000) Endif AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Xav Posted February 1, 2010 Author Posted February 1, 2010 $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
DustinBowers Posted February 1, 2010 Posted February 1, 2010 The else statement gives you the the opportunity to run the code you want if it doesnt detect the color.
JohnOne Posted February 1, 2010 Posted February 1, 2010 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.
DustinBowers Posted February 1, 2010 Posted February 1, 2010 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
AlmarM Posted February 1, 2010 Posted February 1, 2010 (edited) $Life = "0x" & Hex(PixelGetColor(735, 585), 6) If $Life = 0x5C0000 Or $Life = 0x18480C Then Sleep(2000) Else _DoSomethingElse() EndIf Edited February 1, 2010 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now