Hey all,
I didn't expect to ever write a tutorial on anything, but my viewers were starting to accumulate a lot of points (minerals) wihtout anything to do with them. Since I had some perks set up on
GameWisp for subs, I figured viewers who've been around the most could also benefit from perks by using their minerals.
I couldn't find much info on setting something like this up, but manged to do it with the help of some of the tutorials here on the forums and with Mitch (thank you!).
Without further ado:
File set-upThanks to Mitch for suggesting this! As you can see, perks and their associated costs are stored in two different folders:
Inside each folder, there is a text file for each perk cost and perk name. These correspond to a
public FAQ for my viewers to choose their options.
E.g. Option 1: "You choose the class/hero I play next match" costs 1000 mineralsBot commands!kerriperks/me Welcome to KerriPerks! Type "!redeem #" in chat, where # corresponds to the perk you'd like to redeem. You have @points@ @pointsname@ to spend. Check out the perks here: http://bit.ly/KerriPerksFAQ
Provides information to users on how to use KerriPerks (my perk redemption system). Take a look at the
FAQ link for more context around why I designed some of the commands this way.
!redeem@if@[>=||@points@||@readfile@[E:/LIVESTREAMS/StreamMods/bots/KerriBot/redeem/cost/@target@[1].txt]||!redeemlog @target@||!redeemfail]
This is the only actionable command that initiates a redeeming a perk. Everything else is done automatically following this if condition. This will first check if the user has enough points to redeem the perk they want.
!redeemfailYou only have @points@ @pointsname@, @user@! Get back to the mines! kerriRage
If the user doesn't have enough points to redeem, they're told to try harder.
!redeemlog@savefile@[E:\LIVESTREAMS\StreamMods\bots\KerriBot\redeem\unfulfilled\@target@[1]_@user@_@counter@.txt,@user@ | @readfile@[E:\LIVESTREAMS\StreamMods\bots\KerriBot\redeem\perk\@target@[1].txt] | @target@[2|50]]
If the user does have enough points, the request is first logged in a new text file.
Some of my perks require more information from the viewer to be actionable, and I want users to provide that ASAP. E.g. custom greeting text, choose the hero I Play this match, etc. Due to the priority of some variables the log needs to be completed first, as it picks up 1) the perk # they have selected from @target@[1] to read from files, and 2) the remainder of the @target@ array as notes to include in the .txt file for me to refer to and action after the stream.Command Chains (Hide these from Command List)
!redeemsuccess @target@@editpoints@[@user@|-@readfile@[E:/LIVESTREAMS/StreamMods/bots/KerriBot/redeem/cost/@target@[1].txt]]
Once the log has been created, the bot will edit the users points to remove however much the perk they nominated costs.
Note: You must include the @target@ variable when including these in the Chain Command field, or it won't carry whatever value or information that the user has input with the initial command.!redeemsuccessmsg @target@Yo, Kerri! @user@ redeemed the @readfile@[E:/LIVESTREAMS/StreamMods/bots/KerriBot/redeem/perk/@target@[1].txt] perk for @readfile@[E:/LIVESTREAMS/StreamMods/bots/KerriBot/redeem/cost/@target@[1].txt] @pointsname@!
The points have been deducted, it's time to let the world know that someone redeemed a perk!
I chose to include a custom sound effect on this command, so it's more obvious. You can add an on-screen message as well, but I haven't worked out how to use OBS Remote with studio, so I skipped that. (If anyone knows, shoot me a message?)
!redeemthanks@user@ has @points@ @pointsname@ left. Thank you for using KerriPerks!
Not necessary, but thanks the user for participating and provides an update on their remaining points available.
The full successful command action looks like this:
And the "unfulfilled perks" folder contains logs of all perks that have been redeemed, including notes from the user, for my reference later on: