Count Command with Separate Text

Basically I’m trying to get a count command with the $(count) command displaying a message when it’s used and showing the increase as well, being:

!whelp It was at this moment that he knew…he messed up…again. [$(count) Failures.]

And then have a second command for everyone to use showing how many times I’ve “failed”

!failed [3 Failures]

I’m also trying to get a third command to reset the counter back to 0, being:

!gameover

However, the !whelp command simply says in chat “The command “!failed” has been edited successfully.” and the “!failed!” command displays the text " It was at this moment that he knew…he messed up…again. [$(count) Failures.]"

So to sum this all up:

Plan:

  1. “!whelp” shows " It was at this moment that he knew…he messed up…again." with the [$(count) Failures.] count after the text. I only put it in brackets so it shows up as [0 Failures.] because It looks more organized.

  2. “!failed” only shows “[0 Failures.]”.

  3. “!gameover” resets the counter to 0

Problems:

  1. “!whelp” only displays that the “The command “!failed” has been edited successfully.” instead of the text that I had written for it.

  2. “!failed” displays the text that I had written for the “!whelp” count increase command

  3. I can’t figure out how to get the “!gameover” counter reset to fit into all of this.

I’m completely new to this and I’m not sure if I should be using the nightbot app to add commands or just input them directly in my chat, and I’m not sure how to translate the format differences between the two.

You may wanna have a look at this post :slight_smile:

Thanks for that. How do I remove the annoying “The command “!fail” has been updated” message every time I increase the count? I’d rather not have it spam (which it will).

sadly there is no such way to do so. A customapi or something else would be needed.

Alright, thanks. I’ll look around for that.

So I was looking around for more information and I found this:

However, those posts were in 2015 and I’m not sure if this was removed or changed. If it was changed, could anyone point me in the direction of an api or something else that can do this?

If you use the control panel you can edit the commands without it showing up in chat, but this means you have to edit your commands manually.

With a custom API you could make a script that keeps track of the count and reset it. And if you dont want a message when Nightbot resets the count you can use this.

I’m completely new to all of this and I have no idea where to write the empty $(urlfetch) or what he means by responding with (" ").

I wrote some info about urlfetch & custom api here, in the first example you’ll see echo 'Hi'; this means Nightbot will output Hi in the chat, now as explained in the other post I linked before, if you respond with just a space echo " "; Nightbot won’t output anything in the chat.

So I just write php code with the empty echo response in notepad, save it as a php file, upload it somewhere and then put the urlfetch in the right place? And would I put that in the $(count) command or the counter command? Do I put the quotation marks in or is it just an empty space? Like I said, I’m completely new to all of this and have no experience with coding and I’m very confused.

Not really, you will need to setup the whole logic which remembers and resets the counter. For a first time project that might not be easy. What you’ll need is probably 1 script that does 2 things, for example:

When this is one is called just add up 1 to the current number, store it somewhere and echo it so Nightbot will display that number in chat.
$(urlfetch http://example.com/counter.php?count)

This one resets the counter to zero, and you just display the space " ", so Nightbot wont output anything.
$(urlfetch http://example.com/counter.php?reset)

Unfortunately I cant help you with the coding of it, the solution within Nightbot has been given, for coding questions you’ll need to look somewhere else.

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