If you are a rubbish gamer like me, one of the cool things you can add is a death counter. These counters can track really anything but a good thing you can track is deaths. Every time in your chosen game you can simply hit a button that will increment the calendar by one.
Whilst if you use Windows you can add these easily, if you stream via an Apple Macintosh it can be a bit trickier to setup, especially using OBS. However, with a bit of work and a couple of small programs you can get it working. Here’s how.
Download & Install Hammerspoon
First off, download & install Hammerspoon. Hammerspoon is a piece of software that will allow you to run simple Lua scripts on your computer, and is designed for hotkeys & automated tasks. It’s small, light & open source. When installed, you should get the Hammerspoon icon within the task bar. At this point, click on it and go to “Open Config”.
A text window should appear. At which point leave the text window open, and we’ll go into something else.
Create a file for your death counter
You need to create now a file that will store your counter. This can be anywhere on the system, but make sure it’s accessible. Simply create the file and put the number “0” (without any speech marks) in the file. Save it (I called mine “death-counter.txt”).
Create the Script in Hammerspoon
Now we need to create a script that we’ll bind to a keypress that will do the following:-
- Load the file created.
- Read the contents into a variable.
- Add 1 to the value.
- Save the updated number to the same file
You can do it using the code below. You will need to replace the [full path to the text file you created] with the full path of the text file you created. This will bind it to cmd+alt+ctrl+W, so you can choose another hot key if you wish. You paste the complete code into the Hammerspoon configuration file (the file opened when you clicked “Open Config”).
When done, click “Reload Config” and this will reload Hammerspoon. If you don’t receive any errors & you used the exact file above, press cmd+alt+ctrl+W and you should see the counter increase.
Add the Counter To OBS
We can now add the counter to OBS. Within OBS click on the + in the “Sources” box and select “Text (FreeType 2)”. Give it a name (say “Death Counter”) and then tick the box next to “Read from File”. Click “Browse” next to “Text File” and then browse to your text file. Set the font and styles and then click OK. You can then drag the death counter to wherever you wish. There is a slight delay but it isn’t much.
Resetting the Death Counter
Resetting the death counter is quick and easy. All you have to do is open up the text file in any text software and changing the number back to 0.
Improving the Death Counter
And that’s it! This should work for all hot keys, and I’ve had it confirmed it does works with the Elgato Stream Deck.
If you have read all the way to the end of this post, and you enjoyed it, please consider sharing this guide or taking a look at my Twitch Stream. Thanks!
If you need support, support is given in the #streamersubalert-support chat on Discord. It will be ignored elsewhere.