Apps Home
|
Create an App
testappstamp
Author:
stamp3
Description
Source Code
Launch App
Current Users
Created by:
Stamp3
// Variables var currentWord = "", currentTipper = "", hiddenWord = "", forPanel = "", modWord = "", blank = "__ ", tipper = [], hangman = [], hidden = [], tippedWord = [], smallGuess = [0, 2, 4, 6, 8, 9], bigGuess = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], currentOrder = 0, line = 0, winsModel = 0, winsTippers = 0, net = 0, bonus = 0, incorrectGuess = 0, guessesRemaining = 0, timeToGuess = 1000 * cb.settings.timer, // 1000ms = 1 second letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], rowTwo = "", gameOver = !1, roundOver = !1, modelWins = !1, tipperWins = !1, guessed = !1, wordGuess = !1, cheatersTemp = !1, star = "★", heart = "♥", Mila = "Mila" color = { aqua: "#00FFFF", black: "#000000", blue: "#0000FF", fuchsia: "#FF00FF", gray: "#808080", grey: "#808080", green: "#008000", lime: "#00FF00", maroon: "#800000", navy: "#000080", olive: "#808000", orange: "#FFA500", purple: "#800080", red: "#FF0000", silver: "#C0C0C0", teal: "#008080", white: "#FFFFFF", yellow: "#FFFF00", mila: "#0BB5FF" }; // Chaturbate Launch Menu cb.settings_choices = [{ name: "word", type: "str", minLength: 1, maxLength: 15, label: "Word to guess", defaultValue: "Unicorn" }, { name: "letterTip", type: "int", minValue: 1, maxValue: 1e3, defaultValue: 30, label: "Tip amount to guess a Letter" }, { name: "wordTip", type: "int", minValue: 2, maxValue: 2e3, defaultValue: 100, label: "Tip amount to guess the Word" }, { name: "letterGIF", type: "str", minLength: 1, maxLength: 255, label: "GIF when player guesses letter", defaultValue: ":SCORE" }, { name: "IncorrectletterGIF", type: "str", minLength: 1, maxLength: 255, label: "GIF when player guesses wrong letter", defaultValue: ":shrugface2" }, { name: "wordGIF", type: "str", minLength: 1, maxLength: 255, label: "GIF if tippers win a round", defaultValue: ":goodjobguys5567" }, { name: "gameWinT", type: "str", minLength: 1, maxLength: 255, label: "GIF if tippers win the game", defaultValue: ":congratulationslove" }, { name: "timer", type: "int", minValue: 1, maxValue: 20, defaultValue: 7, label: "Amount of time between turns (In seconds)" }, { name: "hashtags", type: "str", minLength: 1, maxLength: 255, required: !1, label: "Hashtags for your topic", defaultValue: "#Unicorn #BOBS #GameDay" }, { name: "modsNew", type: "choice", choice1: "No", choice2: "Yes", label: "Mods can pick the new word", defaultValue: "No" }, { name: "cheaters", type: "choice", choice1: "No", choice2: "Yes", label: "Stop users from guessing the word in chat (This will catch any comment with the 'word' and prevent it from showing in chat)", defaultValue: "No" }] // Intitialize game - Change Room Subject - Initialize bottom left display - Print rules - function init() { // Set gameover to false gameOver = !1; // Collect word set in launch menu. If not set return empty var e = cb.settings.word || ""; // Remove whitespace from both ends of the word and make it uppercase - Set room subject - Initialize bottom left display - currentWord = e.trim().toUpperCase(), cb.changeRoomSubject("We're playing wordgame! Come join us! " + cb.settings.hashtags), newBoard(), rules(""), "Yes" == cb.settings.cheaters && (cheatersTemp = !0) } // Welcome and display rules when entering the room cb.onEnter(function (e) { rules(e.user) }) // Display rules function rules(e) { cb.chatNotice("We're playing wordgame!.\nTo guess a letter, tip " + cb.settings.letterTip + " tokens.\nTo guess the word early, tip " + cb.settings.wordTip + " tokens.", e, "", color.mila, "bold"), "Yes" == cb.settings.saviorTip && cb.chatNotice("To reverse the state of the hangman by 1, tip " + cb.settings.saveTip + " tokens.", e, "", color.mila, "bold"), cb.chatNotice("Type '/rules' to see this message again. Good luck!", e, "", color.mila, "bold") } // Start new game function newRoundNotify() { 0 == gameOver && (cb.sendNotice("Type '/new x' where x is the new word to start the next round", cb.room_slug, "", color.red, "bold"), "Yes" == cb.settings.modsNew && cb.sendNotice("Type '/new x' where x is the new word to start the next round", "", "", color.red, "bold", "red")) } // New word function newWord(e, t, s) { var n = e.split(" "); n[1].match(/[^a-zA-Z]/g) ? cb.chatNotice("Your word cannot include numbers, symbols, or spaces! Try again.", t, "", color.red, "bold") : 0 == n[1].length ? cb.chatNotice("There must be a new word in order to start a new round.", t, "", color.red, "bold") : n[1].length < 4 ? cb.chatNotice("Your word should more than " + n[1].length + " characters long!", t, "", color.red, "bold") : n[1].length >= 4 && (cb.chatNotice("You have successfully set a new word.", t, "", color.black, "bold"), roundOver = !1, newRound(n[1]), 1 == s ? (cb.sendNotice("The new word is: " + n[1], cb.room_slug, "", color.green, "bold"), modWord = t) : t == cb.room_slug && "Yes" == cb.settings.modsNew && (cb.sendNotice(Mila + " has set the new word.", "", "", color.green, "bold", "red"), modWord = "")) } // User has tipped but is added to queue function receiveTip(e) { tipper.push(e), "Yes" == cb.settings.modsNew && e == modWord && (tipper.shift(), cb.chatNotice("You can't guess a letter or the Word!", e, "", color.red, "bold"), cb.chatNotice(e + " is trying to cheat!", "", "", color.red, "bold")), 1 == tipper.length ? notify() : tipper.length > 1 && (line++ , cb.chatNotice("Thank you for your tip. When it's your turn to guess, you will receive a message in the chat", e, "", color.black, "bold"), cb.chatNotice("You are number " + line + " in line.", e, "", color.black, "bold")) } // Notify it is their turn function notify() { if (guessed = !1, currentTipper = tipper[0], 0 == wordGuess && 0 == roundOver) cb.chatNotice("Guess a letter and Good Luck!\nYou have " + cb.settings.timer + " seconds to make your guess or you will lose your turn.", currentTipper, "", color.black, "bold"), setTimeout(endTurn, timeToGuess); else if (1 == wordGuess && 0 == roundOver) { var e = cb.settings.timer + 5, t = timeToGuess + 5e3; cb.chatNotice("Guess the word and Good Luck!\nYou have " + e + " seconds to make your guess or you will lose your turn.", currentTipper, "", color.black, "bold"), setTimeout(endTurn, t) } } // End turn if time threshold met function endTurn() { if (0 == guessed && 0 == tipper.indexOf(currentTipper) && 0 == roundOver && cb.chatNotice("Sorry, but your turn has ended for taking too long to guess a letter.", currentTipper, "", color.black, "bold"), tipper.shift(), tippedWord.shift(), tipper.length > 0) { 1 == tippedWord[0] && (wordGuess = !0), line--; var e = line; if (line > 0) for (var t = 1; line >= t; t++) cb.chatNotice("You are now number " + e + " in line.", tipper[t], "", color.black, "bold"), e++; notify() } } // Create bottom left display function newBoard() { var e, t, s, n; for (n = currentWord, e = 0; e < currentWord.length; e++) hiddenWord += blank; for (t = 0; t < currentWord.length; t++) hangman.push(blank); for (s = 0; s < currentWord.length; s++) { var r = n.charAt(s); hidden.push(r) } rowTwo = letters.join(" "), cb.drawPanel() } // Update display bottom left - function updateBoard(e) { for (var t, s = 0; s <= hangman.length; s++) hidden[s] == e && (hangman[s] = e); t = hangman.join(" "), hiddenWord = t.toString(), cb.drawPanel() } // Update display bottom left - Remove letters already guessed from 2nd row and re-draw panel function updateLetters(e) { letters.splice(letters.indexOf(e), 1), rowTwo = letters.join(" "), cb.drawPanel() } // Bottom left display cb.onDrawPanel(function (e) { return 0 == gameOver ? { template: "3_rows_11_21_31", row1_value: hiddenWord, row2_value: rowTwo, row3_value:"" } : 1 == gameOver ? { template: "3_rows_11_21_31", row1_value: "The word was: " + forPanel, row2_value: "Congratulations tippers, you won!! Thank you all for playing!", row3_value: "Waiting for the New Word to be chosen" } : void 0 }) // function gameEnd() { function e() { cb.chatNotice("Total Tokens for the game: " + net + ". Tokens that were not for playing the game: " + bonus + ". Average tokens per round: " + Math.ceil(net / (winsModel + winsTippers)) + ". Total dollars: $" + parseFloat(.05 * net).toFixed(2), cb.room_slug, "", color.red, "bold") } gameOver = !0, winsModel == cb.settings.roundsTotal && (modelWins = !0, cb.chatNotice("Too bad, " + Mila + " is the winner. Better luck next time!\n" + cb.settings.gameWinM, "", "", color.maroon, "bold")), winsTippers == cb.settings.roundsTotal && (tipperWins = !0, cb.chatNotice("Congratualtions tippers! You beat " + Mila + " and are the Winners! Your prize is: " + cb.settings.tipperPrize + "\n" + cb.settings.gameWinT, "", "", color.green, "bold")), cb.drawPanel(), cb.changeRoomSubject("Thanks for playing! " + cb.settings.topic + " " + cb.settings.hashtags), cb.setTimeout(e, 3500) } // function userWin() { var e = hidden.toString(), t = hangman.toString(); forPanel = hidden.join(""), e == t && (roundOver = !0, winsTippers++), winsTippers < cb.settings.roundsTotal && 1 == roundOver ? (roundOverWinNotify(), cb.setTimeout(newRoundNotify, 3e3), cb.drawPanel()) : winsTippers == cb.settings.roundsTotal && gameEnd() } // function newRound(e) { hiddenWord = "", hangman = [], hidden = [], incorrectGuess = 0, 1 == cheatersTemp && (cb.settings.cheaters = "Yes"); var t = e || ""; currentWord = t.trim().toUpperCase(), newBoard(); cb.chatNotice("A new word has been set. Good luck!", "", "", color.black, "bold") } // function roundOverWinNotify() { 0 == gameOver && (cb.chatNotice("Congratulations! " + Mila + " has lost this round. Nice work!\n" + cb.settings.wordGIF, "", "", color.green, "bold"), "Yes" == cb.settings.roundPrizeOption && cb.chatNotice("Your prize for winning is: " + cb.settings.roundPrize, "", "", color.green, "bold")) } cb.onTip(function (e) { // Check size of tip var t = parseInt(e.amount); // ??? - Add to total, game & round is active if (null == e.message.match(/optout/i) && (net += t, 0 == gameOver && 0 == roundOver)) //Player tipped to guess a letter - Add player if (t == cb.settings.letterTip) tippedWord.push(0), receiveTip(e.from_user); // Player tipped to guess the word - Add player to the quee else if (t == cb.settings.wordTip) wordGuess = !0, tippedWord.push(1), receiveTip(e.from_user); // Track tokens that were not tipped to play wordgame else (t != cb.settings.letterTip || t != cb.settings.wordTip || t != cb.settings.saveTip) && (bonus += t) }) cb.onMessage(function (e) { // Player notification when it is not your turn to guess if (tipper.indexOf(e.user) > 0 && 0 == gameOver) cb.chatNotice("Please wait your turn", e.user, "", color.black, "bold"); else if (0 == tipper.indexOf(e.user) && 0 == guessed && 0 == gameOver && 0 == wordGuess) { var t = e.m.toUpperCase(); // Player entered more than one letter if (t.length > 1) e["X-Spam"] = !0, cb.chatNotice("Your guess should only be 1 letter! Try again.", e.user, "", color.red, "bold"); // Player entered a letter not A-Z/a-z else if (t.match(/[^a-zA-Z]/g)) e["X-Spam"] = !0, cb.chatNotice("Your Guess Needs to be a letter! Try again.", e.user, "", color.red, "bold"); // Player entered letter already guessed else if (0 == letters.includes(t)) e["X-Spam"] = !0, cb.chatNotice("That letter has already been guessed! Try again.", e.user, "", color.red, "bold"); // Player entered incorrect letter else if (0 == currentWord.includes(t)) e["X-Spam"] = !0, guessed = !0, updateLetters(t), cb.chatNotice("Sorry, the letter " + t + " is not part of the word " + cb.settings.IncorrectletterGIF, "", "", color.red, "bold"); // Player guessed correct letter else e["X-spam"] = !0, guessed = !0, updateBoard(t), updateLetters(t), cb.chatNotice("Congratulations! " + e.user + " guessed thge correct letter " + cb.settings.letterGIF, "", "", color.green, "bold"), userWin() } // Check if it is players turn and game is not over else if (0 == tipper.indexOf(e.user) && 0 == gameOver && 1 == wordGuess) { // Remove whitespace from both ends and make it uppercase var t = e.m.trim().toUpperCase(); if (wordGuess = !1, guessed = !0, t == currentWord) e["X-spam"] = !0, cb.settings.cheaters = "No", roundOver = !0, winsTippers++ , userWin(); } // Anti-Cheat, prevents another user to write the word in the chat if (e.m && "Yes" == cb.settings.cheaters) { var n = e.m.toString(); if (n = n.toUpperCase(), n.includes(currentWord)) return e["X-Spam"] = !0, e.m = "You shouldn't cheat!", e } // Message handler - create new word /new *insert word* if ("/" == e.m.substring(0, 1) && 0 == gameOver && 1 == roundOver && (e.is_mod || e.user == cb.room_slug) && "/new " == e.m.substring(0, 5)) if (e["X-Spam"] = !0, "No" == cb.settings.modsNew && e.is_mod) cb.chatNotice(Mila + " has chosen not to allow mods to make a new word.", e.user, "", color.red, "bold"); else if ("No" == cb.settings.modsNew && e.user == cb.room_slug) newWord(e.m, e.user); else if ("Yes" == cb.settings.modsNew && (e.is_mod || e.user == cb.room_slug)) { if (e.is_mod) var r = !0; newWord(e.m, e.user, r) } // Send rules and instructions to player if /rules is typed in chat "/" == e.m.substring(0, 1) && 0 == gameOver && "/rules" == e.m.substring(0, 6) && (e["X-Spam"] = !0, rules(e.user)) }), init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.