View Full Version : Simple MPR Parser
maczo
28th January 2006, 13:23
hi all,
i've written this simple parser to automate the process of creating results in a nice table. well, whether it is nice or not is arguable (depends on what you like - the output is plain text, although formatted properly [edit: now also output in comma-separated values "format"]). long story short - a small program for lazy people made by another lazy person (thats why it doesnt find racers who didnt finish the race) [edit: now it can!]. a good thing though is that you can use it in two ways:
1. parse a single mpr (race) file
2. parse a pair of mprs where one is from qual and the other from race (one combined table is generated then)
enjoy!
maczo
ps some help on usage is in the files "readme.txt" and "points.txt" - read carefully once and you should have no problems with using this
tristancliffe
28th January 2006, 14:00
Looks good, will give it a whirl.
kamo2000
28th January 2006, 22:29
I'm the laziest person in MPT..so it's a great help..and works fine for me.
Pinto_PT
31st January 2006, 02:47
Nice tool, would it be too much to ask to add the output as a csv file?
maczo
31st January 2006, 18:51
a what? :D
no, really, i don't know what a csv file is, so perhaps some hints?
Anarchi-H
31st January 2006, 18:57
http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm#Overview :thumb:
AndroidXP
31st January 2006, 18:58
comma seperated values
use either , or ; to seperate a bunch of... values
text1;text2;value1;value2;value3;cheatedWRtime1;et c1;etc2;etc3
maczo
31st January 2006, 19:07
ah, thanks. i think this isn't much work, BUT... as with finding the racers who didnt finish - it will have to wait for me to have some time. now it's student hunting season at uni ;) ... and then perhaps i'll do some skiing during the break.
ikkah
1st February 2006, 07:47
Don't want to steal your thread or anything, but here's my parser:
Executable: http://www.lfs-suomi.com/uploads/mpr-parse.exe
C++ source: http://www.lfs-suomi.com/uploads/mpr-parse.cpp
It can find drivers that didn't finish, with a few exceptions. It prints an ugly HTML-file that's supposed to look a bit like the results board in LFS. The code is a bit hacky, since I thought I'd never show it to anyone, but if you want to modify it for your own purposes, I'm not stopping you.
maczo
1st February 2006, 20:27
Don't want to steal your thread or anything
well i sure hope so. anyway mine is bigger :razz: erm... i mean better and tidyer and its output is NOT html :razz:
jk, hope everyone will choose what suits them most :thumb:
maczo
3rd February 2006, 21:40
ok, i had some time to improve the program. now it finds drivers who didnt finish and it also outputs in csv format (i hope :shrug: ). hope to see some feedback from you guys.
ikkah, are you sure you placed all lines of code referring to output? im quite convinced that your parser doesnt output drivers who didnt finish (although i dont doubt it FINDS them - stole some code btw, hope you dont mind :D ).
cheers,
maczo
P.S. new version in first post ofcourse
P.P.S question about csv - should i include all information like in .txt output (track name, no. of drivers, no. of laps) or should it only include row-by-row info starting from 1st racer?
ikkah
4th February 2006, 09:57
ikkah, are you sure you placed all lines of code referring to output? im quite convinced that your parser doesnt output drivers who didnt finish (although i dont doubt it FINDS them - stole some code btw, hope you dont mind :D ).
Hehe, whoops! It does find those drivers, but doesn't actually save them anywhere. Steal as much code as you want to, if it does good for the community, it does good for me :)
maczo
4th February 2006, 22:20
ok, once more i had to upload a new version due to some small bugs. get it from post 1, again. enjoy!
ikkah - so are you going to include this almost-implemented feature? ;) i think people would appreciate it
ikkah
5th February 2006, 14:21
Uhm, your parser does that now, right? If there's a parser doing that already, I don't see why I should add that feature to my parser. It's meant to imitate the results table in LFS anyway, and DNF drivers aren't listed there either.
maczo
5th February 2006, 17:14
well, yes it does, but someone might prefer to copy-paste the html code into his site rather than find out how to make the text table look good (multiple spaces problem) and then color it to fit his needs. you know, having a choice is usually better, and as for lfs tables functionality - its not bad to make something better, or at least making it meet popular needs :)
maczo
6th February 2006, 17:12
ok, today i hope the last update. i found one more situation in which some players might have been skipped by the parser, i also fixed a minor error in csv output.
i also would like to mention that i dont have enough replays to do decent testing, so if something goes wrong please let me know.
cheers,
maczo
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.