Bots Home
|
Create an App
fgfgj
Author:
alonsotest
Description
Source Code
Launch Bot
Current Users
Created by:
Alonsotest
/** * Emma Foxxy Findom Game * Version: 1.0 * Author: TheMenInBlack * Date: 2018-10-07 */ /* * A board game with 27 fields. The piece remains at its field until the next roll. For fun, a special event is added. */ cb.settings_choices = [ { name: 'tokens', type: 'int', minValue: 1, label: 'How much do you want to charge per roll?', defaultValue: 25 }, /** * { * name: 'die_type', * type: 'choice', * label: 'Use Traditional (6-sided) or Chinese (10-sided) dice?', * choice1: 'Traditional', * choice2: 'Chinese', * defaultValue: 'Traditional' * }, */ { name: 'multirolls', type: 'int', minValue: 1, label: 'What is the maximum number of rolls you want a user to be able to make in a single tip? (set to 1 to disable) Example: If you set this to 3 and you charge 33 tokens per roll, a user could tip 66 for 2 rolls or 99 for 3 rolls. Any other tip amounts will be ignored.', defaultValue: 3 }, { name: 'minimum_rolls', type: 'choice', label: 'What is the minimum number of rolls before the rare dice can appear? (Keep this a secret!)', choice1: 5, choice2: 10, choice3: 15, choice4: 20, choice5: 25, choice6: 30, choice7: 35, choice8: 40, choice9: 45, choice10: 50, choice11: 55, choice12: 60, defaultValue: 20 }, { name: 'notice_wait_time', type: 'choice', label: 'In minutes, how often should the app advertise itself?', choice1: 5, choice2: 10, choice3: 15, choice4: 20, choice5: 25, choice6: 30, choice7: 45, choice8: 60, defaultValue: 10 }, { name: 'change_room_subject', type: 'choice', label: 'Change room subject when using this bot?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, {name: 'field_1', type: 'str', label: 'Field number 1', defaultValue: '1 Tip 15'}, {name: 'field_2', type: 'str', label: 'Field number 2', defaultValue: '2 Ass'}, {name: 'field_3', type: 'str', label: 'Field number 3', defaultValue: '3 Feet'}, {name: 'field_4', type: 'str', label: 'Field number 4', defaultValue: '4 Strapon'}, {name: 'field_5', type: 'str', label: 'Field number 5', defaultValue: '5 Tip 25'}, {name: 'field_6', type: 'str', label: 'Field number 6', defaultValue: '6 SPH'}, {name: 'field_7', type: 'str', label: 'Field number 7', defaultValue: '7 Tip 35'}, {name: 'field_8', type: 'str', label: 'Field number 8', defaultValue: '8 Feet'}, {name: 'field_9', type: 'str', label: 'Field number 9', defaultValue: '9 Tip 15'}, {name: 'field_10', type: 'str', label: 'Field number 10', defaultValue: '10 Ass'}, {name: 'field_11', type: 'str', label: 'Field number 11', defaultValue: '11 Tip 25'}, {name: 'field_12', type: 'str', label: 'Field number 12', defaultValue: '12 Next x2'}, {name: 'field_13', type: 'str', label: 'Field number 13', defaultValue: '13 Strapon'}, {name: 'field_14', type: 'str', label: 'Field number 14', defaultValue: '14 Tip 35'}, {name: 'field_15', type: 'str', label: 'Field number 15', defaultValue: '15 Feet'}, {name: 'field_16', type: 'str', label: 'Field number 16', defaultValue: '16 Restart Loser'}, {name: 'field_17', type: 'str', label: 'Field number 17', defaultValue: '17 Tip 15'}, {name: 'field_18', type: 'str', label: 'Field number 18', defaultValue: '18 Feet'}, {name: 'field_19', type: 'str', label: 'Field number 19', defaultValue: '19 Tip 25'}, {name: 'field_20', type: 'str', label: 'Field number 20', defaultValue: '20 Ass'}, {name: 'field_21', type: 'str', label: 'Field number 21', defaultValue: '21 Tip 35'}, {name: 'field_22', type: 'str', label: 'Field number 22', defaultValue: '22 SPH'}, {name: 'field_23', type: 'str', label: 'Field number 23', defaultValue: '23 Ass'}, {name: 'field_24', type: 'str', label: 'Field number 24', defaultValue: '24 Tip 15'}, {name: 'field_25', type: 'str', label: 'Field number 25', defaultValue: '25 Strapon'}, {name: 'field_26', type: 'str', label: 'Field number 26', defaultValue: '26 Tip 25'}, {name: 'field_27', type: 'str', label: 'Field number 27', defaultValue: '27 Feet'}, {name: 'field_28', type: 'str', label: 'Prize for rolling 13 (RARE prize)', defaultValue: 'Block Account'}, ]; var price = cb.settings.tokens; var langTokens = (price > 1) ? 'tokens' : 'token'; var numberOfSides = 6; var multiRolls = cb.settings.multirolls; var lastRoller = '--'; var position = 0; //field position on board, start is 0 var rollCounter = 0; var tipCounter = 0; var winners = []; var fields = []; var minimumRollsToGetRareDice = parseInt(cb.settings.minimum_rolls); var maxOutcome = 13; var maxfields = 27; //without rare prize var dieImagePrefix = ':reddie'; var rareChance = 10; // percent chance of rolling a RARE (minimum rolls must also be met) cb.onTip(function (tip) { var maxTip = multiRolls * price; var tipAmount = parseInt(tip['amount']); // check to see if tip was for a dice roll if (tipAmount >= price && (maxTip / tipAmount <= multiRolls) && (tipAmount % price == 0)) { var numberOfRolls = Math.floor(parseInt(tip['amount']) / price); 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 = '#FFFFFF'; var bgColor = '#0000FF'; //cb.sendNotice('Tip was not for dice roll.', '', bgColor, textColor, 'bold'); //tipCounter += parseInt(tip['amount']); cb.drawPanel(); } }); //maybe without DrawPanel /*cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Last field:', 'row1_value': position, 'row2_label': 'Last player:', 'row2_value': lastRoller, 'row3_value': tipCounter + ' ' + langTokens + ' received / rolled ' + rollCounter + ' time(s)' }; });*/ cb.onEnter(function (user) { showAppAd(user['user']); }); cb.onMessage(function (msg) { if (msg['m'].match(/!winners/i)) { msg['X-Spam'] = true; showFieldsWon(msg['user']); } else if (msg['m'].match(/!lol/i)) { msg['X-Spam'] = true; if (msg['m'].match(/all/i) && ((msg['is_mod'] == true) || (msg['user'] == cb.room_slug))) { showPrizes(); } else { showFields(msg['user']); } } if (msg['m'].match(/!info/i)) { msg['X-Spam'] = true; showappinformation(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, maybe change to Dubblets, therefore change numberofsides -1 if (rollCounter > minimumRollsToGetRareDice) { if (Math.random() <= 1 / (rareChance / 100)) { die1 = 7; } } var total = die1 + die2; var winner = false; // calculation of the new field on board if (total >= 1){ winner = true; position = (position + total) % maxfields; var field = cb.settings['field_' + position]; } else { winner = false; var field = 'A Thank You!'; } var msg = dieImagePrefix + die1 + " " + dieImagePrefix + die2 + "\n"; msg += username + " rolled a " + total + "! \n".toUpperCase(); msg += "Roll #" + rollCounter + " | Field: " + field; var textColor = '#FFFFFF'; var bgColor = '#0000FF'; if (winner) textColor = '#FFFFFF'; if (total == maxOutcome) { bgColor = '#0000FF'; textColor = '#FFFFFF'; } cb.sendNotice(msg, '', bgColor, textColor, 'bold'); winners.push("Roll #" + rollCounter + " (" + total + "): " + username + " - " + field); cb.drawPanel(); } function setFields() { var rareText = ''; for (var i = 1; i <= maxfields + 1; i++) { if (i == maxfields + 1) rareText = " (RARE)"; fields.push(cb.settings['field_' + i] + rareText); } } function showFields(username) { //delete all and use graphic instead if (fields.length) { var rareText = ''; var msg = "##### POSSIBLE FIELDS #####"; for (var i = 1; i <= maxfields + 1 ; i++) { if (i == maxfields + 1 ) rareText = " (RARE)"; if (fields.indexOf(cb.settings['field_' + i] + rareText) >= 0) msg += "\nField " + i + " - " + cb.settings['field_' + i] + rareText; } msg += "\n:emmafoxygames1"; } else { var msg = "SORRY! There are no fields left in the list, but thank you for the tip. :thumbsup"; } cb.sendNotice(msg, username, '#0000FF', '#FFFFFF', 'bold'); } function showFieldsWon(username) { var msg = "##### LAST 20 WINNERS #####"; msg += "\nList sorted in chronological order"; if (winners.length == 0) { cb.sendNotice('No one has won anything yet. Roll the dice to move the piece on the board!', username, '#0000FF', '#FFFFFF', 'bold'); } else { var recentWinners = winners.slice(-20); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, '#0000FF', '#FFFFFF', 'bold'); } } function showappinformation(username) { var msg = "##### app information ##### "; msg += "\nEmma Foxxy Findom Game \n"; msg += "made by TheMenInBlack \n"; msg += "version - 1.0 \n"; msg += "release date - 2018-10-08 \n"; msg += "(Tweaked from Roll the Dice and its modifications by jeffreyvels1994) \n"; msg += "Type \"!lol\" to see the list of fields \n"; msg += "Type \"!lol all\" to send the list to all viewers if you're a mod or the broadcaster\n"; msg += "Type \"!winners\" to see a list of the last 20 turns "; cb.sendNotice(msg, username, '#0000FF', '#FFFFFF', 'bold'); } function advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } function showAppAd(username) { var msg = ""; msg += "We are playing Emma Foxxy Findom Game - by TheMenInBlack \n"; msg += "Each roll moves the piece. There are " + fields.length + " possible fields.\n"; msg += "Tip " + price + " " + langTokens + " to roll the dice. \n"; if (multiRolls > 1) msg += "You can roll a maximum of " + multiRolls + " times in a single tip (" + (multiRolls*price) + " tokens). \n"; msg += "Type \"!info\" to see the (app information)\n"; msg += "Type \"!lol\" to see the list of fields \n"; msg += "Type \"!lol all\" to send the list to all viewers if you're a mod or the broadcaster \n"; msg += "Type \"!winners\" to see a list of the last 20 turns "; cb.sendNotice(msg, username, '#0000FF', '#FFFFFF', 'bold'); } function init() { setFields(); advertise(); if (cb.settings.change_room_subject == 'Yes') { cb.changeRoomSubject('Tip ' + price + ' ' + langTokens + ' to roll the dice and move the piece on the board!'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.