Hey there, so I found a way to make (and update live) a death counter. It's a fun little thing I wanted to have on my Dark Souls streams... because I die a lot.
Difficulty to set up : EASY.
Let's get started :
First, you will need the AutoHotKey software, a lightweighted and very low ressource consuming software :)
Install it.
Step 1 :
Now, create a .txt file in any location (folder) of your choice and name it as you wish (let's say "deathCounterScript.txt").
Note that this code will create a text file with a number in it (useful for OBS), so let's plan that the text file will be in the same folder as deathCounterScript.txt and let's call it deaths.txt.
Open that text file in your favorite text editor and paste the following code :
Note : as for me, I use the F12 key to increment and the F11 key to decrement, you can use any key so feel free to change =)
Dont forget to change "filePath = PATHTOdeaths.txt" to the path of your choice, in my case it is : "filePath = C:\Users\Kevin\Documents\YOUTUBE\PRODUCTION\darksoulsDeathCounter\deaths.txt"
Now, change deathCounterScript.txt's extension to deathCounterScript.ahk (the name can be different if you chose a different name). The .ahk extension stands for AutoHotKey, you'll be able to launch it directly with the software =)
You can now try out for yourself, execute your newly created AHK script, and try pressing F12 ou F11 (note that you cannot go below zero w/ the decremention key). Check the deaths.txt to see that it has been updated :)
You should have something like this at this point :
Step 2 :
Note : You can skip this step if you already are familiar with OBS' textfile input thingy. :3
Edit : Ok so I totally forgot about this guide and forgot to update it. The next step is really easy and is explained fully over here : viewtopic.php?f=22&t=925#p5268 (CHECK STEP 4 of that tutorial and just replace the .txt path with the .txt that contains the number of deaths :))
Cheers !
What you will be able to do with this guide :
- Bind any key to increment and/or decrement your death counter.
- Have ingame control over the death counter.
- Have your death counter appear on screen for viewers =)
Difficulty to set up : EASY.
Let's get started :
First, you will need the AutoHotKey software, a lightweighted and very low ressource consuming software :)
Install it.
Step 1 :
What you'll do in this step :
- Create the script that will output your number of deaths in a .txt file.
- Bind the keys of your choice to increment or decrement your number of deaths.
Now, create a .txt file in any location (folder) of your choice and name it as you wish (let's say "deathCounterScript.txt").
Note that this code will create a text file with a number in it (useful for OBS), so let's plan that the text file will be in the same folder as deathCounterScript.txt and let's call it deaths.txt.
Open that text file in your favorite text editor and paste the following code :
Code:
;Enter your TXT file path .
filePath = C:\Users\Kevin\Documents\YOUTUBE\PRODUCTION\darksoulsDeathCounter\deaths.txt
FileReadLine, deathVar, %filePath%, 1
;When you press F12 it will increment and update the death counter in the .txt
F12::
;Creates txt file if it doesn't exist.
IfNotExist, %filePath%
FileAppend,0, %filePath%
;Created a file.
;Inputs number of deaths in deathVar variable.
FileReadLine, deathVar, %filePath%, 1
Var := ++deathVar
FileDelete, %filePath%
FileAppend,%deathVar%, %filePath%
return
;When you press F11 it will decrement and update the death counter in the .txt
F11::
;Creates txt file if it doesn't exist.
IfNotExist, %filePath%
FileAppend,0, %filePath%
;Created a file.
;Inputs number of deaths in deathVar variable.
FileReadLine, deathVar, %filePath%, 1
if deathVar = 0
return
Var := --deathVar
FileDelete, %filePath%
FileAppend,%deathVar%, %filePath%
return
Note : as for me, I use the F12 key to increment and the F11 key to decrement, you can use any key so feel free to change =)
Dont forget to change "filePath = PATHTOdeaths.txt" to the path of your choice, in my case it is : "filePath = C:\Users\Kevin\Documents\YOUTUBE\PRODUCTION\darksoulsDeathCounter\deaths.txt"
Now, change deathCounterScript.txt's extension to deathCounterScript.ahk (the name can be different if you chose a different name). The .ahk extension stands for AutoHotKey, you'll be able to launch it directly with the software =)
You can now try out for yourself, execute your newly created AHK script, and try pressing F12 ou F11 (note that you cannot go below zero w/ the decremention key). Check the deaths.txt to see that it has been updated :)
You should have something like this at this point :
Step 2 :
Note : You can skip this step if you already are familiar with OBS' textfile input thingy. :3
What you'll do in this step :
- Use OBS to display the number of deaths on your livestream.
Edit : Ok so I totally forgot about this guide and forgot to update it. The next step is really easy and is explained fully over here : viewtopic.php?f=22&t=925#p5268 (CHECK STEP 4 of that tutorial and just replace the .txt path with the .txt that contains the number of deaths :))
Cheers !