Pages: [1]   Go Down
  Print  
Author Topic: Parsing a new log line  (Read 681 times) Bookmark and Share
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« on: December 13, 2011, 06:50:13 AM »

I have added a new log line to my UrT server that I would like to have B3 parse. Its pretty simple: "med: 0 1" The numbers being the healing client and healed client, respectively. First off, is it possible that I could do this through a plugin so I don't have to continually edit the parsers after each B3 update? If not, what is the best way to go about adding this and creating a B3 event for it? I'm no regexp genius, but I can probably get by with something this simple.

So yeah, what should I do?  Smiley

Thanks,
Leito
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #1 on: December 13, 2011, 11:57:59 AM »

If I were you I would make a new parser which inherits from the Iourt41Parser class to hold the differencies between the two game servers.

This kind of hierarchy is already used for all cod* games parsers so you can have a look at them to get started. If you block on a issue we can assist you.

If you are unfamiliar with python, I would greatly suggest that you use an IDE which understands python such as pydev or pycharm. Also to test your regular expressions, use Kodos. To try python snippets, use Dreampie or ipython.

I like your idea of having med logged. I can imaging this could be put in Xlrstats so players could have kind of medic achievements.

good luck.
« Last Edit: December 13, 2011, 12:00:06 PM by Courgette » Logged

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« Reply #2 on: December 13, 2011, 05:19:16 PM »

Thanks so much for this! I've just succeeded in adding the event to B3!  Grin  Although I added the event to iourt41. I would maybe rather have it in a separate file, but if its too crazy, I won't bother. The thing I had issues with in doing it was when I inherit the iourt41 parser class, how can I add a new re.compile() line to _lineFormats = ()? Can I do _lineFormats.append('new re.compile line here')?

Thanks again for your help Courgette!

Also, if I define variables that already exist in iourt41.py in my new parser, will they overwrite the original with my new, modified values?
« Last Edit: December 13, 2011, 05:24:57 PM by Leito » Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #3 on: December 13, 2011, 05:26:08 PM »

The simplest way to deal with _lineFormats is to copy over the whole block into your new parser.
Logged

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« Reply #4 on: December 13, 2011, 05:36:15 PM »

Awesome! Merci beaucoup monsieur!
Logged
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal