Bots Home
|
Create an App
dice6944
Author:
i_love_asian_women
Description
Source Code
Launch Bot
Current Users
Created by:
I_Love_Asian_Women
cb.settings_choices = [{ name: 'tokens', type: 'int', minValue: 1, label: 'How many tokens to roll the dice', defaultValue: 50 }, { name: 'prize_2', type: 'str', label: 'Prize for rolling a 2', defaultValue: 'suck finger' }, { name: 'prize_3', type: 'str', label: 'Prize for rolling a 3', defaultValue: 'dance' }, { name: 'prize_4', type: 'str', label: 'Prize for rolling a 4', defaultValue: 'spank ass' }, { name: 'prize_5', type: 'str', label: 'Prize for rolling a 5', defaultValue: 'flash tits' }, { name: 'prize_6', type: 'str', label: 'Prize for rolling a 6', defaultValue: 'flash pussy' }, { name: 'prize_7', type: 'str', label: 'Prize for rolling a 7', defaultValue: 'flash ass' }, { name: 'prize_8', type: 'str', label: 'Prize for rolling a 8', defaultValue: 'rub nipples' }, { name: 'prize_9', type: 'str', label: 'Prize for rolling a 9', defaultValue: 'blow kiss' }, { name: 'prize_10', type: 'str', label: 'Prize for rolling a 10', defaultValue: 'rub pussy' }, { name: 'prize_11', type: 'str', label: 'Prize for rolling a 11', defaultValue: 'show feet' }, { name: 'prize_12', type: 'str', label: 'Prize for rolling a 12', defaultValue: 'lick lips' }, { name: 'notice_wait_time', type: 'int', label: 'How often to advertise bot? (in minutes)', minValue: 1, defaultValue: 5 }, ]; var price = cb.settings.tokens; var langTokens = (price > 1) ? 'tokens' : 'token'; var numberOfSides = (cb.settings.die_type == 'Traditional') ? 6 : 6; var multiRolls = cb.settings.multirolls; var lastRoller = '--'; var lastPrizeWon = '--'; var rollCounter = 0; var tipCounter = 0; var winners = []; var prizes = []; var minimumRollsToGetRareDice = parseInt(cb.settings.minimum_rolls); var maxOutcome = (cb.settings.die_type == 'Traditional') ? 12 : 12; var dieImagePrefix = (cb.settings.die_type == 'Traditional') ? ':dier' : ':dier'; var rareChance = 0; // percent chance of rolling a RARE (minimum rolls must also be met) var addTimer = 3; cb.onTip(function(tip) { var tipAmount = parseInt(tip['amount']); // check to see if tip was for a dice roll if (tipAmount = price && (tipAmount % price == 0)) { var numberOfRolls = Math.floor(tipAmount / price); if (numberOfRolls > multiRolls) { if (cb.settings.too_high_multiples == 'Roll the dice as often as allowed') { numberOfRolls = multiRolls; } else { numberOfRolls = 0; } } for (var i = 0; i < numberOfRolls; i++) { roll(tip['from_user']); lastRoller = tip['from_user']; } } else { // Tip was for something else, don't roll the dice var textColor = '#000000'; var bgColor = '#D9FAD7'; //cb.sendNotice('Tip was not for dice roll.', '', bgColor, textColor, 'bold'); //tipCounter += parseInt(tip['amount']); cb.drawPanel(); } }); cb.onEnter(function(user) { showAppAd(user['user']); }); cb.onMessage(function(msg) { if (msg['m'].match(/winners?/i)) { msg['X-Spam'] = true; showPrizesWon(msg['user']); } else if (msg['m'].match(/prizes?/i)) { msg['X-Spam'] = true; if (msg['m'].match(/send/i) && ((msg['is_mod'] == true) || (msg['user'] == cb.room_slug))) { showPrizes(); } else { showPrizes(msg['user']); } } return msg; }); function roll(username) { rollCounter++; var die1 = Math.floor(Math.random() * numberOfSides) + 1; var die2 = Math.floor(Math.random() * numberOfSides) + 1; // see if there's a chance we can roll a rare die if (rollCounter > minimumRollsToGetRareDice) { if (Math.random() <= (rareChance / 100)) { die1 = 7; } } var total = die1 + die2; var winner = false; if (total >= 1) { winner = true; var prize = cb.settings['prize_' + total]; } else { winner = false; var prize = 'A Thank You!'; } var rareText = ''; if (total == maxOutcome) rareText = " "; var prizeIndex = prizes.indexOf(prize + rareText); if (prizeIndex >= 0) { if (cb.settings.remove_winning_prize == 'Yes') prizes.splice(prizeIndex, 1); } else { prize = 'A Thank You!'; } var msg = dieImagePrefix + die1 + " " + dieImagePrefix + die2 + "\n"; msg += username + " rolled a " + total + "! \n".toUpperCase(); msg += "Prize = " + prize; var textColor = '#ff0000'; var bgColor = '#ffffff'; if (winner) textColor = '#ff0000'; if (total == maxOutcome) { bgColor = '#ffffff'; textColor = '#ff0000'; } cb.sendNotice(msg, '', bgColor, textColor, 'bold'); lastPrizeWon = prize; winners.push(username + " - " + prize); cb.drawPanel(); } function setPrizes() { var rareText = ''; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = " "; prizes.push(cb.settings['prize_' + i] + rareText); } } function showPrizes(username) { if (prizes.length) { var rareText = ''; var msg = "##### POSSIBLE PRIZES #####"; for (var i = 2; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = " "; if (prizes.indexOf(cb.settings['prize_' + i] + rareText) >= 0) msg += "\nRoll a " + i + " you win = " + cb.settings['prize_' + i] + rareText; } } else { var msg = "SORRY! There are no prizes left in the list, but thank you for the tip. :thumbsup"; } if (rollCounter < minimumRollsToGetRareDice) { if ((minimumRollsToGetRareDice - rollCounter) == 1) { msg += "\nOnly 1 roll until the rare die can appear." } else { msg += "\n" + (minimumRollsToGetRareDice - rollCounter) + " rolls until the rare die can appear." } } cb.sendNotice(msg, username, '#ffffff', '#ff0000', 'bold'); } function showPrizesWon(username) { var msg = "##### LAST 20 WINNERS #####"; msg += "\nList sorted in chronological order"; if (winners.length == 0) { cb.sendNotice('No one has won yet. Roll to be the first winner!', username, '#ffffff', '#ff0000', 'bold'); } else { var recentWinners = winners.slice(-20); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, '#fdb8b8', '#b20000', 'bold'); } } function advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } function showAppAd(username) { var msg = ""; msg += "We are playing Roll the Dice. \n"; msg += "Tip " + price + " " + langTokens + " to roll the dice. \n"; msg += "Each roll reveals a prize.\n"; msg += "There are 11 possible prizes.\n"; msg += "Type \"prizes?\" to see the prizes. \n"; msg += "Type \"winners?\" to see the winners."; cb.sendNotice(msg, username, '#ff0000', '#ffffff', 'bold'); } function init() { setPrizes(); advertise(); if (cb.settings.change_room_subject == 'Yes') { cb.changeRoomSubject('Tip ' + price + ' ' + langTokens + ' to roll the dice and win a prize!'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.