Jump to content
Sign in to follow this  
JD7

Checking for color change before proceeding

Recommended Posts

JD7

Ok I have a bar that starts off a manilla color as progress is made the bar begins to fill to a green color. I am wanting the script to loop until the bar is filled green to a certain point then stop looping and proceed to the next step I've tried using

$prg = PixelGetColor( 344 , 233 )
$prg3 = Hex(0x005A36, 6)
Func CraftB()
    Do
    Send("/craftingselectstep 5 {Enter}")
    sleep('1500')
    Send("/craftingselectaction 1 {Enter}")
    sleep('1500')
    Send("/craftingselectstep 4 {Enter}")
    sleep('1500')
    Send("/craftingselectaction 2 {Enter}")
    sleep('1500')
    Send("/craftingselectstep 3 {Enter}")
    sleep('1500')
    Send("/craftingselectaction 2 {Enter}")
    sleep('1500')
    Send("/craftingselectstep 2 {Enter}")
    sleep('1500')
    Send("/craftingselectaction 2 {Enter}")
    sleep('1500')
    Send("/craftingselectstep 1 {Enter}")
    sleep('1500')
    Send("/craftingselectaction 2 {Enter}")
    sleep('1500')
until $prg = $prg3
endfunc

I am a noob to autoit so I'm sure I've made an obvious noob mistake, if anyone would be willing to enlighten me please feel free =)

I can also be contacted via MSN/Windows Messenger jadeon_tyr@hotmail.com

Ty in advance

JD

Share this post


Link to post
Share on other sites
PsaltyDS

You don't call your function in the code you gave, and the value of $prg didn't get updated during the Do/Until loop. Here's a simplified re-write:

; Call the function:
_CraftB()
MsgBox(64, "Done", "Done")

Func _CraftB()
    Do
        ; Do stuff while waiting...
        sleep(100)
    Until PixelGetColor(344, 233) = 0x05A36
EndFunc

Also, AutoIT can deal with the hex value directly.

Cheers!

:shocked:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
JD7

You don't call your function in the code you gave, and the value of $prg didn't get updated during the Do/Until loop. Here's a simplified re-write:

; Call the function:
_CraftB()
MsgBox(64, "Done", "Done")

Func _CraftB()
    Do
        ; Do stuff while waiting...
        sleep(100)
    Until PixelGetColor(344, 233) = 0x05A36
EndFunc

Also, AutoIT can deal with the hex value directly.

Cheers!

:shocked:

the function is actually called via hotkeys in the program that was just a segment but ty i will try this soon.

Share this post


Link to post
Share on other sites
JD7

If i wanted to test that color did not exist would I not use the following?

Until PixelGetColor(419, 250) != 0xA49376

Share this post


Link to post
Share on other sites
PsaltyDS

If i wanted to test that color did not exist would I not use the following?

Until PixelGetColor(419, 250) != 0xA49376

Check out Operators key word in the index of the help file.

:shocked:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×