//Chaturbate Choices cb.settings_choices = [ //Number of Players {name:'num_players', type:'int', minValue:2, maxValue:10, defaultValue:5, label: "Number of Players?"}, //Tokens to play {name:'tokens_to_play', type:'int', minValue:1, maxValue:100, defaultValue:50, label: "Tokens to Play"}, //Tokens to Vote {name:'tokens_to_vote', type:'int', minValue:1, maxValue:1000, defaultValue:10, label: "Minimum Tokens To Vote"}, //Time to Vote {name:'time_to_vote', type:'int', minValue:1, maxValue:10, defaultValue:5, label: "Minutes To Vote"}, //Can See White Card? {name:'user_can_see', type:'choice',choice1:'Yes',choice2:'No', defaultValue:'Yes', label: "Can Users See Their White Card?"}, //Prize List //Needs Optimization {name:'dummy', type:'choice',choice1:'OK',choice2:'FINE', defaultValue:'OK', label: 'Prizes are distibuted by % out of the added total of % values. The lower the number, the rarer the prize.'}, { name: 'first_prize', label: 'First Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Prize A' }, {name:'first_prize_percent', label: 'First Prize%', type:'int', minValue:1, maxValue:100, defaultValue: 50}, { name: 'second_prize', label: 'Second Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Prize B' }, {name:'second_prize_percent', label: 'Second Prize%', type:'int', minValue:1, maxValue:100, defaultValue: 50}, { name: 'third_prize', label: 'Third Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'third_prize_percent', label: 'Third Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'fourth_prize', label: 'Fourth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'fourth_prize_percent', label: 'Fourth Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'fifth_prize', label: 'Fifth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'fifth_prize_percent', label: 'Fifth Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'sixth_prize', label: 'Sixth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'sixth_prize_percent', label: 'Sixth Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'seventh_prize', label: 'Seventh Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'seventh_prize_percent', label: 'Seventh Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'eighth_prize', label: 'Eighth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'eighth_prize_percent', label: 'Eighth Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'ninth_prize', label: 'Ninth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'ninth_prize_percent', label: 'Ninth Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0}, { name: 'tenth_prize', label: 'Tenth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, {name:'tenth_prize_percent', label: 'Tenth Prize%', type:'int', minValue:0, maxValue:100, required: false, defaultValue: 0} //End Chaturbate Choices ]; //Setup Complete Boolean var setupComplete = false; //Winner Boolean var winnerFlag = false; //Tokens Required to Play var playCost = cb.settings.tokens_to_play; //Tokens Required to Vote var voteCost = cb.settings.tokens_to_vote; //Voting Duration Length var voteTime = cb.settings.time_to_vote * 60 * 1000; //Tip Total var tipTotal = 0; //Most Recent Tip var lastTip = 0; //The Most Recent Winner var cbWinner = 'No one yet!'; //The Most Recent Prize Won var lastPrize = 'Nothing'; //Setup Players //The broadcaster will always be the first player. var players = [{cbuser:cb.room_slug, message: 'Initial Card Setup', votes: 0}]; //List of users currently in play //A minor speed hack var currentlyPlaying = [cb.room_slug]; //Define Black Cards var blackCards = ['Someone just tipped for ____', 'Nothing says "I love you" like ____', '___ tipped a measly 1 token for a request', '____ is now banned from the room', cb.room_slug + ' has a secret fetish for ____', '____ was just featured on the Chaturbate front page', '____ wants to have sex with ' + cb.room_slug, '____? Yeah, I have seen that on Chaturbate', 'Sorry, but tipping for ____ is too unresonable', cb.room_slug + ' has a crush on ____', 'Deepthroat ____? I only do that in private', 'My errection was ruined by ____', '____ and a hot dicking really turn me on']; //Define White Cards var whiteCards = ['A broken webcam','A stalker','Snapchat','Token Keno','1 measley token','1000 tokens','A vulgar emoticon','A cumshot in the eye','A tiny penis', 'A rimjob', 'A blowjob', 'A very worn out dildo', 'Lube. Lots of lube', 'A cum guzzling slut', 'Chaturbate', 'A pet that wanders into the camera', 'My 12-inch cock', 'A throbbing erection', 'A battery-drained OhMibod', 'A puffy vulva', 'Double penetration', 'Anal fisting', '50 tokens', '100 tokens', 'A spammer', 'A troll', 'A cracked cell phone', 'A sugar daddy', 'A grey who promises ' + cb.room_slug + ' the world', 'My alternate Chaturbate account', 'Twitter', 'Tumblr', 'Sex', 'Buttsex', 'Being under the influence on cam']; //Define Prizes //Needs optimization var prizes = [ {prize: cb.settings.first_prize, percent: cb.settings.first_prize_percent}, {prize: cb.settings.second_prize, percent: cb.settings.second_prize_percent}, {prize: cb.settings.third_prize, percent: cb.settings.third_prize_percent}, {prize: cb.settings.fourth_prize, percent: cb.settings.fourth_prize_percent}, {prize: cb.settings.fifth_prize, percent: cb.settings.fifth_prize_percent}, {prize: cb.settings.sixth_prize, percent: cb.settings.sixth_prize_percent}, {prize: cb.settings.seventh_prize, percent: cb.settings.seventh_prize_percent}, {prize: cb.settings.eighth_prize, percent: cb.settings.eighth_prize_percent}, {prize: cb.settings.ninth_prize, percent: cb.settings.ninth_prize_percent}, {prize: cb.settings.tenth_prize, percent: cb.settings.tenth_prize_percent} ]; //Number of needed players before voting var numNeeded = cb.settings.num_players; //Rules shown? var showRules = true; //Current Goal var goal = [{goal: '', amount: 0, isActive :false}]; //Initialize CAH function init() { //Reset Votes cb.tipOptions(function(user) { return; }); //Reset Players players = []; currentlyPlaying = []; //Setup Broadcaster As Player players = [{cbuser:cb.room_slug, message: 'Initial Card Setup', votes: 0}]; currentlyPlaying = [cb.room_slug]; //Init Black Card setBlack(); //Set Broadcaster Card players[0]['message'] = whiteCard(); //When User Tips cb.onTip(userTipped); //When User Chats cb.onMessage(OnMessage); //Draw Panel drawPanel(); //Should we show the rules? if (showRules == true ) { //YES //Room Enter cb.onEnter(function(user) { cb.chatNotice(rules(), user['user']); }); //Initial Notice //Let users know the game has started cb.chatNotice('A new game of "Chaturbate Against Humanity" has begun. Type "/rules" for the rules or "/prizes" for a list of prizes.', '', 'gold','red', 'bold'); } else { //NO }; //end of IF [Should we show the rules?] }; //Get Value To See Card function getViewBool(isYes) { //TRUE if (isYes == 'Yes' ) { //YES //Return True return true; } else { //NO //Return False return false; }; //end of IF [TRUE] }; //Set Black Card //Set the room topic to the CAH Black Card function setBlack() { //Get Random Number var rnd = Math.floor(Math.random() * blackCards.length); //Get Random Black Card var tempCard = blackCards[rnd]; //While the Black Card is Undefined while (tempCard === undefined ) { //Get Random Number rnd = Math.floor(Math.random() * blackCards.length); //Get Random White Card tempCard = blackCards[rnd]; }; //end of WHILE [While the Black Card is Undefined] //Delete Card From Being Picked Twice delete blackCards[rnd]; //Change Room Subject cb.changeRoomSubject(tempCard + ' #CAH'); }; //Handle Tip function userTipped(tip) { //Increment Total tipTotal += tip['amount']; //Latest Tip lastTip = tip['amount']; //Set Goal String var goalStr = ''; //Is goal active? if (goal.isActive == true ) { //YES //Subtract tip from goal goal.amount -= lastTip; //TRUE if (goal.amount <= 0 ) { //YES //Reset Goal String goalStr = 'Congrats ' + tip['from_user'] + '! You got us to "' + goal.goal + '!" '; //Make goal inactive goal.isActive = false; } else { //NO //Reset Goal String goalStr = 'Thank you ' + tip['from_user'] + ', now only ' + goal.amount + ' tokens until "' + goal.goal + '." '; }; //end of IF [TRUE] //Goal Info cb.chatNotice( goalStr, '', 'gold','red', 'bold'); } else { //NO }; //end of IF [Is goal active?] //Is setup finished? if (setupComplete == true ) { //YES //Did they tip enough to vote? if (tip['amount'] >= voteCost ) { //YES //List all cards in play for (var i=0;i= numNeeded ) { //YES //Begin the voting beginVote(); } else { //NO }; //end of IF [Do we have enough players?] }; //Add White Card function whiteCard() { //Get Random Number var rnd = Math.floor(Math.random() * whiteCards.length); //Get Random White Card var tempCard = whiteCards[rnd]; //While the White Card is Undefined while (tempCard === undefined ) { //Get Random Number rnd = Math.floor(Math.random() * whiteCards.length); //Get Random White Card tempCard = whiteCards[rnd]; }; //end of WHILE [While the White Card is Undefined] //Delete Card From Being Picked Twice delete whiteCards[rnd]; //Return White Card return tempCard; }; //drawPanel function drawPanel() { //Should we draw the template? if (showRules = true ) { //YES //Draw Panel Setup cb.onDrawPanel(function() { return { //Define Template 'template': '3_rows_of_labels', //Row 1 Label 'row1_label': 'Number of Players:', //Row 1 Value 'row1_value': players.length.toString() + '/' + numNeeded.toString(), //Row 2 Label 'row2_label': 'Winner:', //Row 2 Value 'row2_value': cbWinner, //Row 3 Label 'row3_label': 'Won Prize:', //Row 3 Value 'row3_value': lastPrize //End Draw Panel Setup }; }); } else { //NO }; //end of IF [Should we draw the template?] //Actually draw the panel cb.drawPanel(); }; //Get Reward //Give the user a reward for having the best card. function getReward() { //Reset Votes cb.tipOptions(function(user) { return; }); //Initalize Highest Vote var highestVotes = 0; //List All Players for (var i=0;i highestVotes ) { //YES //Save the High Vote User cbWinner = players[i].cbuser; //Update High Vote highestVotes = players[i].votes; } else { //NO }; //end of IF [If the player has more votes] }; //end of FOR [List All Players] //Check if anyone voted if (highestVotes != 0 ) { //YES //Did the broadcaster win? if (cbWinner == cb.room_slug ) { //YES //Get Prize lastPrize = 'Nothing'; //Announce Winner And Prize cb.chatNotice(cb.room_slug + ' just won. Better luck next time.\n Next round will start in 10 seconds.', '', 'gold','red', 'bold'); } else { //NO //Get a real prize getPrize(); //Announce Winner And Prize cb.chatNotice(cbWinner + ' just won a ' + lastPrize + '\n Next round will start in 10 seconds.', '', 'gold','red', 'bold'); }; //end of IF [Did the broadcaster win?] } else { //NO //Get Prize lastPrize = 'Nothing'; //Announce Winner And Prize cb.chatNotice('No one voted. ' + cb.room_slug + ' wins by default..\n Next round will start in 10 seconds.', '', 'gold','red', 'bold'); }; //end of IF [Check if anyone voted] //Redraw the Panel drawPanel(); //Allow Setup Again setupComplete = false; //Reinitialize cb.setTimeout(init, 10000); }; //Get User Card function getCard(user) { //Loop Through Players for (var i=0;i= 4 ) { //YES //Get Adjustment Amount var amount = functProp[1]; //Make adjustment players[functProp[2] - 1].votes += eval(amount); //Reason var reason = ['']; //Create Reason String for (var i=3; i= numNeeded ) { //YES //Begin the voting beginVote(); } else { //NO }; //end of IF [Do we have enough players?] }; //Add User Card function addUserCard(user) { //Create new card var userMessage = whiteCard(); //Create Player data var card = {cbuser: user, message: userMessage, votes: 0}; //Add to players players.push(card); //Add to playing list currentlyPlaying.push(user); //Can they see their white card? if (getViewBool(cb.settings.user_can_see) == true ) { //YES //Inform them their card has been added cb.sendNotice('You are now playing Chaturbate Against Humanity this round! \n Your card is: ' + userMessage + '\n Good luck!', user); } else { //NO //Inform them their card has been added cb.sendNotice('You are now playing Chaturbate Against Humanity this round! \n Good luck!', user); }; //end of IF [Can they see their white card?] }; //Begin Vote function beginVote() { //If setup isn't finished if (setupComplete == false ) { //YES //Shuffle the Players shuffle(players); //Set up tip options cb.tipOptions(function() { //Initalize the options var options = [{label: players[0].message}]; //Add all the other cards for (var i=1;i numberArray[1] && rnd <= numberArray[2]) : { //code lastPrize = prizes[2].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[2].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 2] //Prize 3 case (rnd > numberArray[2] && rnd <= numberArray[3]) : { //code lastPrize = prizes[3].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[3].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 3] //Prize 4 case (rnd > numberArray[3] && rnd <= numberArray[4]) : { //code lastPrize = prizes[4].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[4].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 4] //Prize 5 case (rnd > numberArray[4] && rnd <= numberArray[5]) : { //code lastPrize = prizes[5].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[5].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 5] //Prize 6 case (rnd > numberArray[5] && rnd <= numberArray[6]) : { //code lastPrize = prizes[6].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[6].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 6] //Prize 7 case (rnd > numberArray[6] && rnd <= numberArray[7]) : { //code lastPrize = prizes[7].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[7].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 7] //Prize 8 case (rnd > numberArray[7] && rnd <= numberArray[8]) : { //code lastPrize = prizes[8].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[8].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 8] //Prize 9 case (rnd > numberArray[8] && rnd <= numberArray[9]) : { //code lastPrize = prizes[9].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[9].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 9] //Prize 10 case (rnd > numberArray[9] && rnd <= numberArray[10]) : { //code lastPrize = prizes[10].prize; //Odds cb.log('Odds of winning this prize: ' + (prizes[10].percent/percentTotal)*100 + '%'); //break break; }; //end of CASE ITEM [Prize 10] default : //default //No prize? lastPrize = 'Something went wrong...'; //break break; }; //end of switch [Select a Prize] }; //Start Chaturbate Against Humanity //Let's get on with it already! init();