Jump to content

better way to do this instead of multiple nested if then loops


Seagul
 Share

Recommended Posts

If $result = 1 Then
    ;still looting
    Sleep(1000)
    If $result = 1 Then
        ;still looting
        Sleep(1000)
        If $result = 1 Then
            ;still looting
            Sleep(1000)
            If $result = 1 Then
                ;still looting
                Sleep(1000)
                If $result = 1 Then
                    ;still looting
                    Sleep(1000)
                    If $result = 1 Then
                        ;still looting
                        Sleep(1000)
                        If $result = 1 Then
                            ;still looting
                            Sleep(1000)
                            If $result = 1 Then
                                ;still looting
                                Sleep(1000)
                                If $result = 1 Then
                                    ;still looting
                                    Sleep(1000)
                                    If $result = 1 Then
                                        ;still looting
                                        Sleep(1000)
                                        If $result = 1 Then
                                            ;still looting
                                            Sleep(1000)
                                            If $result = 1 Then
                                                ;still looting
                                                Sleep(1000)
                                                If $result = 1 Then
                                                    ;still looting
                                                    Sleep(1000)
                                                    If $result = 1 Then
                                                        ;still looting
                                                        Sleep(1000)
                                                        If $result = 1 Then
                                                            ;still looting
                                                            Sleep(1000)
                                                        Else
                                                            Call("Logic")
                                                        EndIf
                                                    Else
                                                        Call("Logic")
                                                    EndIf
                                                Else
                                                    Call("Logic")
                                                EndIf
                                            Else
                                                Call("Logic")
                                            EndIf
                                        Else
                                            Call("Logic")
                                        EndIf
                                    Else
                                        Call("Logic")
                                    EndIf
                                Else
                                    Call("Logic")
                                EndIf
                            Else
                                Call("Logic")
                            EndIf
                        Else
                            Call("Logic")
                        EndIf
                    Else
                        Call("Logic")
                    EndIf
                Else
                    Call("Logic")
                EndIf
            Else
                Call("Logic")
            EndIf
        Else
            Call("Logic")
        EndIf
    Else
        Call("Logic")
    EndIf
Else
    Call("Logic")
EndIf

Link to comment
Share on other sites

I'm assuming what you're doing here is testing whether you're still looting, waiting one second, testing again, and so on, until you're not looting anymore.

Do
Sleep(1000)
;Call your function
$result = Logic()
Until $result <> 1

That's the Do, Until version. You could also use While, Wend, and even a For, Next loop.

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...