Sign in to follow this  
Followers 0
tom13

Do ... Until inside If ... EndIf ?

5 posts in this topic

Hi, I made this piece of code:

If $InsideBG = True Then ;If we are inside the battleground
Sleep(90000)
Send("{LCTRL 2}")
Sleep(200)
Send("{1}")
Sleep(1000)
Send("{LCTRL 2}")
Sleep(200)
Send("{1}")
Sleep(1000)
Send("{LCTRL 2}")
Sleep(200)
Send("{g}")
$Loop = 0
Do 
$Loop = $Loop + 1
Sleep(random(2500,3000))
Send("{z}")
StatusCheck()
Until $InsideBG = False or $Dead = True or $Loop = 15
EndIf

As you can see there is a do ... until inside a if ... endif, when I start my script it gives an error, If I remove the do ... until part there is no error anymore.

Does anyone knows why this error occurs?

Thanks in advance.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Func _SomeStupidFuncName()
$Loop = $Loop + 1
Sleep(random(2500,3000))
Send("{z}")
StatusCheck()
If $InsideBG = False or $Dead = True or $Loop = 15 Then AdlibDisable()
EndFuncoÝ÷ Ù©Ýjëh×6If $InsideBG = True Then ;If we are inside the battleground
Sleep(90000)
Send("{LCTRL 2}")
Sleep(200)
Send("{1}")
Sleep(1000)
Send("{LCTRL 2}")
Sleep(200)
Send("{1}")
Sleep(1000)
Send("{LCTRL 2}")
Sleep(200)
Send("{g}")
$Loop = 0
AdlibEnable("_SomeStupidFuncName",100) ;change the number which fits you best.
EndIf

Edited by i542

I can do signature me.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$InsideBG = True
$Loop = 0
$Dead = False
If $InsideBG = True Then ;If we are inside the battleground
Sleep(90000)
Send("{LCTRL 2}")
Sleep(200)
Send("{1}")
Sleep(1000)
Send("{LCTRL 2}")
Sleep(200)
Send("{1}")
Sleep(1000)
Send("{LCTRL 2}")
Sleep(200)
Send("{g}")
$Loop = 0
Do
$Loop = $Loop + 1
Sleep(random(2500,3000))
Send("{z}")
;StatusCheck()
Until $InsideBG = False or $Dead = True or $Loop = 15
EndIf

This works for me....No Errors

Edited by Kogmedia

[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search

Share this post


Link to post
Share on other sites

How can you have this condition when the outer IF condition always has to be true?

Until $InsideBG = False

Share this post


Link to post
Share on other sites

How can you have this condition when the outer IF condition always has to be true?

Until $InsideBG = False

The StatusCheck() function might be changing the state of that flag.

As for the Do/Until loop, I don't see the problem. Perhaps you should be using "random(2500,3000, 1)" to get an integer result, but I don't know that non-integer inputs cause errors for Sleep().

:rolleyes:


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  
Followers 0