[Crossfire-wiki] [Crossfire DokuWiki] page changed: user:katia:chatlog.py

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Sun Sep 30 18:14:09 CDT 2012


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2012/09/30 18:14
User        : katia
Edit Summary: Added filter for resistance messages when loging chat

@@ -25,9 +25,9 @@
  This script isn't perfect either. Since It's color based, it will log some kind of messages not related to communication. 
  
  For instance, since it logs red messages, it will log when you gain or loose a level at some skill or overall (may be good, may be bad, I like it myself :-)). 
  
- Since it logs Sky Blue messages, it will log when you gain or loose resistances. 
+ Since it logs Sky Blue messages, it will log when you gain or loose resistances. EDIT: this got fixed.
  
  Since it logs uncolored messages with the string ' killed ' in it, it will log messages as 'You killed goblin with ...' (it may get annoying at some point, but not quite as having the whole bunch of messages telling you hit the monster before killing it).
  
  
@@ -55,8 +55,9 @@
    def draw_monitor(colors=['1','3','4','5','6'], deaths=True): #default for player communication/in/out colors
        putline('watch drawinfo')
        do_write=False
        last_date = False
+       filter_resists = ('5' in colors)
        while True:
            read = sys.stdin.readline()
            for l in read.split('\n'):
                if l != '':
@@ -64,8 +65,10 @@
                    d = datetime.now().strftime('%d-%m-%Y')
                    t = datetime.now().strftime('%H:%M:%S')
                    if l[:14] == 'watch drawinfo':
                        do_write = (l[15] in colors or (deaths and l[15] == '0' and l[17:].find(' killed ')>0))
+                       if do_write and filter_resists and l[15] == '5':
+                           do_write = (l[17:36]!=('Your resistance to ')) #filter resistance messages
                        if do_write:
                            if not last_date or last_date != d:
                                last_date = d
                                chatlog.write('%s\n' % d)


IP-Address  : 186.52.69.211
Old Revision: http://wiki.metalforge.net/doku.php/user:katia:chatlog.py?rev=1349016011
New Revision: http://wiki.metalforge.net/doku.php/user:katia:chatlog.py

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/



More information about the crossfire-wiki mailing list