Apps Home
|
Create an App
Jinx
Author:
darkcultist
Description
Source Code
Launch App
Current Users
Created by:
Darkcultist
// // This is my first attempt at an app I plan on cleaning this up and giving comments // Code inspired by nhenderson77667766's BlackJack // Version 1.01 // cb.settings_choices = [ {name: 'subject', label: 'Room Subject', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Kylie\u0027s JinxGame! Tip 60 tokens to pull a card!'}, {name:'cost_per_card', label: 'The cost to pull a card', type:'int', minValue:1, maxValue:9999, defaultValue:60}, {name: 'prize2', label: 'The cost to pull a 2 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Kylie drink and you suck'}, {name: 'prize3', label: 'The cost to pull a 3 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Paddle of your choice'}, {name: 'prize4', label: 'The cost to pull a 4 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'BJ video'}, {name: 'prize5', label: 'The cost to pull a 5 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Boobs!'}, {name: 'prize6', label: 'The cost to pull a 6 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Sex video'}, {name: 'prize7', label: 'The cost to pull a 7 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Ice on pussy'}, {name: 'prize8', label: 'The cost to pull a 8 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Paint on body'}, {name: 'prize9', label: 'The cost to pull a 9 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Gag on dildo'}, {name: 'prize10', label: 'The cost to pull a 10 card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Paddle of my choice'}, {name: 'prizeJ', label: 'The cost to pull a J card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Booty Shake'}, {name: 'prizeQ', label: 'The cost to pull a Q card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Ice on nips'}, {name: 'prizeK', label: 'The cost to pull a K card', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Buttplug until next card'}, {name: 'grandprize', label: 'The grand prize to give', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Panties (shipped in the USA only)'}, ]; var lastplayer; var lastcard; var gameRunning = false; var deck; var currentcardindex; var queuedCards = []; var queuedIndex; var cards = [ "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" ]; var suits = [ "\u2665", "\u2663", "\u2660", "\u2666" ]; var prizes = [ cb.settings.prize2, cb.settings.prize3, cb.settings.prize4, cb.settings.prize5, cb.settings.prize6, cb.settings.prize7, cb.settings.prize8, cb.settings.prize9, cb.settings.prize10, cb.settings.prizeJ, cb.settings.prizeQ, cb.settings.prizeK ] var s_rules = "Rules : Tip " + cb.settings.cost_per_card + " to pull a card from the deck. I will then pull a piece. If it doesn't fall on your turn and I successfully put a piece on top, then you win the prize associated with that card! If it falls on your turn you will win the grand prize of \"" + cb.settings.grandprize + "\"."; function newCard(card, suit, prize) { return { name: card + suit, card: card, prize: prize, } } function createDeck() { var d = []; for (si in suits) { for (ci in cards) { var c = newCard(cards[ci], suits[si], prizes[ci]); d.push(c); } } return d; } function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } function newDeck() { return shuffle(createDeck()); } function newNotification(message,user){ cb.sendNotice(message, user, "#02a7ab","#000000","bolder","" ); } function newGame(){ cb.changeRoomSubject(cb.settings.subject); newNotification(s_rules, ""); deck = newDeck(); lastcard = "none"; lastplayer = "none"; queuedCards = []; queuedIndex = 0; currentcardindex = 0; gameRunning = true; cb.drawPanel(); } function endGame(){ cb.changeRoomSubject(cb.settings.subject + " No cards left! Thank you everyone!"); gameRunning = false; } cb.onDrawPanel(function(user) { var s_cards = deck.length - currentcardindex; var s_lastpulled = "No cards pulled yet!"; var s_nextplayed = "Tip 60 to pull the first card."; if (lastplayer != "none") { s_lastpulled = "Latest pulled : " + lastcard + " | " + lastplayer; s_nextplayed = "Next play : " + queuedCards[queuedIndex]; } return { 'template': '3_rows_12_21_31', 'row1_label': 'Cards left : ', 'row1_value': s_cards , 'row2_value': s_lastpulled, 'row3_value': s_nextplayed }; }); cb.onTip(function(tip){ if(tip['amount'] == cb.settings.cost_per_card && gameRunning){ newNotification(tip['from_user'] + " has pulled " + deck[currentcardindex].name + " for the attempt of the prize \"" + deck[currentcardindex].prize + "\".", ""); lastcard = deck[currentcardindex].name; lastplayer = tip['from_user']; queuedCards.push(tip['from_user'] + " | " + deck[currentcardindex].name + " | " + deck[currentcardindex].prize) cb.drawPanel(); currentcardindex = currentcardindex + 1; if (currentcardindex >= deck.length) { endGame(); } } }); cb.onMessage(function (msg) { //Commands for broadcaster and mods if (msg['is_mod'] || msg['user'] == cb.room_slug){ if (msg['m'] == '/jinxrules') { newNotification(s_rules, ""); msg['X-Spam'] = true; } if (msg['m'] == '/jinxtippers') { newNotification("There are " + queuedCards.length + " tippers.", msg['user']) for (tipper in queuedCards) { var s_message = queuedCards[tipper]; if (tipper == queuedIndex){ s_message += " <- Current play -> "; } newNotification(s_message, msg['user']); } msg['X-Spam'] = true; } if (msg['m'] == '/jinxhelp') { newNotification("Broadcaster and mods:", msg['user']); newNotification("/jinxrules - Notify room of the rules.", msg['user']); newNotification("/jinxtippers - Notify the user of the command a list of users and prizes that have tipped.", msg['user']); newNotification("Broadcaster only:", msg['user']); newNotification("/jinxreset - Resets the game. Will not keep any records of tippers so far.", msg['user']); newNotification("/jinxnext - Moves the counter onto the next card in queue to be played.", msg['user']); msg['X-Spam'] = true; } } //Commands for only the broadcaster if (msg['user'] == cb.room_slug) { if (msg['m'] == '/jinxreset') { newGame(); msg['X-Spam'] = true; } if (msg['m'] == '/jinxnext') { if (queuedIndex < currentcardindex - 1) { queuedIndex++; cb.drawPanel(); } msg['X-Spam'] = true; } } return msg; }); cb.onEnter(function(user) { newNotification(s_rules, user['user']); }); function init(){ newGame(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.