Jump to content

using array in if statements?


 Share

Recommended Posts

I am not sure why this doesn't work, when i run it the first msgbox shows me "Jon Jon" which means its a match but for some reason the IF statement wont pick it up.

Here is the code

$Log = @ScriptDir&"\Logger.ini"

Dim $sStr = FileRead(@scriptdir & "\test.txt")

Dim $sPatt = '(?i)\[[^]]*\]\s*(.*?)(?:hit|punche?|slashe?)s?.*?for\s*(\d+)'
Dim $aLines = StringSplit($sStr, @CRLF, 1)

Global $P1_Total = 0

For $i = 1 To $aLines[0]
    Local $aMatch = StringRegExp($aLines[$i], $sPatt, 1)
    If UBound($aMatch) = 2 Then
        $a = IniReadSection($Log, "Name")
        For $size=1 To $a[0][0]
            MsgBox("","",$a[$size][0]&" "&$aMatch[0])
            If $a[$size][0] = $aMatch[0] Then
                MsgBox("","","Match")
            EndIf
        Next
    EndIf
Next

Here is the FileRead(@scriptdir & "\test.txt"

[9:56:47 PM Jun 20 2009] Jon slash Dragon for 1252 points of damage.
[9:56:47 PM Jun 20 2009] Jon slash Dragon for 3252 points of damage.
[9:56:47 PM Jun 20 2009] jon2 slash Dragon for 21 points of damage.
[9:56:47 PM Jun 20 2009] jon2 slash Dragon for 54 points of damage.

Here is the ini (@ScriptDir&"\Logger.ini")

[Name]
Jon=3252
jon2=52
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...