mculig / TemtemTracker

A tracker for the MMO Temtem
GNU General Public License v3.0
30 stars 13 forks source link

Feature: Output encounter to text file for OBS display #3

Open agaertner opened 4 years ago

agaertner commented 4 years ago

Make a setting (check box) and let the user choose a destination where text files should be stored for the open broadcaster software to pull values from for display on stream.

I recommend these values (taken from my own TemCounter:

encounter_total.txt
encounter_session.txt
luma_encounter.txt
<specific temtem>_encounter_total.txt
<specific temtem>_encounter_session.txt

Also allow for prefix or suffix text to be added for easier aligning in OBS.

You can do that with regex by removing all non-digits with regex ("\D+"). Then parse the rest into integer and save the updated value back with the prefix and suffix.

Example written in autohotkey:

file := FileOpen("out\" . fileName . ".txt", "rw") ; read/write - create new  if no existo
if (IsObject(file)) {
    content := file.Read()
    counter := RegExReplace(content, "\D")
    if (!counter)
        counter = 0
    newText := prefix . counter + incr . suffix
    file.Seek(0), file.Write(newText), file.length := StrLen(newText)
    file.Close()
}

If you want you can update your program's icon with the ones from my autohotkey script. It's not shared anywhere and not updated.

icon

*.ico format: https://ufile.io/obtb6908

uninstall icon (in registry): temcounter

*.ico format: https://ufile.io/ccigeo5g

mculig commented 4 years ago

The icon was made by a friend specifically for TemtemTracker, so I won't be changing it any time soon as long as there isn't an important reason to change it.

Regarding OBS, this is a good idea and I'll look into it.