Jump to content

need help with do until


Recommended Posts

hello, can anyone help me with this?

tooltip( "checking mana")
PixelSearch( 0, 0, 1000, 800, 0x000095 );mana check
sleep(random(500, 700))
If Not @error Then
tooltip( "mana full")
sleep(random(500, 1000));if not full mana
else
tooltip( "I need mana")
sleep(random(100, 200));low mana, drink
send('-')
sleep(random(7000, 9000))
endIf
tooltip( "finding mob")
send('{tab}');find mob
sleep(random(500, 700))
PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );if mob selected
sleep(random(500, 700))
If Not @error Then;if mob found
tooltip( "mob found")
sleep(random(500, 1000))
send('1')
sleep(random(300, 600))
send('2')
sleep(random(10000, 15000))
$mobalive = PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );checks to see if mob is still alive
sleep(random(500, 700))
If Not @error Then
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))
EndIf
If $Loop = 1 Then 
Sleep(1000) 
Else 
ExitLoop 
EndIf 
EndIF

Im trying to loop this until the pixlesearch fails

$mobalive = PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );checks to see if mob is targeted/Alive
sleep(random(500, 700))
If Not @error Then
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))
Edited by will88
Link to comment
Share on other sites

Do

Until Not IsArray($mobalive)

thanks for the reply but,

I tried changing

$mobalive = PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );checks to see if mob is targeted/Alive
sleep(random(500, 700))
If Not @error Then
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))

to

$mobalive = PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );checks to see if mob is targeted/Alive
sleep(random(500, 700))
If Not @error Then
Do
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))
Until Not IsArray($mobalive)

and it kept doing

send('2')

and never went back to

tooltip( "checking mana")
PixelSearch( 0, 0, 1000, 800, 0x000095 );mana check
sleep(random(500, 700))
If Not @error Then
tooltip( "mana full")
sleep(random(500, 1000));if not full mana
else
tooltip( "I need mana")
sleep(random(100, 200));low mana, drink
send('-')
sleep(random(7000, 9000))
endIf
Link to comment
Share on other sites

Yes.

Do
;your code here
Until Not IsArray($mobalive)
as I said in my post, I changed it to

$mobalive = PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );checks to see if mob is targeted/Alive
sleep(random(500, 700))
If Not @error Then
Do
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))
Until Not IsArray($mobalive)

and it kept doing send('2') and never went back to the other part of the script when the color: 0xBDBA00 didnt exist.

Link to comment
Share on other sites

as I said in my post, I changed it to

$mobalive = PixelSearch( 0, 0, 1000, 800, 0xBDBA00 );checks to see if mob is targeted/Alive
sleep(random(500, 700))
If Not @error Then
Do
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))
Until Not IsArray($mobalive)

and it kept doing send('2') and never went back to the other part of the script when the color: 0xBDBA00 didnt exist.

You're not paying attention to the answer you already got: The only thing that changes $mobalive is your PixelSearch(). So the only way it's going to change is if you put that inside the Do/Until loop also.

:)

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
Link to comment
Share on other sites

You're not paying attention to the answer you already got: The only thing that changes $mobalive is your PixelSearch(). So the only way it's going to change is if you put that inside the Do/Until loop also.

:)

I am paying attention but if I do that I get an error that says:

until statement with no matching Do statement.

Do
$mobalive = PixelSearch( 0, 0, 1000, 800, 0x525100 );mob still alive?
sleep(random(500, 700))
If Not @error Then;if mob alive then
tooltip( "mob is still alive")
send('2')
sleep(random(2500, 3000))
Until Not IsArray($mobalive)
Link to comment
Share on other sites

If Not @error Then;if mob alive then

that was a note for me..If there wasnt an error then the color(the mob) still existed.

Anyways I figured it out by adding this:

Do
$mobalive = PixelSearch( 0, 0, 1000, 800, 0x525100 );mob still alive?
sleep(random(500, 700))
If @error Then
dead();mob is dead
Else
alive();mob still alive
tooltip( "mob still alive" )
EndIf
Until Not IsArray($mobalive)
EndIf

and

Func alive()
send('2')
sleep(random(3000, 5000))
EndFunc
Func dead()
$loop = 1
EndFunc

Thanks for the help.

Edited by will88
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...