Before posting any MODs, please contact us at support@portalarium.com to ensure your MOD is acceptable to the Terms of Service and EULA of the game. Portalarium is not responsible for use of MODs and possible adverse effects on your client or computer, and we may take action on accounts using MODs that are deemed illegal. Whether submitted here or elsewhere in the community, use MODs at your own risk!

Powershell Chatlog to combat CSV converter

I have been writing a powershell script (windows scripting language) to input a chat log and it creates a structured CSV file of all the combat lines.
You can then do whatever analysis you want to the data in excel or other tool that can import CSVs.

@Chris It is noticeable that all buffs and debuffs are not in the log, it gives the words of power, but I think only for yourself and does not tell you who it was cast against (self or enemy)

In doing this i have the made RegExs for each of the types of line (i think i have them all now, but then i don't necessary have examples of them all)

I can send anyone the script if they want a copy, hit me up on discord, same name as here.

But otherwise you can copy the below post and save it into a file call CreateCombatCSV.ps1

Once you have done that you need to run it giving a chatlog file as input parameter. For those that know more about powershell you can also use the -verbose and see the lines for debugging. The output is put into the output pipeline so you can pipe it into other scripts if you like, but if that makes no sense to you it does not matter.

To run it you need start a powershell session in administrator mode.
-search cmd and right click command prompt and select run as administrator

Go to where you stored the script.
run powershell in the command prompt
- type powershell and press enter

Check you have rights to run the script, if not set the execution policy so you can
- type Get-ExecutionPolicy
if it says anything other than unrestrict you need to set to unrestricted, if it say unrestricted you can skip the next step.

You may want to remember the setting to put it back afterwards.
set policy to unrestricted
- type Set-ExecutionPolicy unrestricted

To get the chat log data into a CSV you invoke the script and give it the path and filename then pipe the output pipe into a file.
Replace .\ChatLogTest.txt with the path and filename of the chatlog you want to process.
Replace outputfilename.csv with whatever filename you want to call it. If no path is put it will be put the directory you are in in the powershell prompt.
- type .\CreateCombatCSV.ps1 .\ChatLogTesting.txt | Out-File outputfilename.csv

To put your execution policy back to what it was
- type Set-ExecutionPolicy <old value probably Restricted>

To exit type exit then type exit again, the first exit the powershell prompt the second exits the command prompt.

If you find lines that my script misses, could you send me a copy of the chat line, either reply here, or send it in discord. This is still a work in progress.

Note this ignores crafting lines on purpose, it would be better to create another script, as i think you would want different heading for your CSV for this.

Updated this (in the second post), not used it in a while, but it was noted that if you turn timestamps on in your chat then the chat log has the time twice, causing the subject to have a timestamp and the person.

The new regular expression will look for any number of character then do a greedy look for ]. greedy meaning it will continue consuming ] until the last match.