I’m looking to make a command that tracks successes and the overall number of attempts. Ideally, I would like to call it via the same command and pass “success” or “failure”, but not sure if that’s possible.
So, let’s say the variables are x/y, where x is a success and y is the total number of attempts. If I were to run !success it would increment both x and y by one, i.e. 1/1. However, if I were to call it via !failure, it would only increment y, i.e. 0/1. And then some function, like !total to return both, i.e. 3/5
Basically, I’m looking for a way to track overall attempts, while simultaneously tracking successes and then be able to return a total at any time. Sorry, I’m very new to Nightbot programming. Any help is greatly appreciated. Thank you!
This is still the case, unfortunately. There’s only a count storage of command usage per command, but it can only be manipulated via our API externally (not internally with scripting).
One way you could do this is by using the quote system API. You’ll get your TOKENS by clicking on the second link in the post, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN and PRIVATE_TOKEN, look at the field bellow:
Keep your PRIVATE_TOKEN secret, don’t share it anywhere. To add a command containing your PRIVATE_TOKEN do it from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.
To add success and attempts to the counters:
• !success