Jump to content

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


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

$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
Link to comment
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
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...