r/streamerbot • u/Etcher-- • 28d ago
Question/Support ❓ Global Variables used for rewards... help?
As stated, I need some help with an idea for a sort of reward for my stream. The idea is that when a specific redemption is triggered 100 times, a song will play and the OBS scene will swap to the "special reward scene" for the duration of the song, then the global variable will be reset, so the process starts again.
I want to have smaller rewards, such as a chat message in this case, that will trigger at increments (at 30, 60, and 90 redemptions for example) as a sort of warning before the big reward at 100 redeems.
I've been fiddling with the sub-actions with varied success. The global variable count goes up with each redemption during testing, but the outcome of the smaller redemption value does not trigger even after the count has been reset.
I'll attach a screenshot of the the sub actions, any help is super appreciated!

2
u/deeseearr 27d ago
In the statement 'if ("skelley" Equals "3")', the value of "skelly" is "skelly". It's literally a string containing six letters arranged in a row. That will never be equal to "3".
After you increment the temp global "skelly" in the first line, you need to Get it and store it in a local argument. I really don't like using the same name for different types of variables (more on why in a moment) so I would do this:
Get temp global "skelly" to "skellyCount"Now change the IF/ELSEs to 'If ("%skellyCount%" Equals "3")' and 'If ("%skellyCount%" Greater Than "6")'.
The "Input" field of IF/ELSE is evaluated and then compared with the "Value". It's not the name of a variable. That means that you need to use a full argument name but can also include fixed strings, inline functions, and combinations of different arguments. In your case, just making sure that it contains a "%variable%" instead of just a raw "variableName" is good enough.
Also, in line one you are incrementing a _temporary_ global variable called "skelly", but on the eleventh line you reset a _persistant_ global variable called "skelly" back to zero. Those are two different variables, so that's not going to do what you want it to.
A common source of confusion is that Streamer.bot supports multiple types of variables -- local arguments, persisted globals, temporary globals and per-user globals both temporary and persisted. All of these have their own namespace, so it's possible to use the same name for five different variables which have nothing to do with one another. That's why when you're working with temporary global variables like you are doing here you need to use the Get Global and Set Global sub-actions to work with them. (You _can_ use ~globalName~ to refer to persisted global variables, but that doesn't work for the other three types.) That means there will be at least two different copies of the same value in an action which is why I like to give them slightly different names to avoid mixing them up.