Apps Home
|
My Uploads
|
Create an App
Red Rum App
Author:
dorothy
Description
Source Code
Launch App
Current Users
Created by:
Dorothy
App Images
/** Name: Roo's Red Rum Author: chelsea2950 Created 10/25/2019 **/ {cb.settings_choices = [ {name: 'intro', label: '********************** RED RUM ************************ Latest Updt: 10/25/2019 (version 1.0) ********************************************************* Welcome to Roo\'s Red Rum. You can define the "Who", "Where", and "With What", similar to what is used in the game of Clue. This app lets the user make a guess for one of the choices when the tip the specified amount, and keeps track of everyone\'s guesses so you can define a limit of how many guesses they can make within a show.', type: 'choice',required: false}, {name: 'gameSubjectText', label: 'Title? -- Description of the show to appear as part of the room title (optional). You can include hashtags for keywords you want to be searchable', type:'str', minLength: 1,maxLength: 200, required: false, defaultValue: 'Welcome to our Community game of Red Tum 2019. The game overview, rules, and commands will be shown in the chat.'}, {name: 'whoList', label: 'Specify the list of "Who" characters that people will be guessing from. This list will show up in the tip menu selection box when guessing peopleUser names should be separated by a comma', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Roo Rain (roorain), Ivy Ward (ivyward), Nick & Eli (thisisfuckingfun), Liv & Drew (livanddrew), Batman & Nelle (nellebeachgirl & batmansuperhero), Chris & Chantelle (ohyeaaaaaaaah), Nicole Valley (sub_nicolevalley), Rick (unicornspit11)', required: false}, {name: 'whoPrice', label: 'Specify the price people must tip to make a guess for "Who" (all three prices can be the same if you like).', type: 'int',minValue: 1,maxValue: 999,defaultValue: 5}, {name: 'whereList', label: 'Specify the list of "Where" characters that people will be guessing from. This list will show up in the tip menu selection box when guessing people. Places should be separated by a comma', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Domi, Buttplug, Paddle, Lube, Dildo, Flogger, Penis Pump, Ball Gag, Handcuffs', required: false}, {name: 'wherePrice', label: 'Specify the price people must tip to make a guess for "Where" (all three prices can be the same if you like).', type: 'int',minValue: 1,maxValue: 999,defaultValue: 5}, {name: 'whatList', label: 'Specify the list of "With What" objects that people will be guessing from. This list will show up in the tip menu selection box when guessing peopleUser names should be separated by a comma', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Shower, Trailer, Garage, Pool, Bedroom, Kitchen, Closet, Basement, Country of South Africa, Cabin', required: false}, {name: 'whatPrice', label: 'Specify the price people must tip to make a guess for "With What" (all three prices can be the same if you like).', type: 'int',minValue: 1,maxValue: 999,defaultValue: 5}, {name: 'maxGuesses', label: 'What is the maximum number of guesses that can be made by one person within a show?', type: 'int',minValue: 1,maxValue: 999,defaultValue: 3}, {name: 'gameNoticeInterval',type: 'str',defaultValue: 1.8,required: false,label: 'Game Notice display interval in minutes. The Game notice contains a general intro to the game, and information on the current settings. Note that additional personalized information can be displayed in the Game Rules section below. For this setting, leave at zero to disable the recurring message. Decimals are ok as long as they are greater than 1. For example, 1.5 = one minute 30 second intervals.'}, {name: 'dummy2', label: '***************** Game Rules ****************** Define up to 8 rules that will be displayed to user. If enabled, the rules will be shown to every user when they enter the room, and can also be displayed on the chat on a recurring basis if you define a timer.', type: 'choice',required: false}, {name: 'enableGameRules', label: 'Would you like to display Room Rules to users when they enter the room? Up to 8 rules can be entered. "Next line" feature enabled with {n}', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'gameRulesInterval',type: 'str',defaultValue: 2.1,required: false,label: 'Game Rules display interval in minutes, leave at zero to disable the recurring message (will still be shown when they enter based on "enable" setting above). Decimals are ok as long as they are greater than 1. For example, 1.5 = one minute 30 second intervals.'}, {name: 'gameRule1', label: 'Rule #1', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'Game Info: Sally Creampie was brutally done in by a fellow broadcaster using her own sex toys!'}, {name: 'gameRule2', label: 'Rule #2', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'Your job is to visit the rooms of the suspected broadcasters and question them and find out who was behind it.'}, {name: 'gameRule3', label: 'Rule #3', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'This game will start on Oct 28th and go until there is a winner.'}, {name: 'gameRule4', label: 'Rule #4', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'The broadcasters participating (the suspects) are listed in the Game Notice, also shown in the chat.'}, {name: 'gameRule5', label: 'Rule #5', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'Rule #1: You can only ask a total of 3 questions from each broadcaster per day.'}, {name: 'gameRule6', label: 'Rule #6', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'Rule #2: You can ask any combination of questions with those three guesses.'}, {name: 'gameRule7', label: 'Rule #7', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'Rule #3: Each question must be in a tip note of the correct amount. Tips with the correct amount but no question, or tips that exceed your 3 guesses will be ignored.'}, {name: 'gameRule8', label: 'Rule #8', required: false,type: 'str', minLength: 0, maxLength: 200, defaultValue: 'Rule #4: Please do not share your questions and answers in the public chat. Please do not play with multiple IDs to get more guesses.'} ]; } { // *********************************** Variables and Arrays ************************************** var initialize = 0; var BC = cb.room_slug; var gameSubjectText = cb.settings.gameSubjectText; var whoList = cb.settings.whoList; var whatList = cb.settings.whatList; var whereList = cb.settings.whereList; var whoPrice = cb.settings.whoPrice; var whatPrice = cb.settings.whatPrice; var wherePrice = cb.settings.wherePrice; var gameNoticeInterval = cb.settings.gameNoticeInterval; var maxGuesses = cb.settings.maxGuesses; var gameRulesInterval = cb.settings.gameRulesInterval; var totalGuesses = 0; var gameRule1 = cb.settings.gameRule1; var gameRule2 = cb.settings.gameRule2; var gameRule3 = cb.settings.gameRule3; var gameRule4 = cb.settings.gameRule4; var gameRule5 = cb.settings.gameRule5; var gameRule6 = cb.settings.gameRule6; var gameRule7 = cb.settings.gameRule7; var gameRule8 = cb.settings.gameRule8; var appNoticeColor = '#f4d599'; var dashLine80 = new Array(80).join('-'); var dashLine60 = new Array(60).join('-'); var dashLine70 = new Array(70).join('-'); var dashLine90 = new Array(90).join('-'); var backgroundImage = '260ee3a8-07de-4c64-a9f4-2eeb2ef623ef'; var fontSize = 12; var textColor = 'red'; var leftjust1 = 20; var leftjust2 = 20; var leftjust3 = 20; var topjust1 = 4; var topjust2 = 26; var topjust3 = 49; // Arrays */ var whoTipsOn = []; var whatTipsOn = []; var whereTipsOn = []; var whoListArray = []; var whatListArray = []; var whereListArray = []; var guessList = {name: [], guesses: []}; var drawpanel = {panel: {}}; var gameRulesArray = []; } { // *********************************** Functions ************************************** { // Generic functions to set the color or separator characters function checkTextColor(color) { switch (color) { case 'White/No color': return '#FFFFFF'; case 'Black': return '#000000'; case 'Dark Blue': return '#0629AC'; case 'Dark Pink': return '#FF6680'; case 'Dark Green': return '#006600'; case 'Dark Red': return '#cc0000'; case 'Dark Purple': return '#3d003d'; case 'Dark Grey': return '#737373'; case 'Dark Orange': return '#e77400'; case 'Dark Aqua': return '#006767'; case 'Dark Gold': return '#998100'; case 'Dark Teal': return '#003f1f'; case 'Dark Brown': return '#582c00'; case 'Dark Bronze': return '#a56728'; case 'Dark Periwinkle': return '#155bd7'; case 'Dark Fuschia': return '#d6155c'; case 'Dark Lime': return '#6b790c'; case 'Dark Plum': return '#7f13bf'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function checkBgColor(color) { switch (color) { case 'White/No color': return '#FFFFFF'; case 'Light Aqua': return '#adeaea'; case 'Light Pink': return '#FFE6EA'; case 'Light Green': return '#94e594'; case 'Light Red': return '#ff9a9a'; case 'Light Purple': return '#f2cdff'; case 'Light Orange': return '#ffd9b3'; case 'Light Grey': return '#e6e6e6'; case 'Light Blue': return '#d1eaee'; case 'Light Yellow': return '#ffff94' case 'Cream': return '#f9f6ed' case 'Light Bronze': return '#ebccad'; case 'Light Periwinkle': return '#d7e4fb'; case 'Light Teal': return '#d7fbee'; case 'Light Fuschia': return '#fbd7e4'; case 'Light Lime': return '#ecf6a7'; case 'Light Plum': return '#e3c0f9'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function leftJustify(textstring,line) { textStringLength = textstring.length; if (fontSize == 11) { if (line == 1) { if (textStringLength < 4) { return 114; } else if (textStringLength < 6) { return 109; } else if (textStringLength < 8) { return 104; } else if (textStringLength < 10) { return 100; } else if (textStringLength < 12) { return 95; } else if (textStringLength < 14) { return 90; } else if (textStringLength < 16) { return 86; } else if (textStringLength < 18) { return 82; } else if (textStringLength < 20) { return 77; } else if (textStringLength < 22) { return 72; } else if (textStringLength < 24) { return 67; } else if (textStringLength < 26) { return 62; } else if (textStringLength < 28) { return 58; } else if (textStringLength < 30) { return 53; } else if (textStringLength < 32) { return 49; } else if (textStringLength < 34) { return 44; } else if (textStringLength < 37) { return 39; } else if (textStringLength < 40) { return 34; } else if (textStringLength < 42) { return 30; } else if (textStringLength < 44) { return 26; } else if (textStringLength < 47) { return 21; } else if (textStringLength < 49) { return 16; } else if (textStringLength < 51) { return 11; } else { return 7; } } else { if (textStringLength < 4) { return 114; } else if (textStringLength < 6) { return 110; } else if (textStringLength < 8) { return 105; } else if (textStringLength < 10) { return 100; } else if (textStringLength < 12) { return 97; } else if (textStringLength < 14) { return 93; } else if (textStringLength < 16) { return 88; } else if (textStringLength < 18) { return 83; } else if (textStringLength < 20) { return 79; } else if (textStringLength < 22) { return 74; } else if (textStringLength < 24) { return 71; } else if (textStringLength < 26) { return 66; } else if (textStringLength < 28) { return 61; } else if (textStringLength < 30) { return 57; } else if (textStringLength < 32) { return 53; } else if (textStringLength < 34) { return 48; } else if (textStringLength < 37) { return 44; } else if (textStringLength < 39) { return 39; } else if (textStringLength < 42) { return 34; } else if (textStringLength < 44) { return 29; } else if (textStringLength < 47) { return 24; } else if (textStringLength < 49) { return 19; } else if (textStringLength < 52) { return 14; } else { return 7; } } } else { if (line == 1) { if (textStringLength < 4) { return 113; } else if (textStringLength < 6) { return 108; } else if (textStringLength < 8) { return 103; } else if (textStringLength < 10) { return 99; } else if (textStringLength < 12) { return 94; } else if (textStringLength < 14) { return 89; } else if (textStringLength < 16) { return 84; } else if (textStringLength < 18) { return 80; } else if (textStringLength < 20) { return 75; } else if (textStringLength < 22) { return 70; } else if (textStringLength < 24) { return 65; } else if (textStringLength < 26) { return 60; } else if (textStringLength < 28) { return 55; } else if (textStringLength < 30) { return 50; } else if (textStringLength < 32) { return 46; } else if (textStringLength < 34) { return 41; } else if (textStringLength < 37) { return 36; } else if (textStringLength < 40) { return 31; } else if (textStringLength < 42) { return 26; } else if (textStringLength < 44) { return 22; } else if (textStringLength < 47) { return 17; } else if (textStringLength < 49) { return 12; } else if (textStringLength < 51) { return 7; } else { return 3; } } else { if (textStringLength < 4) { return 113; } else if (textStringLength < 6) { return 109; } else if (textStringLength < 8) { return 104; } else if (textStringLength < 10) { return 99; } else if (textStringLength < 12) { return 95; } else if (textStringLength < 14) { return 91; } else if (textStringLength < 16) { return 86; } else if (textStringLength < 18) { return 81; } else if (textStringLength < 20) { return 77; } else if (textStringLength < 22) { return 72; } else if (textStringLength < 24) { return 68; } else if (textStringLength < 26) { return 63; } else if (textStringLength < 28) { return 58; } else if (textStringLength < 30) { return 54; } else if (textStringLength < 32) { return 50; } else if (textStringLength < 34) { return 45; } else if (textStringLength < 37) { return 40; } else if (textStringLength < 39) { return 35; } else if (textStringLength < 42) { return 30; } else if (textStringLength < 44) { return 25; } else if (textStringLength < 47) { return 20; } else if (textStringLength < 49) { return 15; } else if (textStringLength < 52) { return 10; } else { return 3; } } } } // *********************************** Red Rum Game Functions ************************************** function initGame() { gameColors(); changeRoomSubject(); initNoticeTimer(); initRulesTimer(); cb.drawPanel(); } function gameColors() { gameTextColor = checkTextColor('Dark Red'); gameBgColor = checkBgColor('Light Pink'); rulesTextColor = checkTextColor('Dark Red'); rulesBgColor = checkBgColor('Cream'); } //function gameColors() { // if (cb.settings.gameTextColor == 'Custom') { // gameTextColor = checkTextColor(cb.settings.gameCustomTextColor); // if (gameTextColor == 'default') { // cb.sendNotice('Ticket Show - Error while setting the text color. It has to be in a HEX format. Using default value.', cb.room_slug, appNoticeColor, '', 'bold'); // gameTextColor = '#FFFFFF'; // } // } else { // gameTextColor = checkTextColor(cb.settings.gameTextColor); // } // if (cb.settings.gameBgColor == 'Custom') { // gameBgColor = checkBgColor(cb.settings.gameCustomBgColor); // if (gameBgColor == 'default') { // cb.sendNotice('Ticket Show - Error while setting the background color. It has to be in a HEX format. Using default value.', cb.room_slug, appNoticeColor, '', 'bold'); // gameBgColor = '#FFFFFF'; // } // } else { // gameBgColor = checkBgColor(cb.settings.gameBgColor); // } //} function initNoticeTimer() { if (gameNoticeInterval == '' || gameNoticeInterval == null) { cb.sendNotice('Red Rum Chat Notice Interval is not set. Using default value of 1.8 minutes.', cb.room_slug, appNoticeColor); gameNoticeInt = 1.8; } else { gameNoticeInt = parseFloat(gameNoticeInterval); } if (gameNoticeInt < 1) { cb.sendNotice('Red Rum Chat Notice Interval is too short, must be at least 1 minute. Using default value of 1.8 minutes.', cb.room_slug, appNoticeColor); gameNoticeInt = 1.8; } gameNoticeInt *= 60000; gameNoticeInt = parseInt(gameNoticeInt); cb.setTimeout(gameNoticeTimer, gameNoticeInt); } function gameNoticeTimer() { gameNotice(); cb.setTimeout(gameNoticeTimer, gameNoticeInt); } function gameNotice() { msg = ':redrum_small Welcome to Roo\'s Red Rum Game! :redrum_small'; msg += '\nIt is similar to the classic board game Clue, where you are trying to determine "who" committed a crime, "where" they did it, and "with what" object.'; msg += '\nThe format for the special Red Rum 2019 game this week includes 8 different broadcasters participating, and you can visit each room to play.'; if (whoPrice > 0) { msg += '\nTo guess "Who", type /who to set your tip type and then tip ' + whoPrice + ' tokens.' msg += '\nThe available list of suspects will be shown in the tip menu selection box, including: ' + cb.settings.whoList; } if (wherePrice > 0) { msg += '\nTo guess "Where", type /where to set your tip type and then tip ' + wherePrice + ' tokens. The available list to choose from will be shown in the tip menu drop down.' msg += '\nThe available list of locations will be shown in the tip menu selection box, including: ' + cb.settings.whereList; } if (whatPrice > 0) { msg += '\nTo guess "With What", type /what to set your tip type and then tip ' + whatPrice + ' tokens. The available list to choose from will be shown in the tip menu drop down.' msg += '\nThe available list of weapons will be shown in the tip menu selection box, including: ' + cb.settings.whatList; } msg += '\nYou can make a maximum of ' + maxGuesses + ' guesses per room per show. A guess for each type counts as one guess.'; cb.sendNotice(msg, '', gameBgColor, gameTextColor, 'bold'); } function checkExceedOK(tipBy){ if (!cbjs.arrayContains(guessList.name, tipBy)) { guessList.name.push(tipBy); guessList.guesses.push(1); totalGuesses++; return(true); } else { index = guessList.name.indexOf(tipBy); if (guessList.guesses[index] < maxGuesses) { guessList.guesses[index]++; totalGuesses++; return(true); } else { return(false); } } } function removeTipType(user) { if (cbjs.arrayContains(whereTipsOn, user)) { whereTipsOn.splice(user); } else if (cbjs.arrayContains(whoTipsOn, user)) { whoTipsOn.splice(user); } else if (cbjs.arrayContains(whatTipsOn, user)) { whatTipsOn.splice(user); } } function changeRoomSubject() { newsubject = 'Roo\'s Red Rum Game! ' + cb.settings.gameSubjectText; cb.changeRoomSubject(newsubject); } function initRulesTimer() { if (gameRulesInterval == '' || gameRulesInterval == ' ' || gameRulesInterval == null) { gameRulesInt = 0; } else { gameRulesInt = parseFloat(gameRulesInterval); } if (gameRulesInt != 0) { if (gameRulesInt < 1) { cb.sendNotice('Red Rum: Game Rules notice interval is too short, must be at least 1. Using a default value of 1 minute.', cb.room_slug, appNoticeColor); gameRulesInt = 1; } gameRulesInt *= 60000; gameRulesInt = parseInt(gameRulesInt); if (gameRulesArray.length > 0) { rulesTimer(); } } } function rulesTimer() { displayRules(''); cb.setTimeout(rulesTimer,gameRulesInt); } function displayRules(sendto) { rulemessage = 'RED RUM GAME INFO AND RULES:'; rulemessage += '\nGame Info: Sally Creampie was brutally done in by a fellow broadcaster using her own sex toys!'; rulemessage += '\nYour job is to visit the rooms of the suspected broadcasters and question them and find out who was behind it.'; rulemessage += '\nThis game will start on Oct 28th and go until there is a winner.'; rulemessage += '\nThe broadcasters participating (the suspects) are listed in the Game Notice, also shown in the chat.'; rulemessage += '\nRule #1: You can only ask a total of 3 questions from each broadcaster.'; rulemessage += '\nRule #2: You can ask any combination of questions with those three guesses.'; rulemessage += '\nRule #3: Each question must be in a tip note of the correct amount. Tips with the correct amount but no question, or tips that exceed your 3 guesses will be ignored.'; rulemessage += '\nRule #4: Please do not share your questions and answers in the public chat. Please do not play with multiple IDs to get more guesses.'; cb.sendNotice(rulemessage, sendto, rulesBgColor, rulesTextColor, 'bold'); } //function displayRules(sendto) { // rulemessage = 'RED RUM GAME INFO AND RULES:'; // for (let ruleindex = 0; ruleindex < gameRulesArray.length; ruleindex++) { // if (gameRulesArray[ruleindex]) { // rulemessage += '\n' + checkNextLine(gameRulesArray[ruleindex]); // } // } // cb.sendNotice(rulemessage, sendto, gameBgColor, gameTextColor, 'bold'); //} //********** Check Next Line Function ************** function checkNextLine(nlmessage,user) { nextLineMessageArray = nlmessage.split(' '); replace = false; subfound = true; while (subfound) { if (cbjs.arrayContains(nextLineMessageArray,'{n}')) { msgindex = nextLineMessageArray.indexOf('{n}'); nextLineMessageArray[msgindex] = '\n'; replace = true; } else { subfound = false; } } if (replace) { return cbjs.arrayJoin(nextLineMessageArray,' '); } else { return nlmessage; } } // *********************************** Help Function ************************************** function helpCommon(option,from) { if(option == null){option = '';} cb.sendNotice('Dorothys Ticket Show App Help Menu - All Users', from, appNoticeColor); cb.sendNotice('',from,appNoticeColor); cb.sendNotice( 'Ticket Show Commands:' + '\n/who : (all users) . ' + '\n/what : (all users) . ' + '\n/where : (all users) . ' + '\n/normal : (all users) . ' ,from); cb.sendNotice('',from,appNoticeColor); } function helpModBC(option,from) { var valid = 0; if(option == null) {option = '';} switch(option) { case '': { valid = 1; cb.sendNotice('Dorothys Ticket Show App Help Menu - Moderators and Broadcasters', from, appNoticeColor); cb.sendNotice('',from,appNoticeColor); cb.sendNotice( 'Ticket Show Commands:' + '\n/who : (all users) . ' + '\n/what : (all users) . ' + '\n/where : (all users) . ' + '\n/normal : (all users) . ' ,from); cb.sendNotice('',from,appNoticeColor); break; } } } } } // ******************************* Upon user entry of a Message ************************************** { cb.onMessage(function (msg) { var message = msg['m'].split(' '); var cmd = 0; var symbolString = '~`!@#$%^&*()_-+={[}]|\\:;"\'<,>.?/'; var listRegExp = /[,\s]+/; var listRegExpSpc = /[,]+/; var m = msg.m; var u = msg.user; var isMod = msg.is_mod; var isBC = (u === cb.room_slug); var BC = cb.room_slug; var command = message[0] if (message[0].charAt(0) == '/') { msg['X-Spam'] = true; switch(command) { //********* General App Commands case '/who': { cmd = 1; if (cbjs.arrayContains(whoTipsOn, u)) { cb.sendNotice('You have already enabled the "Who" Tip Type. You can tip ' + whoPrice + ' tokens to ask the broadcaster if it was one of the names from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); } else if (cbjs.arrayContains(whatTipsOn, u)) { cb.sendNotice('Changing from the "What" Tip Type to the "Who" Tip Type. You can tip ' + whoPrice + ' tokens to ask the broadcaster if it was one of the names from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whatTipsOn.splice(u); whoTipsOn.push(u); } else if (cbjs.arrayContains(whereTipsOn, u)) { cb.sendNotice('Changing from the "Where" Tip Type to the "Who" Tip Type. You can tip ' + whoPrice + ' tokens to ask the broadcaster if it was one of the names from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whereTipsOn.splice(u); whoTipsOn.push(u); } else { cb.sendNotice('Setting your Tip Type to "Who". You can tip ' + whoPrice + ' tokens to ask the broadcaster if it was one of the names from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whoTipsOn.push(u); } break; } case '/where': { cmd = 1; if (cbjs.arrayContains(whereTipsOn, u)) { cb.sendNotice('You have already enabled the "Where" Tip Type. You can tip ' + wherePrice + ' tokens to ask the broadcaster if it was in one of the places from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); } else if (cbjs.arrayContains(whatTipsOn, u)) { cb.sendNotice('Changing from the "What" Tip Type to the "Where" Tip Type. You can tip ' + wherePrice + ' tokens to ask the broadcaster if it was in one of the places from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whatTipsOn.splice(u); whereTipsOn.push(u); } else if (cbjs.arrayContains(whoTipsOn, u)) { cb.sendNotice('Changing from the "Who" Tip Type to the "Where" Tip Type. You can tip ' + wherePrice + ' tokens to ask the broadcaster if it was in one of the places from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whoTipsOn.splice(u); whereTipsOn.push(u); } else { cb.sendNotice('Setting your Tip Type to "Where". You can tip ' + wherePrice + ' tokens to ask the broadcaster if it was in one of the places from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whereTipsOn.push(u); } break; } case '/what': { cmd = 1; if (cbjs.arrayContains(whatTipsOn, u)) { cb.sendNotice('You have already enabled the "What" Tip Type. You can tip ' + whatPrice + ' tokens to ask the broadcaster if it was with one of the object from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); } else if (cbjs.arrayContains(whereTipsOn, u)) { cb.sendNotice('Changing from the "Where" Tip Type to the "What" Tip Type. You can tip ' + whatPrice + ' tokens to ask the broadcaster if it was with one of the object from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whereTipsOn.splice(u); whatTipsOn.push(u); } else if (cbjs.arrayContains(whoTipsOn, u)) { cb.sendNotice('Changing from the "Who" Tip Type to the "What" Tip Type. You can tip ' + whatPrice + ' tokens to ask the broadcaster if it was with one of the object from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whoTipsOn.splice(u); whatTipsOn.push(u); } else { cb.sendNotice('Setting your Tip Type to "What". You can tip ' + whatPrice + ' tokens to ask the broadcaster if it was with one of the object from the list. After tipping, your Tip Type will be removed so you can revert to normal tip notes, or you can type /normal to revert.', u, appNoticeColor); whatTipsOn.push(u); } break; } case '/normal': { cmd = 1; if (cbjs.arrayContains(whereTipsOn, u)) { whereTipsOn.splice(u); cb.sendNotice('You have removed the "Where" Tip Type. You can now use normal tip notes.', u, appNoticeColor); } else if (cbjs.arrayContains(whoTipsOn, u)) { whoTipsOn.splice(u); cb.sendNotice('You have removed the "Who" Tip Type. You can now use normal tip notes.', u, appNoticeColor); } else if (cbjs.arrayContains(whatTipsOn, u)) { whatTipsOn.splice(u); cb.sendNotice('You have removed the "What" Tip Type. You can now use normal tip notes.', u, appNoticeColor); } else { cb.sendNotice('You did not have any Tip Types specified. You can now use normal tip notes.', u, appNoticeColor); } break; } //********* Hidden Ticket Show Commands case '/guessers': { cmd = 1; if (guessList.length > 0) { if (message[1] == 'a' || message[1] == 'A' || message[1] == 'alpha') { var sortedGuessList = guessList.slice(); sortedGuessList.sort(); cb.sendNotice('Alphabetic listing of users who have guessed (' + guessList.length + ' guessers) :\n' + cbjs.arrayJoin(sortedGuessList, ', ') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Users who have made guesses in the game, in order of when added (' + guessList.length + ' guessers). Use the "alpha" parameter for a sorted list : \n' + cbjs.arrayJoin(guessList, ', ') + '\nEnd of List', u, appNoticeColor); } } else { cb.sendNotice('No guesses yet.', u, appNoticeColor); } break; } //********* Help Menu case '/rrhelp': { cmd = 1; if (isMod || isBC) { helpModBC(message[1],u); } else { helpCommon(message[1],u); } break; } //********* End of Expected commands } } return msg; }); } // *********************************** Actions on user entering ************************************** { cb.onEnter(function(user) { // Variables var u = user.user; var isMod = user.is_mod; var isBC = (u === cb.room_slug); // **** Welcome message if (!isBC) { cb.sendNotice(dashLine80 + '\nRoo\'s Red Rum Game is enabled.\n Please read the Game Rules that will be shown in the chat.\n' + dashLine80, u, gameBgColor, gameTextColor,'bold'); if (cb.settings.enableGameRules == 'Yes') { displayRules(u); } } }); } // *********************************** Actions upon Draw Panel ************************************** cb.onDrawPanel(function (user) { var panel = {}; panel.template = 'image_template'; panel.row1_label = 'row1_label'; panel.row1_value = 'row1_value'; panel.row2_label = 'row2_label'; panel.row2_value = 'row2_value'; panel.row3_label = 'row3_label'; panel.row3_value = 'row3_value'; panel.row1_value = 'Welcome to the Red Rum Game!'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Please read the Game Rules in the chat'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Total Guesses: ' + totalGuesses; leftjust3 = leftJustify(panel.row3_value,3); panel.layers = [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': panel.row1_value, 'top': topjust1, 'left': leftjust1, 'font-size': fontSize, 'font-weight': 'bold', 'color': textColor, }, { 'type': 'text', 'text': panel.row2_value, 'top': topjust2, 'left': leftjust2, 'font-size': fontSize, 'color': textColor, }, { 'type': 'text', 'text': panel.row3_value, 'top': topjust3, 'left': leftjust3, 'font-size': fontSize, 'color': textColor, }, ] return panel; }); // *********************************** Actions upon tipping ************************************** { cb.onTip (function (tip) { var tipAmount = Number.parseInt(tip.amount, 10); var u = tip.from_user var tipNote = tip.message; // ***** Process Tip for Guess if (whoPrice > 0 && tipAmount == whoPrice) { if (cbjs.arrayContains(whoTipsOn, u)) { if (checkExceedOK(u)) { cb.sendNotice('Red Rum: ' + u + ' made a valid tip for "Who" and guessed: Was the broadcaster ' + tipNote + '? You can answer with Yes or No.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); removeTipType(u) cb.drawPanel(); } else { cb.sendNotice('Red Rum: ' + u + ' tipped for "Who" in the game but has already used their maximum guesses.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); } } else { cb.sendNotice('Red Rum: ' + u + ' tipped the game amount for a "Who" guess, but did not first use the /who command to select a valid guess.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); cb.sendNotice('Red Rum: You tipped the game amount for a "Who" guess, but did not first use the /who command to enable selecting a valid guess.', u, appNoticeColor); } } if (whatPrice > 0 && tipAmount == whatPrice) { if (cbjs.arrayContains(whatTipsOn, u)) { if (checkExceedOK(u)) { cb.sendNotice('Red Rum: ' + u + ' made a valid tip for "With What" and guessed: Did they use the ' + tipNote + '? You can answer with Yes or No.', cb.room_slug, gameBgColor, gameTextColor); removeTipType(u) cb.drawPanel(); } else { cb.sendNotice('Red Rum: ' + u + ' tipped for "With What" in the game but has already used their maximum guesses.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); } } else { cb.sendNotice('Red Rum: ' + u + ' tipped the game amount for a "With What" guess, but did not first use the /what command to select a valid guess.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); cb.sendNotice('Red Rum: You tipped the game amount for a "With What" guess, but did not first use the /what command to enable selecting a valid guess.', u, appNoticeColor); } } if (wherePrice > 0 && tipAmount == wherePrice) { if (cbjs.arrayContains(whereTipsOn, u)) { if (checkExceedOK(u)) { cb.sendNotice('Red Rum: ' + u + ' made a valid tip for "Where" and guessed: Did they do it in the ' + tipNote + '? You can answer with Yes or No.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); removeTipType(u) cb.drawPanel(); } else { cb.sendNotice('Red Rum: ' + u + ' tipped for "Where" in the game but has already used their maximum guesses.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); } } else { cb.sendNotice('Red Rum: ' + u + ' tipped the game amount for a "Where" guess, but did not first use the /where command to select a valid guess.', cb.room_slug, gameBgColor, gameTextColor, 'bold'); cb.sendNotice('Red Rum: You tipped the game amount for a "Where" guess, but did not first use the /where command to enable selecting a valid guess.', u, appNoticeColor); } } }); } // *********************************** Tip Options ********************************** { cb.tipOptions(function(user) { if (cbjs.arrayContains(whoTipsOn, user)) { return {options: [{label: whoList1}, {label: whoList2}, {label: whoList3}, {label: whoList4}, {label: whoList5}, {label: whoList6}, {label: whoList7}, {label: whoList8}, {label: whoList9}, {label: whoList10}], label: 'Choose your guess for "Who" :'}; } else if (cbjs.arrayContains(whatTipsOn, user)) { return {options: [{label: whatList1}, {label: whatList2}, {label: whatList3}, {label: whatList4}, {label: whatList5}, {label: whatList6}, {label: whatList7}, {label: whatList8}, {label: whatList9}, {label: whatList10}], label: 'Choose your guess for "With What" :'}; } else if (cbjs.arrayContains(whereTipsOn, user)) { return {options: [{label: whereList1}, {label: whereList2}, {label: whereList3}, {label: whereList4}, {label: whereList5}, {label: whereList6}, {label: whereList7}, {label: whereList8}, {label: whereList9}, {label: whereList10}], label: 'Choose your guess for "Where" :'}; } }); } // *********************************** Initialize ************************************** { if (initialize == 0) { var BC = cb.room_slug; cb.sendNotice('Roo\'s Red Rum for 2019 v1.0 '); cb.sendNotice('** Version 1.0 was released on 10/27/2019', cb.room_slug, appNoticeColor); //*** Init Who List if (cb.settings.whoList != '' && cb.settings.whoList != null) { var n = cb.settings.whoList; whoListArray = n.split(','); } for (let loadindex = 1; loadindex <= 10; loadindex++) { if (whoListArray[loadindex-1]) { this["whoList"+loadindex] = whoListArray[loadindex-1]; } else { this["whoList"+loadindex] = 'Not Used'; } } //*** Init Where List if (cb.settings.whereList != '' && cb.settings.whereList != null) { var n = cb.settings.whereList; whereListArray = n.split(','); } for (let loadindex = 1; loadindex <= 10; loadindex++) { if (whereListArray[loadindex-1]) { this["whereList"+loadindex] = whereListArray[loadindex-1]; } else { this["whereList"+loadindex] = 'Not Used'; } } //*** Init What List if (cb.settings.whatList != '' && cb.settings.whatList != null) { var n = cb.settings.whatList; whatListArray = n.split(','); } for (let loadindex = 1; loadindex <= 10; loadindex++) { if (whatListArray[loadindex-1]) { this["whatList"+loadindex] = whatListArray[loadindex-1]; } else { this["whatList"+loadindex] = 'Not Used'; } } for (let i = 0; i < 8; i++) { if (this['gameRule'+(i+1)]) { gameRulesArray.push(this['gameRule'+(i+1)]); } } //*** Initialize initGame(); initialize = 1; } }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.