Jump to content

Completely stumped


JoshDB
 Share

Recommended Posts

Hey guys.

Alright, here's the deal: I am utterly clueless. Wait, Jimmy, don't close this thread yet! Read on a little bit!

I've made a great GUI with great functionality. Everything on it works except a pie chart. What stumps me is that it was working. I saved the file. Then when I re-opened it, it's not working! It doesn't refresh with the rest of the window unless it's dragged offscreen or another window in dragged over it, so it's clearly being updated. It's just not being shown for some reason.

Egads!

Here's my code:

Skin files are located here

#include <Array.au3>
#include <XSkin.au3> 
#include <File.au3>

HotKeySet("{F1}","ChangeLog")
HotKeySet("{F2}","ClearLog")

DirCreate(@ScriptDir & "\Skins\Parser")

FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser.bmp",@ScriptDir & "\Skins\Parser.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\1.bmp",@ScriptDir & "\Skins\Parser\1.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\2.bmp",@ScriptDir & "\Skins\Parser\2.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\3.bmp",@ScriptDir & "\Skins\Parser\3.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\4.bmp",@ScriptDir & "\Skins\Parser\4.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\5.bmp",@ScriptDir & "\Skins\Parser\5.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\6.bmp",@ScriptDir & "\Skins\Parser\6.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\7.bmp",@ScriptDir & "\Skins\Parser\7.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\skin.dat",@ScriptDir & "\Skins\Parser\skin.dat")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\Standard1.bmp",@ScriptDir & "\Skins\Parser\Standard1.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\Standard2.bmp",@ScriptDir & "\Skins\Parser\Standard2.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\Standard3.bmp",@ScriptDir & "\Skins\Parser\Standard3.bmp")

; folder of skin
$Skin_Folder = @ScriptDir & "\Skins\Parser"

$XSkinGui = XSkinGUICreate("Parser", 500, 300, $Skin_Folder)

$Icon_Folder = @ScriptDir & "\Skins\Parser"
$XIcon = XSkinIcon($XSkinGui, 3)

;SETUP INFO

$hostcharacter = 'Your Character'

Global $_name[101]
Global $_damage[101]
Global $_dps[101]
Global $_average[101]
Global $_time[101]
Global $_count[101]

Global $_guiname[101]
Global $_guidps[101]
Global $_guiaverage[101]
Global $_guidamage[101]
Global $_guitime[101]

$minutereference = 61
$secondreference = 61

; RANDOM VARIABLES
$_equation1 = 0
$_equation2 = 0
$lastreadline = 1
$preferences = @ScriptDir & '\Dock.preferences'

;FILE INFO
$log = IniRead($preferences,'parser','log','')

GUISetBkColor(0xE8E8E8)

GUICtrlCreateLabel('Player',15,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guiname[$i] = GUICtrlCreateLabel(' ',25,80+12*$i-1,60)
Next

GUICtrlCreateLabel('DPS',75,74,30,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guidps[$i] = GUICtrlCreateLabel(' ',85,80+12*$i-1,60)
Next

GUICtrlCreateLabel('Average',115,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guiaverage[$i] = GUICtrlCreateLabel(' ',125,80+12*$i-1,60)
Next

GUICtrlCreateLabel('Total',205,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guidamage[$i] = GUICtrlCreateLabel(' ',215,80+12*$i-1,60)
Next

GUICtrlCreateLabel('Time',255,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guitime[$i] = GUICtrlCreateLabel(' ',265,80+12*$i-1,60)
Next

GUICtrlCreateLabel('press F1 to change the log file being parsed',315,54,200,14)
GUICtrlSetFont(-1,7,400)
GUICtrlCreateLabel('press F2 to clear the current log file',349,64,200,14)
GUICtrlSetFont(-1,7,400)

$highest = GUICtrlCreateLabel('',190,235,300,14,$SS_RIGHT)
GUICtrlSetFont(-1,9,800)

$Pie = GUICtrlCreateGraphic(350, 140, 100,100)
GUICtrlSetStyle($Pie, $SS_NOTIFY)

GUISetBkColor(0xD3D3D7)

If FileExists($log) Then
    $file = FileOpen($log, 0)

    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
Else
    MsgBox(0,'Notification','Please select the log file you wish to parse.')
    $log = FileOpenDialog("File Browser","C:\Program Files\Sony\Everquest II\logs\","TXT File (*.txt)",3)
    
    If FileExists($log) Then
        IniWrite($preferences,'parser','log',$log)
    
        $file = FileOpen($log, 0)
        
        If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf
    Else
        $file = 'nil'
    EndIf
EndIf

Do
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $XIcon[1]
            Exit
        Case $msg = $XIcon[2]
            WinSetState("Dock",'',@SW_MINIMIZE)
        Case $msg = $XIcon[3]
            MsgBox(0,'Help File','To use this bot, first log in in-game.  Go to a gambling vendor and talk to him.  Then press "Start Gambling".  You have five seconds after EQ2 becomes the active window before the bot begins to pause your mouse over the "Buy" button.  The bot will start buying tickets for an infinite amount of time (relative to your money).  Stop the bot by pressing ESC.')
    EndSelect
    
    If FileExists($log) Then
        If $file = 'nil' Then
            $file = FileOpen($log, 0)

            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open file.")
                Exit
            EndIf
        EndIf
        
        Parse()
    EndIf
Until $msg = $GUI_EVENT_CLOSE

FileClose($file)

Func Parse()
    While 1
        $line = FileReadLine($file,$lastreadline)
        If @error = -1 Then ExitLoop
        $lastreadline = $lastreadline + 1
        
        If IsCombat($line) Then Report($line)
    Wend
EndFunc

Func IsCombat($str)
    If StringInStr($str, ' says in ') Then Return 0
    If StringInStr($str, ' says, ') Then Return 0
    If StringInStr($str, ' says to ') Then Return 0
    If StringInStr($str, ' says out ') Then Return 0
    If StringInStr($str, ' tells ') Then Return 0
    If StringInStr($str, ' shouts in ') Then Return 0
    If StringInStr($str, ' damage ') Then Return 1
    If StringInStr($str, ' hits ') Then Return 1
EndFunc

Func Report($str)
    $time = StringTrimRight(StringTrimLeft($str,StringInStr($str,':') - 2),StringLen($str) - StringInStr($str,']') + 6)
    
    $hour = StringMid($time,0,2)
    $minute = StringMid($time,3,2)
    $second = StringMid($time,6,2)
    
    $playername = StringTrimLeft($str,StringInStr($str,']') + 1)
    
    If StringInStr($playername,'YOU') Then
        If StringInStr($playername,'YOU hit') Or StringInStr($playername,'YOU critically hit') Or StringInStr($playername,'YOUR') Then
            $playername = $hostcharacter
        EndIf
    Else
        If StringInStr($playername,"'") Then
            $playername = StringTrimRight($playername,StringLen($playername) - StringInStr($playername,"'",0,1) + 1)
        Else
            $playername = StringTrimRight($playername,StringLen($playername) - StringInStr($playername," ",0,1) + 1)
        EndIf
    EndIf
    
    If IsCharacter($playername) Then
        If $minutereference > 60 Then $minutereference = $minute
        If $secondreference > 60 Then $secondreference = $second
        
        If $minutereference <> $minute Then
            $minutereference = $minute
            $secondreference = $second
        EndIf
        
        $NamePos = _ArraySearch ($_name, $playername)
        
        If $NamePos <= 0 Then
            $_name[0] = $_name[0] + 1
            $_name[$_name[0]] = $playername
            $NamePos = $_name[0]
            GUICtrlSetData($_guiname[$NamePos],$playername )
        EndIf
        
        If $_time[$NamePos] = 0 Then $_time[$NamePos] = 1
        
        $_count[$NamePos] = $_count[$NamePos] + 1
        $_damage[$NamePos] = $_damage[$NamePos] + Damage($str)
        $_damage[0] = $_damage[0] + Damage($str)
        If $_damage[$NamePos] > $_time[0] Then $_time[0] = $_damage[$NamePos]
        $_time[$NamePos] = $_time[$NamePos] + $second - $secondreference
        $_average[$NamePos] = Round($_damage[$NamePos] / $_count[$NamePos])
        $_dps[$NamePos] = Round($_damage[$NamePos] / $_time[$NamePos])
        GUICtrlSetData($_guidps[$NamePos],$_dps[$NamePos])
        GUICtrlSetData($_guiaverage[$NamePos],$_average[$NamePos])
        GUICtrlSetData($_guidamage[$NamePos],$_damage[$NamePos])
        GUICtrlSetData($_guitime[$NamePos],$_time[$NamePos])
    
        If $_damage[$NamePos] >= $_time[0] Then
            $equation1 = $_damage[0] - $_damage[$NamePos] / $_damage[0]
            $equation2 = $_damage[$NamePos] / $_damage[0]
                
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0x69696B,0x000000)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,360*$equation1,360*$equation2)
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0xE9E9EB, 0xffffff)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,0,360*$equation1)
        
            GUICtrlSetData($highest,'Most damage: ' & $playername & ' (' & Round($equation2*100) & '%)')
        Else
            $TopPos = _ArraySearch ($_name, StringMid(GUICtrlRead($highest),14,StringInStr(GUICtrlRead($highest),'(')-15))
        
            $equation1 = $_damage[0] - $_damage[$TopPos] / $_damage[0]
            $equation2 = $_damage[$TopPos] / $_damage[0]
                
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0x69696B,0x000000)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,360*$equation1,360*$equation2)
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0xE9E9EB, 0xffffff)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,0,360*$equation1)
            
            GUICtrlSetData($highest,'Most damage: ' & StringMid(GUICtrlRead($highest),14,StringInStr(GUICtrlRead($highest),'(')-15) & ' (' & Round($equation2*100) & '%)')
        EndIf
        
        Sleep(10)
        
        GUISetState()
        
        If $secondreference <> $second Then
            $secondreference = $second
        EndIf
    EndIf
EndFunc

Func IsCharacter($str)
    If StringCount($str,' ') > 1 Then Return 0
    
    If Asc(StringLeft($str,1)) > 65 AND Asc(StringLeft($str,1)) < 90 Then Return 1
    
    Return 0
EndFunc

Func Damage($str)
    $damage = StringTrimLeft($str,StringInStr($str,'for') + 3)
    $damage = StringLeft($damage,StringInStr($damage,' ') - 1)
    
    Return $damage
EndFunc

Func StringCount($Si,$Sf)
    If StringLen($Sf)<1 Then Exit
    $ts = StringSplit(StringReplace($Si,$Sf,chr(01)),chr(01))
    Return($ts[0]-1)
EndFunc

Func ChangeLog()
    MsgBox(0,'Notification','Please select the log file you wish to parse.')
    $log = FileOpenDialog("File Browser","C:\Program Files\Sony\Everquest II\logs\","TXT File (*.txt)",3)
    
    If FileExists($log) Then
        IniWrite($preferences,'parser','log',$log)
    
        If @Compiled = 1 Then
            Run( FileGetShortName(@ScriptFullPath))
        Else
            Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
        EndIf
        
        Exit
    Else
        MsgBox(0,'Error',"That file doesn't exist!")
    EndIf
EndFunc

Func ClearLog()
    FileClose($file)
    
    If WinExists("Everquest") Then
        WinActivate("Everquest")
        Send("{ENTER}/log{ENTER}")
        FileDelete(IniRead($preferences,'parser','log',$log))
        Send("{ENTER}/log{ENTER}")
    Else
        FileDelete(IniRead($preferences,'parser','log',$log))
    EndIf
    
    _FileCreate(IniRead($preferences,'parser','log',$log))
    
    If @Compiled = 1 Then
        Run( FileGetShortName(@ScriptFullPath))
    Else
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    
    Exit
EndFunc

And, if you have no EQ2 log of your own, here's a sample:

Save as .txt

(1166557450)[Tue Dec 19 13:44:10 2006] Player1 hits Pluckito for 73 piercing damage.
(1166557450)[Tue Dec 19 13:44:10 2006] Player2 hits Pluckito for 91 piercing damage.
(1166557450)[Tue Dec 19 13:44:10 2006] Player1 hits Pluckito for 37 piercing damage.
(1166557093)[Tue Dec 19 13:38:13 2006] YOUR Shanghai hits a spirited orb for 251 slashing damage.

Please oh please oh please help me out!

I weep :P

Edited by JoshDB
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Link to comment
Share on other sites

Oh dear sweet mother of God, Valuater.

You're my saviour.

$GUI_SHOW worked for me. Thanks a bunch!

Now then... I wonder why it worked before I closed it?

Maybe I switched something around... Bah...

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Link to comment
Share on other sites

I will. It's not entirely finished, though, and as you can see it's titled incorrectly. It should be 'parser'. But this is all part of a bigger project, so I'll post that.

If anyone's interested, here's the code after being fixed and tweaked about:

#include <Array.au3>
#include <XSkin.au3> 
#include <File.au3>

HotKeySet("{F1}","ChangeLog")
HotKeySet("{F2}","ClearLog")

DirCreate(@ScriptDir & "\Skins\Parser")

FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser.bmp",@ScriptDir & "\Skins\Parser.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\1.bmp",@ScriptDir & "\Skins\Parser\1.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\2.bmp",@ScriptDir & "\Skins\Parser\2.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\3.bmp",@ScriptDir & "\Skins\Parser\3.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\4.bmp",@ScriptDir & "\Skins\Parser\4.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\5.bmp",@ScriptDir & "\Skins\Parser\5.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\6.bmp",@ScriptDir & "\Skins\Parser\6.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\7.bmp",@ScriptDir & "\Skins\Parser\7.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\skin.dat",@ScriptDir & "\Skins\Parser\skin.dat")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\Standard1.bmp",@ScriptDir & "\Skins\Parser\Standard1.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\Standard2.bmp",@ScriptDir & "\Skins\Parser\Standard2.bmp")
FileInstall("C:\Documents and Settings\Josh\My Documents\Programs\Dock\Dist\Skins\Parser\Standard3.bmp",@ScriptDir & "\Skins\Parser\Standard3.bmp")

; folder of skin
$Skin_Folder = @ScriptDir & "\Skins\Parser"

$XSkinGui = XSkinGUICreate("Parser", 500, 300, $Skin_Folder)

$Icon_Folder = @ScriptDir & "\Skins\Parser"
$XIcon = XSkinIcon($XSkinGui, 3)

;SETUP INFO

$hostcharacter = 'Your Character'

Global $_name[101]
Global $_damage[101]
Global $_dps[101]
Global $_average[101]
Global $_time[101]
Global $_count[101]

Global $_guiname[101]
Global $_guidps[101]
Global $_guiaverage[101]
Global $_guidamage[101]
Global $_guitime[101]

$minutereference = 61
$secondreference = 61

; RANDOM VARIABLES
$_equation1 = 0
$_equation2 = 0
$preferences = @ScriptDir & '\Dock.preferences'
$lastreadline = iniread($preferences,'parser','lastreadline',1)

;FILE INFO
$log = IniRead($preferences,'parser','log','')

GUISetBkColor(0xE8E8E8)

GUICtrlCreateLabel('Player',15,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guiname[$i] = GUICtrlCreateLabel(' ',25,80+12*$i-1,60)
Next

GUICtrlCreateLabel('DPS',75,74,30,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guidps[$i] = GUICtrlCreateLabel(' ',85,80+12*$i-1,60)
Next

GUICtrlCreateLabel('Average',115,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guiaverage[$i] = GUICtrlCreateLabel(' ',125,80+12*$i-1,60)
Next

GUICtrlCreateLabel('Total',205,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guidamage[$i] = GUICtrlCreateLabel(' ',215,80+12*$i-1,60)
Next

GUICtrlCreateLabel('Time',255,74,100,14)
GUICtrlSetFont(-1,9,800)
For $i = 1 To 12
    $_guitime[$i] = GUICtrlCreateLabel(' ',265,80+12*$i-1,60)
Next

GUICtrlCreateLabel('press F1 to change the log file being parsed',315,54,200,14)
GUICtrlSetFont(-1,7,400)
GUICtrlCreateLabel('press F2 to clear the current log file',349,64,200,14)
GUICtrlSetFont(-1,7,400)

$highest = GUICtrlCreateLabel('',190,235,300,14,$SS_RIGHT)
GUICtrlSetFont(-1,9,800)

$Pie = GUICtrlCreateGraphic(350, 140, 100,100)
GUICtrlSetStyle($Pie, $SS_NOTIFY)
GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0x69696B,0x000000)
GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,0,180)
GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0xE9E9EB, 0xffffff)
GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,180,180)

GUISetState()

WinMove('Parser','',IniRead($preferences,'parser','x',@DesktopWidth/2),IniRead($preferences,'parser','y',@DesktopHeight/2))

GUISetBkColor(0xD3D3D7)

If FileExists($log) Then
    $file = FileOpen($log, 0)

    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
Else
    MsgBox(0,'Notification','Please select the log file you wish to parse.')
    $log = FileOpenDialog("File Browser","C:\Program Files\Sony\Everquest II\logs\","TXT File (*.txt)",3)
    
    If FileExists($log) Then
        IniWrite($preferences,'parser','log',$log)
    
        $file = FileOpen($log, 0)
        
        If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf
    Else
        $file = 'nil'
    EndIf
EndIf

Do
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $XIcon[1]
            IniDelete('Dock.preferences','parser','x')
            IniDelete('Dock.preferences','parser','y')
            Exit
        Case $msg = $XIcon[2]
            WinSetState("Dock",'',@SW_MINIMIZE)
        Case $msg = $XIcon[3]
            MsgBox(0,'Help File','To use this bot, first log in in-game.  Go to a gambling vendor and talk to him.  Then press "Start Gambling".  You have five seconds after EQ2 becomes the active window before the bot begins to pause your mouse over the "Buy" button.  The bot will start buying tickets for an infinite amount of time (relative to your money).  Stop the bot by pressing ESC.')
    EndSelect
    
    If FileExists($log) Then
        If $file = 'nil' Then
            $file = FileOpen($log, 0)

            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open file.")
                Exit
            EndIf
        EndIf
        
        Parse()
    EndIf
Until $msg = $GUI_EVENT_CLOSE

FileClose($file)

Func Parse()
    While 1
        $line = FileReadLine($file,$lastreadline)
        If @error = -1 Then ExitLoop
        $lastreadline = $lastreadline + 1
        
        If IsCombat($line) Then Report($line)
    Wend
EndFunc

Func IsCombat($str)
    If StringInStr($str, ' says in ') Then Return 0
    If StringInStr($str, ' says, ') Then Return 0
    If StringInStr($str, ' says to ') Then Return 0
    If StringInStr($str, ' says out ') Then Return 0
    If StringInStr($str, ' tells ') Then Return 0
    If StringInStr($str, ' shouts in ') Then Return 0
    If StringInStr($str, ' damage ') Then Return 1
    If StringInStr($str, ' hits ') Then Return 1
EndFunc

Func Report($str)
    $time = StringTrimRight(StringTrimLeft($str,StringInStr($str,':') - 2),StringLen($str) - StringInStr($str,']') + 6)
    
    $hour = StringMid($time,0,2)
    $minute = StringMid($time,3,2)
    $second = StringMid($time,6,2)
    
    $playername = StringTrimLeft($str,StringInStr($str,']') + 1)
    
    If StringInStr($playername,'YOU') Then
        If StringInStr($playername,'YOU hit') Or StringInStr($playername,'YOU critically hit') Or StringInStr($playername,'YOUR') Then
            $playername = $hostcharacter
        EndIf
    Else
        If StringInStr($playername,"'") Then
            $playername = StringTrimRight($playername,StringLen($playername) - StringInStr($playername,"'",0,1) + 1)
        Else
            $playername = StringTrimRight($playername,StringLen($playername) - StringInStr($playername," ",0,1) + 1)
        EndIf
    EndIf
    
    If IsCharacter($playername) Then
        If $minutereference > 60 Then $minutereference = $minute
        If $secondreference > 60 Then $secondreference = $second
        
        If $minutereference <> $minute Then
            $minutereference = $minute
            $secondreference = $second
        EndIf
        
        $NamePos = _ArraySearch ($_name, $playername)
        
        If $NamePos <= 0 Then
            $_name[0] = $_name[0] + 1
            $_name[$_name[0]] = $playername
            $NamePos = $_name[0]
            GUICtrlSetData($_guiname[$NamePos],$playername )
        EndIf
        
        If $_time[$NamePos] = 0 Then $_time[$NamePos] = 1
        
        $_count[$NamePos] = $_count[$NamePos] + 1
        $_damage[$NamePos] = $_damage[$NamePos] + Damage($str)
        $_damage[0] = $_damage[0] + Damage($str)
        If $_damage[$NamePos] > $_time[0] Then $_time[0] = $_damage[$NamePos]
        $_time[$NamePos] = $_time[$NamePos] + $second - $secondreference
        $_average[$NamePos] = Round($_damage[$NamePos] / $_count[$NamePos])
        $_dps[$NamePos] = Round($_damage[$NamePos] / $_time[$NamePos])
        GUICtrlSetData($_guidps[$NamePos],$_dps[$NamePos])
        GUICtrlSetData($_guiaverage[$NamePos],$_average[$NamePos])
        GUICtrlSetData($_guidamage[$NamePos],$_damage[$NamePos])
        GUICtrlSetData($_guitime[$NamePos],$_time[$NamePos])
    
        If $_damage[$NamePos] >= $_time[0] Then
            $equation1 = $_damage[0] - $_damage[$NamePos] / $_damage[0]
            $equation2 = $_damage[$NamePos] / $_damage[0]
                
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0x69696B,0x000000)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,360*$equation1,360*$equation2)
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0xE9E9EB, 0xffffff)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,0,360*$equation1)
        
            GUICtrlSetData($highest,'Most damage: ' & $playername & ' (' & Round($equation2*100) & '%)')
        Else
            $TopPos = _ArraySearch ($_name, StringMid(GUICtrlRead($highest),14,StringInStr(GUICtrlRead($highest),'(')-15))
        
            $equation1 = $_damage[0] - $_damage[$TopPos] / $_damage[0]
            $equation2 = $_damage[$TopPos] / $_damage[0]
                
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0x69696B,0x000000)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,360*$equation1,360*$equation2)
            GUICtrlSetGraphic($Pie,$GUI_GR_COLOR, 0xE9E9EB, 0xffffff)
            GUICtrlSetGraphic($Pie,$GUI_GR_PIE, 50,50, 40,0,360*$equation1)
            
            GUICtrlSetData($highest,'Most damage: ' & StringMid(GUICtrlRead($highest),14,StringInStr(GUICtrlRead($highest),'(')-15) & ' (' & Round($equation2*100) & '%)')
        EndIf
        
        GUICtrlSetState( $pie, $GUI_SHOW)
        
        If $secondreference <> $second Then
            $secondreference = $second
        EndIf
    EndIf
EndFunc

Func IsCharacter($str)
    If StringCount($str,' ') > 1 Then Return 0
    
    If Asc(StringLeft($str,1)) > 65 AND Asc(StringLeft($str,1)) < 90 Then Return 1
    
    Return 0
EndFunc

Func Damage($str)
    $damage = StringTrimLeft($str,StringInStr($str,'for') + 3)
    $damage = StringLeft($damage,StringInStr($damage,' ') - 1)
    
    Return $damage
EndFunc

Func StringCount($Si,$Sf)
    If StringLen($Sf)<1 Then Exit
    $ts = StringSplit(StringReplace($Si,$Sf,chr(01)),chr(01))
    Return($ts[0]-1)
EndFunc

Func ChangeLog()
    MsgBox(0,'Notification','Please select the log file you wish to parse.')
    $log = FileOpenDialog("File Browser","C:\Program Files\Sony\Everquest II\logs\","TXT File (*.txt)",3)
    
    If FileExists($log) Then
        IniWrite($preferences,'parser','log',$log)
        
        $pos = WinGetPos('Parser')
        IniWrite('Dock.preferences','parser','x',$pos[0])
        IniWrite('Dock.preferences','parser','y',$pos[1])
    
        If @Compiled = 1 Then
            Run( FileGetShortName(@ScriptFullPath))
        Else
            Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
        EndIf
        
        Exit
    Else
        MsgBox(0,'Error',"That file doesn't exist!")
    EndIf
EndFunc

Func ClearLog()
    FileClose($file)
    
    IniWrite('Dock.preferences','parser','lastreadline',$lastreadline)
    $pos = WinGetPos('Parser')
    IniWrite('Dock.preferences','parser','x',$pos[0])
    IniWrite('Dock.preferences','parser','y',$pos[1])
    
    If @Compiled = 1 Then
        Run( FileGetShortName(@ScriptFullPath))
    Else
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    
    Exit
EndFunc
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
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...