Possible to have Death Counter persist through different games?

As of right now, !deathctr resets when you change games. I’d like for it to persist even if I play a different game.

So if I’m playing Game A with 8 deaths, and switch to Game B, I would like the death counter to keep the value of 8 from the previous game.

Any way to do this?

It persists in the database and picks back up when you swap back to an old game.

setgame Forza Motorsport 7
[04-18-2018 @ 21:07:53.320 MDT] [CHAT] Changed the current game to: Forza Motorsport 7!
[04-18-2018 @ 21:07:55.223 MDT] [CHAT] notillusionaryone has died 2 times in Forza Motorsport 7.
setgame Forza Horizon 2
[04-18-2018 @ 21:07:59.578 MDT] [CHAT] Changed the current game to: Forza Horizon 2!
[04-18-2018 @ 21:08:00.882 MDT] [CHAT] notillusionaryone has died 3 times in Forza Horizon 2.
setgame Forza Motorsport 7
[04-18-2018 @ 21:08:26.729 MDT] [CHAT] Changed the current game to: Forza Motorsport 7!
[04-18-2018 @ 21:08:27.595 MDT] [CHAT] notillusionaryone has died 2 times in Forza Motorsport 7.

Yeah, I get that if you switch back to the game with a certain value of deaths it will pick up where you left off.

But that’s not what I’m looking for.

I’m looking to have the death counter roll over into the next game.

For instance:

I’m playing game X.
Death Counter has a value of 2
I switch to game Y.
Death Counter still has a value of 2.

Basically I want my death counter to be independent of what game I’m playing.

Understood, unfortunately, we have had it requested both ways and the current way won out. Unfortunately we are unable to provide every combination for scripts built in to the bot, I hope you understand.

Perhaps someone will pick this up and run with it.



Do you know of any way it might be possible to edit the script of the Death Counter to give me this functionality?

Definitely possible, the easiest (perhaps kludgy way) is to hard-code a game value in the deathctrCommand.js script where it sets and gets the death counter value.

 15             deathCounter = parseInt($.inidb.get('deaths', game));

Change to 

 15             deathCounter = parseInt($.inidb.get('deaths', 'permactr'));

Then, on these lines like you see above, change game to 'permactr' in any $.inidb calls:

 41             var deathCounter = parseInt($.inidb.get('deaths', game));
 58                         $.inidb.set('deaths', game, 0);
 74                         $.inidb.set('deaths', game, setDeath);
 85                     $.say($.lang.get('deathcounter.add-success', $.ownerName, game, ($.inidb.exists('deaths', game) ? (parseInt($.inidb.get('deaths', game)) + 1) : 1)));
 86                     $.inidb.incr('deaths', game, 1);
 95                     if (isNaN(parseInt($.inidb.get('deaths', game))) || parseInt($.inidb.get('deaths', game)) === 0) {
100                     $.say($.lang.get('deathcounter.sub-success', game, ($.inidb.exists('deaths', game) ? (parseInt($.inidb.get('deaths', game)) - 1) : 0)));
101                     $.inidb.decr('deaths', game, 1);

I think those are all the lines, I just did a text search, hopefully I copy/pasted them all.


Thank you so much! I will give this a go and If I run into any trouble I’ll run back here for help :stuck_out_tongue:

(this is why I love Phantombot so much)

1 Like

You bet, keep in mind that this will only work from the Chat and Console Commands but not from the Control Panel which talks directly to the database and uses the current Game Title. So, what I am saying is, do not freak out if the Control Panel has a different number than chat.


Good to note. :slight_smile:

1 Like

you could of also just set game = 'permactr' like comment out
game = ($.getGame($.channelName) != '' ? $.getGame($.channelName) : 'Some Game');
and add below it
game = 'permactr'

this way if you ever want it back you can just comment out the new line and uncomment the game set code