Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pyramid feature for fit races
- #e.g. .setgoal 40 pushups; .sets 4 pyramid
- #display set sequence at start of race
- #Set 1 - 40 pushups
- #Set 2 - 30 pushups
- #Set 3 - 20 pushups
- #Set 4 - 10 pushups
- #first add new global variable - pyramid flag
- our $pyramid = 0;
- #activated by command '.sets <number> pyramid'
- elsif ($command eq 'sets')
- {
- my @setbreakup = split(/ /, $extra,2);
- my $setnumber = @setbreakup[0];
- my $setworkout = @setbreakup[1];
- if (int($setnumber) == 1)
- {
- $inrace = 1;
- $rest = 0;
- $sets = int($setnumber);
- $bot->say(
- channel => "$channel",
- body => "$sets set.");
- return;
- }
- elsif (int($setnumber) > 1 && int($setnumber) <= 10)
- {
- if ($rest == 0)
- {
- $rest = 10;
- }
- #check for pyramid style race
- if ($setworkout eq 'pyramid')
- {
- #sets must equally divide into amount
- if (($amount % $setnumber) != 0)
- {
- $bot->say(
- channel => "$channel",
- body => "Sets must equally divide into number of reps for pyramid race");
- return;
- }
- else
- {
- #set pyramid flag
- $pyramid = 1;
- }
- }
- $inrace = 4;
- $sets = int($setnumber);
- $bot->say(
- channel => "$channel",
- body => "$sets sets - $rest second rest per set.");
- return;
- }
- else
- {
- $bot->say(
- channel => "$channel",
- body => "Sets must be a valid number between 1-10.");
- return;
- }
- }
- #then display the set sequence of pushups at start of race
- sub startRace {
- #if pyramid race
- if ($pyramid == 1)
- {
- $inrace = 5;
- $bot->say(
- channel => "$channel",
- body => "Pyramid $workout! $rest second rest per set. Sets are as follows:");
- #first set is normal
- $bot->say(
- channel => "$channel",
- body => "Set 1: $amount $workout");
- #display amounts for each remaining set
- my $displaySets = 2;
- my $setDiff = $amount/$sets; #difference in amount for each set after 1
- while ($displaySets < $sets) {
- $bot->say(
- channel => "$channel",
- body => "Set $displaySets: ($setDiff*($displaySets-1)) $workout");
- $displaySets++;
- }
- }
- #if normal multi race
- elsif ($inrace == 4 && $sets > 1)
- {
- $inrace = 5;
- $bot->say(
- channel => "$channel",
- body => "Race starting in 5 seconds - $sets sets of $amount $workout - $rest second rest per set.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement