Jump to content
Sign in to follow this  
=sinister=

Loop not working after 1 pass

Recommended Posts

can you be a little more specific. Define not working. Do you know what line it is erroring on? Is there even an error?

Share this post


Link to post
Share on other sites

Lets say $i = 23. If I run the function, it returns "Bar2|3", after I try running the function again, it won't return anything.

Share this post


Link to post
Share on other sites

Lets say $i = 23. If I run the function, it returns "Bar2|3", after I try running the function again, it won't return anything.

Func CheckKey($Key)
    Local $PID = ProcessList($PathCheck)
    If ProcessExists($PathCheck) Then
        Local $DllInformation = _MemoryOpen($PID[1][1])
    Else
        Return -1
    EndIf
    Local $Read
    Local $Number = 0
    $Bar = ""
    $GetKey = StringSplit($Key, ",")
For $i = 1 To 72
    $Read = _MemoryRead($Address, $DllInformation, 'dword')
    If @Error Then
        Return -1
    ElseIf $GetKey[0] >= 1 Then
        Do
            $Number = $Number + 1
            If $Read = $GetKey[$Number] Then
                $GetBar = StringSplit($i, "")
                
            If $GetBar[0] = 2 Then
            ;Iregulars
                If $i = 11 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "-"
                    Return 1
                ElseIf $i = 12 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "="
                    Return 1
                ElseIf $i = 22 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & 0
                    Return 1
                ElseIf $i = 23 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "-"
                    Return 1
                ElseIf $i = 24 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "="
                    Return 1
                ElseIf $i = 34 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & 0
                    Return 1
                ElseIf $i = 35 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "-"
                    Return 1
                ElseIf $i = 36 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "="
                    Return 1
                ElseIf $i = 46 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & 0
                    Return 1
                ElseIf $i = 47 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "-"
                    Return 1
                ElseIf $i = 48 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "="
                    Return 1
                ElseIf $i = 58 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & 0
                    Return 1
                ElseIf $i = 59 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "-"
                    Return 1
                ElseIf $i = 60 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "="
                    Return 1
                ElseIf $i = 70 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & 0
                    Return 1
                ElseIf $i = 71 Then
                    $Bar = "Bar" & $GetBar[1] & "|" & "-"
                    Return 1
                ElseIf $i = 72 Then
                    $Bar = "Bar" & $GetBar[1] & "" & "="
                    Return 1
                Else
                    $Bar = "Bar" & $GetBar[1] & "|" & $GetBar[2]
                    Return 1
                EndIf
            EndIf
            EndIf
        Until $Number = $GetKey[0]
        $Number = 0
    EndIf
    $Address = "0x" & Hex(Execute($Address) + 4, 6)    
Next
    _MemoryClose($DllInformation)
EndFunc  ;==>CheckKey
Without some example that some could (or would even) run, there's no way to tell you what your issue is.

Logic would dictate that either:

If $Read = $GetKey[$Number] Then is never true on a second pass... or

$i never equals any of the condition statements you have there.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Logic dictates that I am stupid and forgot to restate at the beginning of the function what address to read from. At the bottom it was adding 4 to the address, but it never restates it so it will always add 4. =P

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  

×
×
  • Create New...