DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.88k stars 478 forks source link

modtools/extra-gamelog: Sparring vs Combat #2302

Open Bumber64 opened 2 years ago

Bumber64 commented 2 years ago

Identify which reports are sparring/combat/hunting and add this info when printing to gamelog.txt, so utilities like SoundSense can more easily filter them out.

Could put [S], [C], or [H] in front of the relevant lines.

lethosor commented 2 years ago

It's a bit tricky to do this - the script is only designed to write additional messages to the gamelog, not to modify messages that have already been written. If any tool is behaving like tail and just watching for changes to the end of the file, they'll only see the original messages created by DF, even if we go back and edit them (and editing them is risky if DF maintains an open file that's writing to the same file).

Bumber64 commented 2 years ago

Do we have the means to detect reports or messages before they print?

lethosor commented 2 years ago

Nope

Moth-Tolias commented 2 years ago

we might be able to accomplish something similar by maintaining a separate log file.

Bumber64 commented 2 years ago

We could just write to DF's gamelog and have SoundSense configured to ignore combat stuff that we don't print.

However, that would add a bunch of bloat to the gamelog if we don't simplify the messages. Shortest message would be the sound to play, requiring the relevant regex's to be passed along to DFHack. Otherwise, we can do some abbreviation of text that doesn't provide any info.