Hourly Experience Giveaways
This example will show you how to create 2 Flows, one that starts a running giveaway and another that let’s viewers claim experience from the giveaway.
Let’s start with the first Flow:
Flow #1: The runner
Let’s quickly go over what this does:
Triggers
Taking a look at the Triggers, you will notice that there is 1 Trigger, which is a Timer set to activate every hour. This is what will start the giveaway every hour.
Steps
Taking a look at the steps, you will notice that there are 8 of them, let’s go over them one by one:
1. Random
The first step is a Random step set to output a random number between 10 and 100. This will be the amount of experience that will be given away.
2. Set Variable
The second step is a Set Variable step that sets the giveaway-amount
variable to the output of the Random step. This will be used in the second Flow.
3. Text
The third step is a Text step that sets the message to be sent to the chat.
4. Send
The fourth step is a Send step that sends the above message to the chat.
5. Delay
The fifth step is a Delay step that delays the Flow for 30 seconds. This is to give viewers time to claim the experience.
6. Set Variable
The sixth step is a Set Variable step that sets the giveaway-amount
variable to 0, this will be used in the second Flow.
7. Text
The seventh step is a Text step that sets the message to be sent to the chat. “The giveaway has ended”
8. Send
The eighth step is a Send step that sends the above message to the chat.
Flow #2: The claim Flow
Let’s quickly go over what this does:
Triggers
Taking a look at the Triggers, you will notice that there is 1 Trigger, which is a Chat Trigger that looks for the !claim
command. This is what will allow viewers to claim the experience.
Steps
Taking a look at the steps, you will notice that there are 10 of them. This Flow uses logic steps(If/Else/End If) to determine if there is an active giveaway for the viewer to claim.
1. Cool Down
The first step is a Cool Down step set to per chatter, with a 30 second cooldown. This is to make sure that each viewer can only claim each giveaway once. Since giveaways last 30 seconds, this will do the trick.
2. Get Variable
The second step is a Get Variable step that gets the value of the giveaway-amount
variable. This is the amount of experience that will be given away.
3. If
The third step is an If step that checks if the value of the giveaway-amount
variable is equal to 0. If it is, the Flow will send a message to the chat saying that there is no active giveaway.(step 4 and 5)
6. Else
The sixth step is an Else step that will run if the value of the giveaway-amount
variable is not equal to 0. This means that there is an active giveaway, so the Flow will give the viewer the experience.
7. Give Experience
The seventh step is a Give Experience step that gives the viewer the amount of experience that is stored in the giveaway-amount
variable. Notice the use of {var.giveaway-amount}
in the Amount field, this is an example of using an inline variable, you could just as well use a {last_step}
inline variable after a Get Variable step.
8. Text
The eighth step is a Text step that sets the message to be sent to the chat. “Giveaway claimed! You got {var.giveaway-amount} experience!”
9. Send
The ninth step is a Send step that sends the above message to the chat.
10. End If
The tenth step is an End If step that ends the If/Else/End If block.