Jump to content

StringRegExp works / not works.. :(


Recommended Posts

Sorry me again, ran into a weird problem.

$as_dmg = StringRegExp($s_File, ' and hit for (.*?) ', 3)

$as_dmg[0] = UBound($as_dmg)

For $x = 1 To UBound($as_dmg, 1) -1
    $sum = $sum + $as_dmg[$x]
    ToolTip("Dmg this round: " & $as_dmg[$x] & " Loop: " & $x,0,0)
Next

MsgBox(0, "", "Total hits on monsters: " & $sum)

This above works great!

While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
        If StringRegExp($line, ' and hit for (.*?) ', 0) Then
        $as_dmg = StringRegExp($line, ' and hit for (.*?) ', 3)
EndIf
WEnd

    For $x = 1 To UBound($as_dmg, 1)
        $sum = $sum + $as_dmg[$x]
;ToolTip("Dmg this round: " & $as_dmg[$x] & " Loop: " & $x,0,0)
    Next

MsgBox(0, "", "Total dmg done: " & $sum)

This however doesnt work, even tho its basicly a copy of the example at top.

The string is found, i know that. But i cant add the arrays together to get a sum of them together. I probably should post the entire script... i just copied the broken part.

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Link to comment
Share on other sites

Sorry, think i solved it now :o

$Dmg = $as_dmg[0]

Was the missing link. Gonna see if i can keep on going without running into more problems hehe.

"I'm paper, rock is fine, nerf scissors!!!"

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