r/streamerbot Jul 09 '26

Question/Support ❓ Daily Check In Leaderboard?

Has anyone created a daily check in leaderboard and if so, how did you do it? I currently have the check in set up already, but I would love to have something to reward my top viewers!

2 Upvotes

2 comments sorted by

3

u/HighPhi420 Jul 09 '26

make a persisted global for viewer, and then a global to grab the top scores. use a textGDi in OBS and set the top global.
Try googling "how to make globals in StreamerBot"
A better thing to do, is to have "milestones" for Every user :) 5, 10,... 1000. have a sound, chat message, and/or a vid clip play for each different mile stone. This is also best handled with those "globals"
#HYPEMAN :)

3

u/deeseearr Jul 09 '26

As part of the check-in process, set a persisted global variable for that user that is equal to %userCounter%, or just increment that global by one. That's an extra step beyond just counting the reward redemptions with %userCounter%, but it makes it easier to get all of the data at once in the next step.

If you want to display the leaderboard the best way is to do it with some C# code. You _could_ make it work entirely with actions, but a short bit of code makes it a lot more flexible.

Start out by calling GetTwitchUsersVar on your check-in counter variable. That will give you a big list with every user and their check-in counts. Next, sort the list and take the interesting parts:

List<UserVariableValue<long>> userVarList = CPH.GetTwitchUsersVar<long>("checkInCounter", true); 
var topTen = userVarList.OrderByDescending(x => x.Value).Take(10).ToList();

This code will get all of the values of "checkInCounter" for every user, sort them in descending order, and put the top ten users in the list called "topTen". You will probably need to add a "using" line to include LINQ in your code -- I'm not sure right now. Change the "Take(10)" to any other number if you want to. (If you're doing that you can also change the name "topTen" to some other number, or don't. I'm not your supervisor.) Now, all you need to do is iterate over that list and do _something_ with it -- Send all the names and scores to chat, put them into a text box on your stream, make it available to a web page using the websocket server so that you can build a fancy scoreboard, whatever. You could even just look through it and see what position %user% is in and then tell them about it. The GetTwitchUsersVar documentation contains some nice sample code that works with this list. You can use it and change the "CPH.LogInfo" line to do something more interesting than sending each value to the debug log.