RafflesRun Raffles using a Point System like the one from VRFlad
About:
Platforms:
Twitch.
YouTube.
Written by: TerrierDarts.
Last update: Dec 18 2023.
Product Version: 4.
Streamer.Bot Version Required: 0.2.0+.
Set-Up Difficulty: 1/5.
Import Codes
Import Codes are the way we can share our extensions with you and how you can share
your creations with other people. You can choose if you want to copy the import
to your clipboard or you can download a .txt file to import that.
To Import into Streamer.bot what you need to do is press on Import from the top bar and either Paste in the string or Drag and Drop the file depending
on which method you used to get the Import string.
Once imported, you will notice like all of my chat games it includes an Action called [Currency] - [Set Triggers]. This Action will create a .json file in your data folder. It will only update when there is an update to be pulled from the site, also note it could create triggers for games or extensions you do not have, this is nothing to worry about.
If you already have this Action I would reccommend you choose to replace it as it might change, but I am taking every effort it doesn’t change.
You should then restart Streamer.bot so it can create the Triggers you need as the Triggers will create themselves every time you start Streamer.bot. If done correctly you should receieve a Toast Notification confirming this.
This import will contain 7 Actions, 2 Command and a Queue.
Actions
This game has 3 Admin Actions, These 3 actions will handle all the logic. These should not be edited and you do so at your own risk!
[Currency Admin] - [Raffle] - Start this action is how you will start the raffles, In the import its tied to !raffle and the way to use it is to do !raffle <amount> if you don’t provide an amount it will use the default prize, you can also use k and m for 1000 and 1,000,000.
[Currency Admin] - [Raffle] - Join is how users will join from the import it is set from !ticket.
[Currency Admin] - [Raffle] - End this action will trigger automattically when the raffle time is up.
Triggers Avaliable
5 New Triggers can be found under Custom >> Currency >> Raffle
Trigger Name
When Triggered
Start
Triggered when a stream
Join
Triggered when a user goes all-in and loses.
End (Single Winner)
Triggered on any win.
End (All Winners)
Triggered on any Loss.
Failed
Triggered when a user wins but not an all-in win.
Arguments Populated
Each Trigger will populate the following Arguments.
Argument
Description
%gameName%
This is the name of the current game.
%oldTicketCount%
This is the number of raffle tickets a user had before they current purchase.
%newTicketCount%
This is the number of tickets the user has after the purchase.
%oldEntriesRemaining%
This is how many the user has remaining.
%maxTicketCost%
This is the cost of the maximum number of tickets the User can buy.
%maxToBuy%
This is the number of tickets the User can buy.
%ticketsBought%
This is the number of tickets the user has bought.
%totalTickets%
This is the total number of tickets that have been bought.
%ticketTag%
This will return ‘ticket’ or ‘tickets’ depending
%oldPoints%
This is the old number of points the user had before the purchase.
%newPoints%
This is the new number of points the user has after the purchase.
%winningUser%
This is the user who won(This is trigger on the End Single Winner)
%raffleWinnerCount%
This is the number of winners we have.
%raffleWinners%
This is a list of all the winners.
%winner[i]%
This is an index of each winner.
%prizeWon%
This is the amount that has been won.
Fail Codes
Fail Codes are a way to explain why something went wrong if something did go wrong, they will be populated from the Fail Trigger, and will be failCode and failReason. Using these you can create a single currency game fail action if you wish!
Code
Reason
1
Raffle already active
2
Raffle not active
3
User maximum allowed tickets
4
User can not afford
5
Nobody entered the raffle
Configuration
Across the 3 actions there are the following settings.
Setting
Purpose
defaultPrize
This is the default prize if none is given.
length
This is how long the raffle will last for.
trigger
This is how users can joing the raffle.
raffleCost
This is a cost for a raffle Ticket, this can be 0.
maxEntry
This is how many entries a person can have, if cost is 0 this will default to 1.
multiWinners
This is if you want more than 1 winner if enough people join.
entriesPerWinner
This controls how many entries we need to get an extra winner.
sharePrize
This is if they will share the prize or will they each get the prize value.
minPrize
This is the Min Prize, prize will set to this if the given amount is under.
maxPrize
This is the Max Prize, prize will set to this if the given amount is over.
defaultPoints
This is the amount of points a User will be given if they have no points.
Using the arguments listed above the Send Message Sub Actions can be edited to suit your needs. Its also wise to rememeber that End (Single Winner) Will Trigger for each winner if you have more than one, and End (All Winners) will trigger once listing all the winners.
Changelog
Version 4
Generic Fail Added
Fixed Timer Issue
Added Min and Max
Version 3
Version Numbers Added
Logic now handles points as type long rather than int incase anyone goes over the ‘2,147,483,647’ mark. Points can now go upto ‘9,223,372,036,854,775,807’