Bots Home
|
Create an App
TCKY Random Prizes Test
Author:
atthem
Description
Source Code
Launch Bot
Current Users
Created by:
Atthem
// TCKY31's Random Prizes //Summary /* Gives random prizes from different tiers */ //Description /* Written by atthem for TCKY31. Set tiers of prizes based on tip range, and set what prizes are in each tier. When someone tips an amount in a tier's range, they win a random prize from that tier. Fan Club members have a chance to win extra or bigger prizes, to a limit. Not all prizes have to be filled out. Blank ones will be ignored. Not all tiers need to be used. To not use a tier, enter 0 for the lowest and highest tip amounts for that tier. Make sure the "highest" tip numbers are larger than the "lowest" tip numbers for a tier. Make sure the tips for different tiers don't overlap. Make sure there is at least 1 prize in all tiers being used. If a tipper tips outside the range of all tiers, the highest tier below their tip will be used. For example, if the tiers are 5-10, 20-30, and 50-75; and they tip 40, tier 2 will be used. If "allow multiple prizes" is on, the highest tier will be used, then the highest possible with the remainder of the tip, and so on until the entire tip is used up. For example, if the tiers are 5-10, 11-20, and 21-30; and someone tips 75, they will get a tier 3 prize (for 30 tks), a second tier 3 prize (for 30 tks), and a tier 2 prize (for 15 tks). */ /* TO DO: test fan club luck */ /* Update Log ---------------------------------------------------------------- ------------------------------------------------------------------------------*/ //variables { var tier1Array = []; if (cb.settings.tier1Prize1 != '') tier1Array.push(cb.settings.tier1Prize1); if (cb.settings.tier1Prize2 != '') tier1Array.push(cb.settings.tier1Prize2); if (cb.settings.tier1Prize3 != '') tier1Array.push(cb.settings.tier1Prize3); if (cb.settings.tier1Prize4 != '') tier1Array.push(cb.settings.tier1Prize4); if (cb.settings.tier1Prize5 != '') tier1Array.push(cb.settings.tier1Prize5); var tier2Array = []; if (cb.settings.tier2Prize1 != '') tier2Array.push(cb.settings.tier2Prize1); if (cb.settings.tier2Prize2 != '') tier2Array.push(cb.settings.tier2Prize2); if (cb.settings.tier2Prize3 != '') tier2Array.push(cb.settings.tier2Prize3); if (cb.settings.tier2Prize4 != '') tier2Array.push(cb.settings.tier2Prize4); if (cb.settings.tier2Prize5 != '') tier2Array.push(cb.settings.tier2Prize5); var tier3Array = []; if (cb.settings.tier3Prize1 != '') tier3Array.push(cb.settings.tier3Prize1); if (cb.settings.tier3Prize2 != '') tier3Array.push(cb.settings.tier3Prize2); if (cb.settings.tier3Prize3 != '') tier3Array.push(cb.settings.tier3Prize3); if (cb.settings.tier3Prize4 != '') tier3Array.push(cb.settings.tier3Prize4); if (cb.settings.tier3Prize5 != '') tier3Array.push(cb.settings.tier3Prize5); var tier4Array = []; if (cb.settings.tier4Prize1 != '') tier4Array.push(cb.settings.tier4Prize1); if (cb.settings.tier4Prize2 != '') tier4Array.push(cb.settings.tier4Prize2); if (cb.settings.tier4Prize3 != '') tier4Array.push(cb.settings.tier4Prize3); if (cb.settings.tier4Prize4 != '') tier4Array.push(cb.settings.tier4Prize4); if (cb.settings.tier4Prize5 != '') tier4Array.push(cb.settings.tier4Prize5); var tier5Array = []; if (cb.settings.tier5Prize1 != '') tier5Array.push(cb.settings.tier5Prize1); if (cb.settings.tier5Prize2 != '') tier5Array.push(cb.settings.tier5Prize2); if (cb.settings.tier5Prize3 != '') tier5Array.push(cb.settings.tier5Prize3); if (cb.settings.tier5Prize4 != '') tier5Array.push(cb.settings.tier5Prize4); if (cb.settings.tier5Prize5 != '') tier5Array.push(cb.settings.tier5Prize5); var tier6Array = []; if (cb.settings.tier6Prize1 != '') tier6Array.push(cb.settings.tier6Prize1); if (cb.settings.tier6Prize2 != '') tier6Array.push(cb.settings.tier6Prize2); if (cb.settings.tier6Prize3 != '') tier6Array.push(cb.settings.tier6Prize3); if (cb.settings.tier6Prize4 != '') tier6Array.push(cb.settings.tier6Prize4); if (cb.settings.tier6Prize5 != '') tier6Array.push(cb.settings.tier6Prize5); var tier1Min = cb.settings.tier1Start; var tier1Max = cb.settings.tier1End; var tier2Min = cb.settings.tier2Start; var tier2Max = cb.settings.tier2End; var tier3Min = cb.settings.tier3Start; var tier3Max = cb.settings.tier3End; var tier4Min = cb.settings.tier4Start; var tier4Max = cb.settings.tier4End; var tier5Min = cb.settings.tier5Start; var tier5Max = cb.settings.tier5End; var tier6Min = cb.settings.tier6Start; var tier6Max = cb.settings.tier6End; } // Metadata const APP_NAME = "TCKY31's Random Prizes"; const APP_INITIALS = 'T_RP'; const APP_CREDIT = "atthem"; const APP_FOR = "Paige (TCKY31)"; const APP_FOR_ID = "tcky31"; // Make debuggers shut up about cb being an undefined var var cb = cb || {}; // Configuration Utilities const ON = 'On'; const OFF = 'Off'; const CONFIG = {}; const DBGF = { tips: false, cmds: false, }; const setup = function() { GameAnnounce(); //set notify timer cb.setTimeout(GameAnnounceRepeat, 1000 * 60 * cb.settings.announceTimer); CheckWarnings(); }; // Settings cb.settings_choices = [ { name: 'multiPrizes', type: 'choice', choice1: ON, choice2: OFF, label: 'Do you want to allow multiple prizes for big tips?', required: true, defaultValue: ON }, {name: 'tier1Start', type: 'int', minValue: 0, maxValue: 1000000, label: 'Lowest tip for tier 1 prize (set Lowest and Highest to 0 to skip tier):', required: true, defaultValue: 6 }, {name: 'tier1End', type: 'int', minValue: 0, maxValue: 1000000, label: 'Highest tip for tier 1 prize (higher than Lowest tip):', required: true, defaultValue: 15 }, {name: 'tier1Prize1', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 1 Prize 1', required: false, defaultValue: 'Spank Ass' }, {name: 'tier1Prize2', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 1 Prize 2', required: false, defaultValue: 'Flash Tits' }, {name: 'tier1Prize3', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 1 Prize 3', required: false, defaultValue: 'Blow Kiss' }, {name: 'tier1Prize4', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 1 Prize 4', required: false, defaultValue: '' }, {name: 'tier1Prize5', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 1 Prize 5', required: false, defaultValue: '' }, {name: 'tier2Start', type: 'int', minValue: 0, maxValue: 1000000, label: 'Lowest tip for tier 2 prize:', required: true, defaultValue: 16 }, {name: 'tier2End', type: 'int', minValue: 0, maxValue: 1000000, label: 'Highest tip for tier 2 prize:', required: true, defaultValue: 30 }, {name: 'tier2Prize1', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 2 Prize 1', required: false, defaultValue: 'Suck Nipples' }, {name: 'tier2Prize2', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 2 Prize 2', required: false, defaultValue: 'Spread Ass or Pussy' }, {name: 'tier2Prize3', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 2 Prize 3', required: false, defaultValue: 'Tie up Tits' }, {name: 'tier2Prize4', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 2 Prize 4', required: false, defaultValue: '' }, {name: 'tier2Prize5', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 2 Prize 5', required: false, defaultValue: '' }, {name: 'tier3Start', type: 'int', minValue: 0, maxValue: 1000000, label: 'Lowest tip for tier 3 prize:', required: true, defaultValue: 31 }, {name: 'tier3End', type: 'int', minValue: 0, maxValue: 1000000, label: 'Highest tip for tier 3 prize:', required: true, defaultValue: 60 }, {name: 'tier3Prize1', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 3 Prize 1', required: false, defaultValue: 'Wand on Clit' }, {name: 'tier3Prize2', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 3 Prize 2', required: false, defaultValue: 'Womanizer on Clit' }, {name: 'tier3Prize3', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 3 Prize 3', required: false, defaultValue: 'Eat Paige Pussy' }, {name: 'tier3Prize4', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 3 Prize 4', required: false, defaultValue: 'Suck Atthem Dick' }, {name: 'tier3Prize5', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 3 Prize 5', required: false, defaultValue: 'Fuck Atthem' }, {name: 'tier4Start', type: 'int', minValue: 0, maxValue: 1000000, label: 'Lowest tip for tier 4 prize:', required: true, defaultValue: 61 }, {name: 'tier4End', type: 'int', minValue: 0, maxValue: 1000000, label: 'Highest tip for tier 4 prize:', required: true, defaultValue: 100 }, {name: 'tier4Prize1', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 4 Prize 1', required: false, defaultValue: 'Free ManyVids Video' }, {name: 'tier4Prize2', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 4 Prize 2', required: false, defaultValue: '3 Raffle Tickets' }, {name: 'tier4Prize3', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 4 Prize 3', required: false, defaultValue: 'Paige Toy Show' }, {name: 'tier4Prize4', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 4 Prize 4', required: false, defaultValue: '' }, {name: 'tier4Prize5', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 4 Prize 5', required: false, defaultValue: '' }, {name: 'tier5Start', type: 'int', minValue: 0, maxValue: 1000000, label: 'Lowest tip for tier 5 prize:', required: true, defaultValue: 101 }, {name: 'tier5End', type: 'int', minValue: 0, maxValue: 1000000, label: 'Highest tip for tier 5 prize:', required: true, defaultValue: 200 }, {name: 'tier5Prize1', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 5 Prize 1', required: false, defaultValue: '2 Free ManyVids Videos' }, {name: 'tier5Prize2', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 5 Prize 2', required: false, defaultValue: '5 Raffle Tickets' }, {name: 'tier5Prize3', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 5 Prize 3', required: false, defaultValue: '' }, {name: 'tier5Prize4', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 5 Prize 4', required: false, defaultValue: '' }, {name: 'tier5Prize5', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 5 Prize 5', required: false, defaultValue: '' }, {name: 'tier6Start', type: 'int', minValue: 0, maxValue: 1000000, label: 'Lowest tip for tier 6 prize:', required: true, defaultValue: 1000 }, {name: 'tier6End', type: 'int', minValue: 0, maxValue: 1000000, label: 'Highest tip for tier 6 prize:', required: true, defaultValue: 1500 }, {name: 'tier6Prize1', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 6 Prize 1', required: false, defaultValue: 'Free Raffle Package' }, {name: 'tier6Prize2', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 6 Prize 2', required: false, defaultValue: '' }, {name: 'tier6Prize3', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 6 Prize 3', required: false, defaultValue: '' }, {name: 'tier6Prize4', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 6 Prize 4', required: false, defaultValue: '' }, {name: 'tier6Prize5', type: 'str', minLength: 0, maxLength: 1000, label: 'Tier 6 Prize 5', required: false, defaultValue: '' }, {name: 'announceTimer', type: 'int', minValue: 1, maxValue: 60, label: 'Number of minutes between announcing the game:', required: true, defaultValue: 4 }, ]; const roll = function(max) { return Math.floor(1 + Math.random() * max); }; const randomizer = function(options) { return function() { var chosen = ''; while (!chosen) chosen = options[(roll(options.length)-1)]; return chosen; }; }; const random = function(options) { return randomizer(options)(); }; cb.onMessage(function(msg) { if (msg.m == '/p' && (msg.is_mod || msg.user == cb.room_slug)) GameAnnounce(); }); cb.onTip(function(tip) { var tokens = tip.amount; var tokensOrg = tokens; var source = tip.from_user; var prize = ''; var lucky = 0; var note = ''; // fan club bonus - if they are a member, their tip can be multiplied by 1.5 or 2, to a max of 500. if (source.in_fanclub && tokens < 500) { lucky = roll(100); if (lucky > 80) { tokens = tokens * 2; // 20% chance for *2 } else if (lucky > 60) { tokens = tokens * 1.5; // 20% chance for *1.5 } if (tokens > 500) tokens = 500; // max of 500 } // announce fan club luck if (lucky > 0) { note = 'Fan Club Member ' + source + ' got lucky! Their tip of ' + tokensOrg + ' was upgraded to ' + tokens + ' for Random Prizes!!!'; cb.sendNotice(note,'','#ffffff','#009900'); } do { // check tier 6 if (tokens >= tier6Min) { if (tier6Min != 0 && tier6Max != 0); { prize = random(tier6Array); tokens -= tier6Max; } } // check tier 5 else if (tokens >= tier5Min) { if (tier5Min != 0 && tier5Max != 0); { prize = random(tier5Array); tokens -= tier5Max; } } // check tier 4 else if (tokens >= tier4Min) { if (tier4Min != 0 && tier4Max != 0); { prize = random(tier4Array); tokens -= tier4Max; } } // check tier 3 else if (tokens >= tier3Min) { if (tier3Min != 0 && tier3Max != 0); { prize = random(tier3Array); tokens -= tier3Max; } } // check tier 2 else if (tokens >= tier2Min) { if (tier2Min != 0 && tier2Max != 0); { prize = random(tier2Array); tokens -= tier2Max; } } // check tier 1 else if (tokens >= tier1Min) { if (tier1Min != 0 && tier1Max != 0); { prize = random(tier1Array); tokens -= tier1Max; } } else { tokens = 0; } // announce prize if (prize != '') { note = source + ' won a Random Prize!!! ' + prize; cb.sendNotice(note,'','#ffffff','#0066ff'); } // check for multi-prize. if (cb.settings.multiPrizes == OFF) tokens = 0; } while (tokens > 0); }); const CheckWarnings = function() { // highest bigger than lowest if (tier1Min > tier1Max) { note = 'WARNING!!! Tier 1 token settings are invalid!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier2Min > tier2Max) { note = 'WARNING!!! Tier 2 token settings are invalid!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier3Min > tier3Max) { note = 'WARNING!!! Tier 3 token settings are invalid!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier4Min > tier4Max) { note = 'WARNING!!! Tier 4 token settings are invalid!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier5Min > tier5Max) { note = 'WARNING!!! Tier 5 token settings are invalid!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier6Min > tier6Max) { note = 'WARNING!!! Tier 6 token settings are invalid!'; cb.sendNotice(note,'','#ffff00','#000000'); } // non-skipped tiers have at least 1 prize if (tier1Min != 0 && tier1Max !=0 && tier1Array.length == 0) { note = 'WARNING!!! Tier 1 contains no prizes!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier2Min != 0 && tier2Max !=0 && tier2Array.length == 0) { note = 'WARNING!!! Tier 2 contains no prizes!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier3Min != 0 && tier3Max !=0 && tier3Array.length == 0) { note = 'WARNING!!! Tier 3 contains no prizes!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier4Min != 0 && tier4Max !=0 && tier4Array.length == 0) { note = 'WARNING!!! Tier 4 contains no prizes!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier5Min != 0 && tier5Max !=0 && tier5Array.length == 0) { note = 'WARNING!!! Tier 5 contains no prizes!'; cb.sendNotice(note,'','#ffff00','#000000'); } if (tier6Min != 0 && tier6Max !=0 && tier6Array.length == 0) { note = 'WARNING!!! Tier 6 contains no prizes!'; cb.sendNotice(note,'','#ffff00','#000000'); } } const GameAnnounce = function() { var note = '-------------------- Random Prize Bot, written by Atthem --------------------'; if (tier1Min != 0 && tier1Max != 0) { note += "\n" + 'Tip ' + tier1Min + ' - ' + tier1Max + ' tks for a random prize: '; for (i = 0; i < tier1Array.length; i++) { if (tier1Array[i] != '') { if (i != 0) note += '; OR '; note += tier1Array[i]; } } note += "\n" + '----------------------------------------------------'; } if (tier2Min != 0 && tier2Max != 0) { note += "\n" + 'Tip ' + tier2Min + ' - ' + tier2Max + ' tks for a random prize: '; for (i = 0; i < tier2Array.length; i++) { if (tier2Array[i] != '') { if (i != 0) note += '; OR '; note += tier2Array[i]; } } note += "\n" + '----------------------------------------------------'; } if (tier3Min != 0 && tier3Max != 0) { note += "\n" + 'Tip ' + tier3Min + ' - ' + tier3Max + ' tks for a random prize: '; for (i = 0; i < tier3Array.length; i++) { if (tier3Array[i] != '') { if (i != 0) note += '; OR '; note += tier3Array[i]; } } note += "\n" + '----------------------------------------------------'; } if (tier4Min != 0 && tier4Max != 0) { note += "\n" + 'Tip ' + tier4Min + ' - ' + tier4Max + ' tks for a random prize: '; for (i = 0; i < tier4Array.length; i++) { if (tier4Array[i] != '') { if (i != 0) note += '; OR '; note += tier4Array[i]; } } note += "\n" + '----------------------------------------------------'; } if (tier5Min != 0 && tier5Max != 0) { note += "\n" + 'Tip ' + tier5Min + ' - ' + tier5Max + ' tks for a random prize: '; for (i = 0; i < tier5Array.length; i++) { if (tier5Array[i] != '') { if (i != 0) note += '; OR '; note += tier5Array[i]; } } note += "\n" + '----------------------------------------------------'; } if (tier6Min != 0 && tier6Max != 0) { note += "\n" + 'Tip ' + tier6Min + ' - ' + tier6Max + ' tks for a random prize: '; for (i = 0; i < tier6Array.length; i++) { if (tier6Array[i] != '') { if (i != 0) note += '; OR '; note += tier6Array[i]; } } note += "\n" + '----------------------------------------------------'; } note += "\n" + '----------------------------------------------------------------------------------'; cb.sendNotice(note,'','#ffffff','#004d00'); }; const GameAnnounceRepeat = function() { GameAnnounce(); cb.setTimeout(GameAnnounceRepeat, 1000 * 60 * cb.settings.announceTimer); }; // Init cb.setTimeout(function() { setup(); }, 1000);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.