Jump to content

Correct Do...Until?


 Share

Recommended Posts

Hi Guys,

Is this Do Until function proper? It seems like when it hits the sleep(1000) it just moves on past the until. Just wondering if my $FullStamina is the problem or the do until. Here is a part of my script.

$FullStamina = PixelSearch(185, 287, 195, 295, 0xCCA028, 1)

Func LowHealth()

$LowLife = Pixelsearch(1728, 43, 1738, 52, 0x741A1A, 1)

If @error Then

sleep(1000)

send("o");shieth

sleep(3000)

send("b");toggle rest

sleep(1000)

send("u");trigger rest

sleep(1000)

send("b");toggle rest

sleep(1000)

send("u");trigger rest

Do

sleep(1000)

Until $FullStamina

send("{SPACE}");stand up

sleep(4000)

send("{F9}");sends a command to other computer

sleep(2000)

send("o");unshieth

sleep(1000)

EndIf

EndFunc

Link to comment
Share on other sites

Sounded like it would work, but to no avail. Anyone have any other suggestions? It seems simple enough, I don't know why it doesn't work. This is my first DO Until loop though so I haven't ever used it.

Since you didn't post the attempt you made I'm gonna take a guess at what went wrong and offer a solution.

$FullStamina = PixelSearch(185, 287, 195, 295, 0xCCA028, 1)

Func LowHealth()
$LowLife = Pixelsearch(1728, 43, 1738, 52, 0x741A1A, 1)
If @error Then
sleep(1000)
send("o");shieth
sleep(3000)
send("b");toggle rest
sleep(1000)
send("u");trigger rest
sleep(1000)
send("b");toggle rest
sleep(1000)
send("u");trigger rest
Do
$FullStamina = PixelSearch(185, 287, 195, 295, 0xCCA028, 1)
If IsArray($FullStamina) Then $FullStamina[2] = 1
Sleep(1000)
Until $FullStamina[2] = 1
send("{SPACE}");stand up
sleep(4000)
send("{F9}");sends a command to other computer
sleep(2000)
send("o");unshieth
sleep(1000)
EndIf
EndFunc

This is of course only one way of doing it. I'm guessing you put the pixelsearch in the Do Until loop but forgot to test it for @error. I purposely chose to use a method you haven't used here yet in case you've never seen it. Always nice to learn something new.

Edited by jebus495
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...