NightDev Community Forums

Resetting counts via command

so im trying to set up a death counter thats easy to manage, and i have one that works that i can’t clear without having to log into nightbot.tv and manualy resetting it every stream. will do this is i have too, but id rather be able to do it from chat for convenience.
the one i tried is:

One for any user to see:

!addcom !kills The Current Kill Count is:
And another command to change it using a $(alias).

!addcom -ul=mod !editkills $(alias !editcom !kills The Current Kill Count is: )
The use is simple any user can use the !kills command to see the amount of kills. And any mod (or what ever you choose) can change it using the !editkills with a number after it.
Example:

AnyMod: !editkills 10
Nightbot: The command !kills has been changed!

AnyUser: !kills
Nightbot: The Current Kill Count is: 10

But i get an error of: BearrsGoRawwr : !editkills 1
Nightbot : [invalid variable]

if i do basically the same thing in the nightbot webpage it works but i have to change the message section to $(count) for it to actually put a number there so it looks like

what kind of command/string do i need to be able to clear the count back to 0 from chat?

My other option was:
!addcom !example command used $(count) times
Nightbot: command used x times

!addcom !reset -a=!commands edit !example -c=0
Nightbot: The command !example has been edited successfully

BUT with that i dont know how to pull the actual $(count) without adding too it. if anyone has tips or hints im open to suggestions i’ve been sitting here for a few days trying anything i can think of and it’s just not happening for me.

Thanks in advance

Heya for this use-case you have 2 options. I’ll show both options with a death counter example.

You can use the manual edit as you described above, which will only need 2 commands:

For viewer:
!commands add !counter This streamer has died 0 times this far

For mods:
!commands add !setcounter -ul=mod -a=!commands edit !counter This streamer has died $(query) times this far

Usage:
Viewer: !counter
Nightbot: This streamer has died 0 times this far
Mod: !setcounter 50
Viewer: !counter
Nightbot: This streamer has died 50 times this far


Or you can use the $(count) function which adds up 1 every time you use the command, including the reset command you will need a total of 3 commands:

For viewer:
!commands add !counter This streamer has died 0 times this far

For mods to add a death:
!commands add !addcounter -ul=mod -a=!commands edit !counter This streamer has died $(count) times this far

Rest deaths for mods:
!commands add !resetcounter -a=!commands edit !addcounter \-c=0

Usage:
Viewer: !counter
Nightbot: This streamer has died 0 times this far

Mod: !addcounter
Mod: !addcounter
Mod: !addcounter

Viewer: !counter
Nightbot: This streamer has died 3 times this far

Mod: !resetcounter
Mod: !addcounter

Viewer: !counter
Nightbot: This streamer has died 1 times this far

Note, you have to use the !addcounter after you use the !resetcounter otherwise the orginal !counter wont change. So there is not really a way to set it to 0, unless you want to add a 4th extra command for it (So you need a total of 3 commands to reset the it to 0):
!commands add !resettozero -ul=mod -a=!commands edit !counter This streamer has died 0 times this far

WoW, so easy, how did i stuff this up, i tried so many queries. thanks a tonne! hope this helps anyone else looking for the same/similar thing.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.