trying to right a dps parser

E

Erik Blas

Hello everyone,

Basically what I'm trying to do is write an app that will read the
lines from a text file, parse through each lean with a regex (if there
is a better way please point me) for a time stamp/the words YOU|YOUR/
the words hit|hits/ the words miss|misses and finally an integer value
of varied character length, then do a calculation for dps (damage per
second: damage / seconds).

I guess the best way to explain would be to show you an example:
01:32:54 ] You start fighting.
01:32:54 ] Your target is too far! Move closer!
01:32:55 ] Bob hits a thingy for 6 points of crushing damage.
01:32:55 ] YOU hit a thingy for 8 points of slashing damage.
01:32:56 ] a thingy tries to crush Elipha, but misses.
01:32:57 ] Bob hits a thingy for 9 points of crushing damage.
01:32:57 ] YOUR Kick hits a thingy for 12 points of crushing damage.
01:32:57 ] YOU hit a thingy for 8 points of slashing damage.
01:32:58 ] You stop fighting.

I'd like for the app to start calculating from the point it sees the
string "You start fighing." and stop when it sees "You stop fighting."
..

The big things I need help with are:
1. the best way to get the time stamps so that the seconds could be
totaled (the time stamps come off the system so they won't start at
*:*:00 unless one is lucky when they start fighting :) ).

2. the best way to get the start and end strings like I stated above.

3. to keep it simple for now, just getting damage numbers from times
that YOU or YOUR strings show you've landed an attack. getting misses
is important to to show to keep the clock running i think to get an
accurate dps number.

That's all I can think of right now...my head is fried from trying to
come up with alot of this on my own. So far I've managed to get a nice
working regex to pull the time stamps:
(\d{2}):(\d{2}):(\d{2}) # let me know about this if there would
be a better way for what i want please :)

I'm still in the process of learning python and loving every minute of
it. Big thanks to the author of Dive into Python, I love that book! I
figured a project like this would be a good way to learn with its
complexity not being way to much. I also plan to extend this app later
with a gui using wxpython aswell as have it print dps numbers real
time during game play, but for now it's enough to get it to open the
log file/compute the dps/and print it to the screan. The game that
will be providing the log files is a windows game only atm though :/ .
Thank you in advanced for any help and advice you can provide.

- Erik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top