Customizable Counter - A possible replacement for the Death Counter



Hi all, I’m sure some of you have seen me around the forums helping out where I can.

So I’ve noticed that people like the death counter on the bot, but they all request for the same things:

  • Can I change the counter name
  • Why isn’t it in it’s own panel?
  • How do I change the name?

You get the idea…

Now, I’d have put this as a feature request or like submitted it on the github, but I don’t think my code is up to the developers standards, and I’d rather not make them deal with that.


The following are commands you can use in your chat to control the counter. They’re the same as the death counter commands, with a couple additions. You are also able to control the counter in the “Counter” web panel. It’s near the bottom of your dashboard (sorry! the tutorial would be harder if you wanted it elsewhere).

  • !ctr - returns the current count of the counter for the game being played. Ex: “User has died X times in Y game”
  • !ctr + | add | incr Any of the 3 arguments can be used to add one to the counter. Support for adding numbers is a possible feature later.
  • !ctr - | sub | decr Just like adding, but subtracting. Any of the arguments can be used to subtract one from the counter.
  • !ctr reset - Resets the counter value to 0 for the current game.
  • !ctr set - Sets the counter value to the inputted value for the current game.
  • !ctr setverb - Set’s the action word (I didn’t know a better phrase) for the counter. I.E: “User has died again in Destiny, bringing the total to 2.” - Died is the verb.
  • !ctr setname` - Set’s the name of the counter. I.E: "The death counter for Destiny is already zero.** - death is the name.


This tutorial will require quite a bit of modifications. It’s highly possible that following this tutorial incorrectly can result in a broken web panel.

Step 1

Download the following zip file. Extract the “scripts” folder and “web” folder to the root of your bot folder. The required files are properly nested within the zip, so extracting them at the root should place them in their proper destinations (ex: counterCommand.js goes in /scripts/commands/counterCommand.js).

Your computer shouldn’t ask you to replace files, as they shouldn’t have existed before.

Step 2

Open \web\panel\js\panelUtils.js in your favorite text editor. A Rich Text Editor like Notepad++ is highly recommended.

NOTE: If you open your .js file in regular notepad, and all the text is on ONE LINE. This is because Windows and Linux use different line terminators. Use a site like this to fix it or, again, use a rich text editor as most support both *nix and Windows line terminators.

Find this:

     if ('help_') !== -1) $.helpOnMessage(e);

Insert this on the following line:

     if ('counter_') !== -1) $.counterOnMessage(e);

Find this:

     case 19 : 
         newPanelAlert('Refreshing Data', 'success', 1000);

Insert this on the following line:

     case 20 : 
         newPanelAlert('Refreshing Data', 'success', 1000);

Step 3

Open /web/panel/index.html.


            <li> <a href="#audio">Audio</a> </li>

Insert After:

            <li> <a href="#counter">Counter</a> </li>


        <div role="tabpanel" class="tab-pane" id="audio">
            <div id="audioPanel"></div>
            <script type="text/javascript" src="panel/js/audioPanel.js"></script>

Insert After:

        <div role="tabpanel" class="tab-pane" id="counter">
            <div id="counterPanel"></div>
            <script type="text/javascript" src="panel/js/counterPanel.js"></script>

Step 4:

Open web\panel\js\disablePanel.js


        if (panelMatch(module, './commands/deathctrCommand.js')) {
            handlePanel('./commands/deathctrCommand.js', '#_deathCtrPanel', moduleEnabled);

Insert After:

        if (panelMatch(module, './commands/counterCommand.js')) {
            handlePanel('./commands/counterCommand.js', '#_ctrPanel', moduleEnabled);

Tutorial complete, enjoy the counter

Final Notes:

If, for some reason, this tutorial does not work for you, please post below and try to explain your error as much as possible. Please do not make posts in other sections of the forums for support with this counter. Post here instead, so I can get back to you asap.

P.S Don’t forget to disable the old death counter :wink:

Add numbers to (count)
How to display the wins and losses of a game in OBS?
Re-purposing death counter module

Tutorial worked great! Thanks for your help. I do have a question for you as I don’t have a lot of programming knowledge in java. If I have a hotkey on my keyboard to update the counter file, Is there a way to get the bot to acknowledge the updated number? It doesn’t appear the !ctr command checks the file for the number of deaths. Thanks in advance!


You’d have to have the bot “listen” to the file for when it changes (the bot does something like this for the lang files), or make a command.

And if you take the route of making a command, it’d be easier to just use !ctr +

Is it not possible to hotkey a command with whatever you’re using?

Death Counter (Command then count)

it works perfectly but is there a way ctr to a seperate command. id like to make a fail counter where the command is !fail and it just counts up rather than !ctr + or something along those lines.

New to coding so not sure how to go about that


No need to code.

So if you want !fail to do !ctr + you’d use:

!aliascom fail ctr +

If you want !fail to act exactly like !ctr you’d use:

!aliascom fail ctr

And you’re all set :smiley:


So ive aliased it and its succesful restarted the bot and now it doesnt recall the alias, ive aliased a few commands around ctr and the only one the bot is not recalling is !fail.

!aliascom fail ctr + succesful until restart

!aliascom failctr ctr succesful after restart

!aliascom failset 0 ctr set succesful after restart


Unfortunately I can’t help with that, as I’m not sure why it’d be acting that way. I could only assume it has something to do with the other aliases with fail in them, or you have a command called fail that’s removing the alias.


I like the ability to customise the name for death counter, my question is towards the function of the death counter itself.

Would there be any way of making the counter for the day rather than the current game ?
Basically if I say a certain word during the stream viewers can use whichever command to +1 it like the death counter but the count keep increasing until the stream ends or the next calander day rather than game change since the current game isn’t relevant for this?

I’m aware of the count command but I don’t want it to reset automatically rather than permanently continuing and the death counter just seems a better feature with better control

Along with that would it be able to store the past final counts?
such as logging for future reference like this but only showing the current days count in the dashboard or when requested in chat ?
yy/mm/dd - count
yy/mm/dd - count


Possible? Yes.

Possible with this script? Not currently.

You’d have to do some modifications. It’d probably be easier to just write a new script that’s tailored for what you’re trying to accomplish.


OK, Thank you for the reply ^.^


I tried to do this multiple times but I keep getting the issue where I go into the panel and the counter panel doesnt display anything.

Also, in the file where you insert:

“if (panelMatch(module, ‘./commands/counterCommand.js’)) {
handlePanel(’./commands/counterCommand.js’, ‘#_ctrPanel’, moduleEnabled);

It has a line that says audio and information have to be the last two. Is that what is causing it?


This hasn’t been updated for the latest panel and may be why you’re experiencing issues.

Wins Command With Kill Counter