How to create a cmd to add custom value to any variable I want

Asked Jan 17, 2023·1 reply·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

I'd like to use a command to add points to different viewers with only one command if possible. The idea is to do something in this way:

"!sc(noun of the command) <variable(viewer user)> <+-value(points added)>"
(Example: "!sc alberto +15") to add alberto 15 points.

I'd also like to use "!sc alberto" to get the value of that variable.

In this moment I'm using Stream Elements for that but it's so uncomfortable because I have to create three commands for each viewer, one for adding, one for decrease and one to get the value, and the value has to be always the same:

!scalberto+
"alberto has ${count alberto +15} points"

!scalberto-
"alberto has ${count alberto -15} points"

!scalberto
"alberto has ${getcount alberto} points"

I can also use Fossabot so if there is a way to do it with its feature of variable I'd be nice too.

1 reply

Hey @Wandering Gorilla!

We offer support for Nightbot, not StreamElements or Fossabot.

What you're looking for isn't possible with Nightbot (yet?), as the $(count) variable is linked to a command, and not a name, sorry. And you'd still need multiple commands to manage the state of one $(count) if it's anything else than adding 1 upon calling the command.

Besides, I'm not sure which kind of point we are talking about, if it's Twitch channel points, Twitch's API doesn't offer endpoints to manage these.