Count based on a Query

Hello,
I made a death counter but ran into a problem: Mr Streamer sometimes just dies too fast! So I wanted to edit the command to increase the counter by the given $(query)
I’ve tried using

 !commands edit !deaths X has died $(eval s="";for(i = 0; i < $(query)-1;i++){s+=$(count);}$(count);) times

But this only seems to run $(count) twice no matter what, which I guess means that count is interpreted & replaced before the eval? I’ve tried looking through the forums but couldn’t find a way to do this.

Is this even possible without creating a webserver to urlfetch from? If not are there any good resources as to how to get started with that? Any help would be greatly appreciated!

Edit: Personally I’d love if this functionality were baked into $(count) itself, like $(count 3) to add 3, $(count -1) to decrement, and $(count $(query)), as examples. Would make a lot of things a lot simpler!

Check out my reply to a very similar question. It will help you set up some commands to keep track of a running count and increment the count by whatever integer is given in the user input.

Thanks, I thought I’d looked through old questions pretty extensively but I guess I hadn’t looked enough! Shame this can’t be done through nightbot’s base functionality though.

Hey @elendriai!

While RokettoJanpu’s solution is great, I have a solution that only uses Nightbot without an API, as it’s seems to be what’s interesting you.

Here are the commands:
!deaths

!addcom !deaths $(twitch $(channel) "$(channel) died 0 times playing {{game}}.")

Displays the number of deaths, can be used by anyone.

The following commands are for moderators only:
!adddeath

!addcom !adddeath -ul=mod -a=!editcom !deaths $(twitch $(channel) "$(channel) died $(count) times playing {{game}}.")

Use this command when you want to add 1 (one) death.

!setdeath

!addcom !setdeath -ul=mod -a=!editcom !adddeath \-c=$(eval $(1)-1)

Use this command to set the number of death to where you want it to be.
Call !deaths to know where you are, let’s say you are at 47 deaths and you want to add 3 deaths, then call !setdeath 50 (since 47+3=50), and next call !adddeath to finalize the update, now !deaths should display 50 deaths.

!resetdeath

!addcom !resetdeath -ul=mod -a=!editcom !adddeath \-c=0

Use this command to reset the death counter.

!zerodeath

!addcom !zerodeath -ul=mod -a=!editcom !deaths $(twitch $(channel) "$(channel) died 0 times playing {{game}}.")

Use this command to reset the !deaths message if you want to have it at 0 right at the start, otherwise the message will be updated on the next first death.

I hope this is closer to what you wanted.

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