473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

trying to right a dps parser

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
Jul 18 '05 #1
0 1152

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jean de Largentaye | last post by:
Hi, I need to parse a subset of C (a header file), and generate some unit tests for the functions listed in it. I thus need to parse the code, then rewrite function calls with wrong parameters....
1
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
9
by: florent | last post by:
I'm trying to parse html documents from the web, using the HTMLParser class of the HTMLParser module (python 2.3), but some web documents are not fully valids. When the parser finds an invalid tag,...
7
by: beza1e1 | last post by:
I'm writing a parser for english language. This is a simple function to identify, what kind of sentence we have. Do you think, this class wrapping is right to represent the result of the function?...
4
by: siddharthkhare | last post by:
Hi All, I need to parse certain text from a paragraph (like 20 lines). I know the exact tags that I am looking for. my approach is to define a xml (config) file that defines what tag I am...
0
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): ...
4
by: manu | last post by:
Hi, I need to parse xml files for the Blender Game Engine. ATM I am trying to get this script running in the BGE. This is my first script and I dont have much experience programming... import...
16
by: news | last post by:
I'm trying to parse an XML formatted post reply, and I can't figure out how to get the value of the right tag. The XML is formatted like this: <A> <foo>val1</foo> </A> <B> <foo>val2</foo>...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.