History & Visualization - Membercat-Studios/Streamlabs-Integration GitHub Wiki
After you've set up all of your actions, placeholders and maybe even donation goals, you might want to display some of that information in-game using a scoreboard or bossbar. The plugin provides information in the form of PlaceholderAPI placeholders, which can be used in plugins like TAB, which we're going to be using as an example for the rest of this page.
Donation goals are nice to have, but not really useful unless you can actually see the progress of them. The plugin provides a few placeholders about the status of donation goals:
Placeholder | Possible values | Function |
---|---|---|
%streamlabs_goal_state% | active / stopped | Current state of the goal |
%streamlabs_goal_amount% | any number | Current goal progress |
%streamlabs_goal_max% | any number | The amount the goal is trying to reach |
%streamlabs_goal_percentage% | any number from 0-100 | The progress of the goal as a percentage (amount divided by max) |
Important
All of the placeholders mentioned above will return nothing ("") if no goal is active!
We can use these placeholders to create a bossbar that shows the percentage of our goal, changes color based on its state and disappears if no goal is currently active:
...
bars:
donation_goal_bar:
style: "PROGRESS"
color: "%changeoutput_equals_input:{streamlabs_goal_state}_matcher:active_ifmatch:BLUE_else:GREEN%"
progress: "%streamlabs_goal_percentage%"
text: "<gold>Donation goal: <aqua>%streamlabs_goal_amount%<white> / <red>%streamlabs_goal_max%"
display-condition: "%streamlabs_goal_active%!="
We're using progress
to set the progress of our bossbar to the percentage of our goal (0-100), then we add a text with the amount and max placeholders and a display-condition
that checks for %streamlabs_goal_active%
not being empty (note that TAB conditions kind of work different to the ones in our plugin). To change the bar's color, we're using the changeoutput
PAPI extension, which can be installed using /papi ecloud download ChangeOutput
and using the %streamlabs_goal_status%
placeholder to obtain the goal's status. There we go, we've created a bossbar showing our donation goal:
Every streamlabs event received by the plugin gets stored temporarily in the Event History. The history keeps all information about an event, including all placeholder data and the order events were received in.
Now let's say we want to have a scoreboard showing all of our latest donators and subscribers in-game. We can accomplish this using placeholders (again), since the plugin provides a history placeholder that lets us access placeholders from events stored in the history. It follows the following format:
%streamlabs_history_(relative event index)(optional string condition):(placeholders)%
The relative event index tells the plugin which event you want to access. Putting in last
will use the last event matching your conditions, and all numbers (starting with 0
) will return the event at that position in the history. Using the 0th
event is equal to putting in last
, it just makes it more intuitive to use.
After the index, an optional string condition can be provided to limit what kinds of events you want to get from the history. If you don't want to mess around with string conditions to be able to get the latest donator, you can also use default conditions, which you can use in place of the index AND condition:
Default Condition | Function |
---|---|
last_donation | Uses the last donation event from the history (excluding events like follows) |
last_follow | Uses the last twitch_follow or youtube_subscription event from the history |
After all of that, you can specify the placeholders after the colon (:
) and the PAPI placeholder will return the value of those placeholders for the event from the history.
Let's take a look at some examples:
# Returns the last user that triggered any event
%streamlabs_history_last:{user}%
# Returns the amount of the last donation using a default condition
%streamlabs_history_last_donation:{amount_formatted}%
# Returns the 2nd to last twitch follower using a custom string condition
%streamlabs_history_1[{_type}=twitch_follow]:{user}%
Using that knowledge, we can now create a TAB scoreboard that displays our latest donators and followers:
donation-board:
title: "<gold>My Donation Stream"
lines:
- "<green>Last Donators:"
- "<aqua>1. <white>%streamlabs_history_last_donation:{user}%"
- "<aqua>2. <white>%streamlabs_history_1[{amount}>0]:{user}%"
- "<aqua>3. <white>%streamlabs_history_2[{amount}>0]:{user}%"
- "<aqua>4. <white>%streamlabs_history_3[{amount}>0]:{user}%"
- ""
- "<green>Last Followers / Subscribers:"
- "<aqua>1. <white>%streamlabs_history_last_follow:{user}%"
- "<aqua>2. <white>%streamlabs_history_1({_type}=youtube_subscription|{_type}=twitch_follow):{user}%"
To determine the 2nd to last donator (and other ones), we're using a condition that checks whether the amount placeholder is higher than 0. If the event does not have any amount placeholder (meaning it isn't a donation event), the condition will return false. For the 2nd to last follower / subscriber, we're using an OR string condition that checks the {_type}
internal placeholder for a subscription / follow event.
This is what it looks like in-game: