Apps Home
|
Create an App
guesstest
Author:
honeyblossom_
Description
Source Code
Launch App
Current Users
Created by:
Honeyblossom_
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. :kiss",currentTipper,"",bcp.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],"",bcp.black,"bold"),e++;notify()}}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,"",bcp.red,"bold")}gameOver=!0,winsModel==cb.settings.roundsTotal&&(modelWins=!0,cb.chatNotice("Too bad, "+cb.settings.name+" is the winner. Better luck next time!\n"+cb.settings.gameWinM,"","",bcp.maroon,"bold")),winsTippers==cb.settings.roundsTotal&&(tipperWins=!0,cb.chatNotice("Congratualtions tippers! You beat "+cb.settings.name+" and are the Winners! Your prize is: "+cb.settings.tipperPrize+"\n"+cb.settings.gameWinT,"","",bcp.green,"bold")),cb.drawPanel(),cb.changeRoomSubject("Thanks for playing! "+cb.settings.topic+" "+cb.settings.hashtags),cb.setTimeout(e,3500)}function modelWin(){"5"==cb.settings.incorrectGuesses?incorrectGuess>=5&&(winsModel++,winsModel<cb.settings.roundsTotal&&modelWinSetup()):"9"==cb.settings.incorrectGuesses&&incorrectGuess>=9&&(winsModel++,winsModel<cb.settings.roundsTotal&&modelWinSetup()),winsModel==cb.settings.roundsTotal&&gameEnd()}function modelWinSetup(){roundOver=!0,roundOverLoseNotify(),forPanel=hidden.join(""),cb.drawPanel(),cb.setTimeout(newRoundNotify,3e3)}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()}function newRound(e){hiddenWord="",hangman=[],hidden=[],incorrectGuess=0,1==cheatersTemp&&(cb.settings.cheaters="Yes");var t=e||"";currentWord=t.trim().toUpperCase(),roundGuesses(),newBoard();var s=status();cb.chatNotice("A new word has been set. Good luck and don't let the hangman die!\nThe Current State of the Hangman is:\n:sopphang"+s,"","",bcp.black,"bold")}function newRoundNotify(){0==gameOver&&(cb.sendNotice("Type '/new x' where x is the new word to start the next round",cb.room_slug,"",bcp.red,"bold"),"Yes"==cb.settings.modsNew&&cb.sendNotice("Type '/new x' where x is the new word to start the next round","","",bcp.red,"bold","red"))}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,"",bcp.red,"bold"):0==n[1].length?cb.chatNotice("There must be a new word in order to start a new round.",t,"",bcp.red,"bold"):n[1].length<4?cb.chatNotice("Your word should more than "+n[1].length+" characters long!",t,"",bcp.red,"bold"):n[1].length>=4&&(cb.chatNotice("You have successfully set a new word.",t,"",bcp.black,"bold"),roundOver=!1,newRound(n[1]),1==s?(cb.sendNotice("The new word is: "+n[1],cb.room_slug,"",bcp.green,"bold"),modWord=t):t==cb.room_slug&&"Yes"==cb.settings.modsNew&&(cb.sendNotice(cb.settings.name+" has set the new word.","","",bcp.green,"bold","red"),modWord=""))}function notify(){if(guessed=!1,currentTipper=tipper[0],0==wordGuess&&0==roundOver)cb.chatNotice("Guess a letter and Good Luck! \nType '!' before the letter you want to guess \nYou have "+cb.settings.timer+" seconds to make your guess or you will lose your turn.",currentTipper,"",bcp.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! \nType '!' before the word you would like to guess\nYou have "+e+" seconds to make your guess or you will lose your turn.",currentTipper,"",bcp.black,"bold"),setTimeout(endTurn,t)}}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,"",bcp.red,"bold"),cb.chatNotice(e+" is trying to cheat!","","",bcp.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,"",bcp.black,"bold"),cb.chatNotice("You are number "+line+" in line.",e,"",bcp.black,"bold"))}function roundGuesses(){"5"==cb.settings.incorrectGuesses?guessesRemaining=5:"9"==cb.settings.incorrectGuesses&&(guessesRemaining=9)}function roundOverLoseNotify(){0==gameOver&&cb.chatNotice("You lost! "+cb.settings.name+" has won! Better luck next round.\n"+cb.settings.modelGIF,"","",bcp.purple,"bold")}function roundOverWinNotify(){0==gameOver&&(cb.chatNotice("Congratulations! "+cb.settings.name+" has lost this round. Nice work!\n"+cb.settings.wordGIF,"","",bcp.green,"bold"),"Yes"==cb.settings.roundPrizeOption&&cb.chatNotice("Your prize for winning is: "+cb.settings.roundPrize,"","",bcp.green,"bold"))}function rules(e){var t=status();cb.chatNotice("Welcome to hangman. Guess the word before the hangman falls.\nTo guess a letter, tip "+cb.settings.letterTip+" tokens. To guess the word early, tip "+cb.settings.wordTip+" tokens.",e,"",bcp.navy,"bold"),"Yes"==cb.settings.saviorTip&&cb.chatNotice("To reverse the state of the hangman by 1, tip "+cb.settings.saveTip+" tokens.",e,"",bcp.navy,"bold"),cb.chatNotice("Type '/rules' to see this message again. Good luck!\nThe current state of the hangman is:\n:sopphang"+t,e,"",bcp.navy,"bold")}function status(){if("5"==cb.settings.incorrectGuesses){if(0>incorrectGuess)return smallGuess[0];if(incorrectGuess>=0&&5>=incorrectGuess)return smallGuess[incorrectGuess];if(incorrectGuess>5)return smallGuess[5]}else if("9"==cb.settings.incorrectGuesses){if(0>incorrectGuess)return bigGuess[0];if(incorrectGuess>=0&&9>=incorrectGuess)return bigGuess[incorrectGuess];if(incorrectGuess>9)return smallGuess[9]}}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()}function updateLetters(e){letters.splice(letters.indexOf(e),1),rowTwo=letters.join(" "),cb.drawPanel()}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 init(){gameOver=!1;var e=cb.settings.word||"";currentWord=e.trim().toUpperCase(),cb.changeRoomSubject("We're playing hangman! First to "+cb.settings.roundsTotal+" wins. Prize: "+cb.settings.tipperPrize+". "+cb.settings.hashtags),newBoard(),rules(""),roundGuesses(),"Yes"==cb.settings.cheaters&&(cheatersTemp=!0)}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=1e3*cb.settings.timer,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="♥",bcp={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"};cb.settings_choices=[{name:"word",type:"str",minLength:1,maxLength:15,label:"Word to guess",defaultValue:"Hangman"},{name:"name",type:"str",minLength:1,maxLength:15,label:"Your Name",defaultValue:"Sophia"},{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:"incorrectGuesses",type:"choice",choice1:"5",choice2:"9",label:"Guesses before loss",defaultValue:"5"},{name:"roundsTotal",type:"int",minValue:1,maxValue:50,defaultValue:7,label:"Rounds necessary to win Final Prize"},{name:"tipperPrize",type:"str",minLength:1,maxLength:255,label:"Prize if Tippers win",defaultValue:"Cuchi Cuchi"},{name:"letterGIF",type:"str",minLength:1,maxLength:255,label:"GIF if tipper guesses letter",defaultValue:":Goodjobjim"},{name:"wordGIF",type:"str",minLength:1,maxLength:255,label:"GIF if tippers win a round",defaultValue:":goodjobguys5567"},{name:"modelGIF",type:"str",minLength:1,maxLength:255,label:"GIF if you win a round",defaultValue:":sophiapush5"},{name:"gameWinT",type:"str",minLength:1,maxLength:255,label:"GIF if tippers win the game",defaultValue:":congratulationslove"},{name:"gameWinM",type:"str",minLength:1,maxLength:255,label:"GIF if you win the game",defaultValue:":sophiadance"},{name:"timer",type:"int",minValue:1,maxValue:20,defaultValue:7,label:"Amount of time between turns (In seconds)"},{name:"topic",type:"str",minLength:1,maxLength:255,required:!1,label:"Room Topic after game over",defaultValue:"Let's copulate over and over ❤"},{name:"hashtags",type:"str",minLength:1,maxLength:255,required:!1,label:"Hashtags for your topic",defaultValue:"#lovense #ohmibod #sexy #fun"},{name:"roundPrizeOption",label:"Prize for winning a round",type:"choice",choice1:"Yes",choice2:"No",defaultValue:"No"},{name:"roundPrize",type:"str",minLength:1,maxLength:255,required:!1,label:"Prize for option above",defaultValue:"Cuchi Cuchi"},{name:"saviorTip",label:"Allow Tip to add another guess",type:"choice",choice1:"Yes",choice2:"No",defaultValue:"No"},{name:"saveTip",type:"int",minValue:1,maxValue:1e4,defaultValue:250,label:"Tip for another guess"},{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"}],cb.onDrawPanel(function(e){return 0==gameOver&&0==roundOver?{template:"3_rows_11_21_31",row1_value:hiddenWord,row2_value:rowTwo,row3_value:"First to "+cb.settings.roundsTotal+" wins! "+star+"Tippers: "+winsTippers+"/"+cb.settings.roundsTotal+" | "+cb.settings.name+": "+winsModel+"/"+cb.settings.roundsTotal+star+"\nGuesses Remaining: "+guessesRemaining}:0==gameOver&&1==roundOver?{template:"3_rows_11_21_31",row1_value:"The word was: "+forPanel,row2_value:"Waiting for the New Word to be chosen",row3_value:"First to "+cb.settings.roundsTotal+" wins! "+star+"Tippers: "+winsTippers+"/"+cb.settings.roundsTotal+" | "+cb.settings.name+": "+winsModel+"/"+cb.settings.roundsTotal+star}:1==gameOver&&1==modelWins?{template:"3_rows_11_21_31",row1_value:"Thank you all for playing!",row2_value:cb.settings.name+" is the winner!",row3_value:"Better Luck Next Time."}:1==gameOver&&1==tipperWins?{template:"3_rows_11_21_31",row1_value:"Thank you all for playing!",row2_value:"Congratulations, tippers! You beat "+cb.settings.name,row3_value:"Your Prize: "+cb.settings.tipperPrize}:void 0}),cb.onTip(function(e){var t=parseInt(e.amount);if(null==e.message.match(/optout/i)&&(net+=t,0==gameOver&&0==roundOver))if(t==cb.settings.letterTip)tippedWord.push(0),receiveTip(e.from_user);else if(t==cb.settings.wordTip)wordGuess=!0,tippedWord.push(1),receiveTip(e.from_user);else if(t==cb.settings.saveTip&&"Yes"==cb.settings.saviorTip){incorrectGuess--,guessesRemaining++;var s=status();cb.chatNotice(e.from_user+" has tipped to keep the hangman 1 guess closer to living!\nThe Current State of the Hangman is:\n:sopphang"+s,"","",bcp.black,"bold"),cb.drawPanel()}else(t!=cb.settings.letterTip||t!=cb.settings.wordTip||t!=cb.settings.saveTip)&&(bonus+=t)}),cb.onMessage(function(e){if(tipper.indexOf(e.user)>0&&0==gameOver)cb.chatNotice("Please wait your turn",e.user,"",bcp.black,"bold");else if(0==tipper.indexOf(e.user)&&0==guessed&&0==gameOver&&0==wordGuess&&0==roundOver){if("!"==e.m.substring(0,1)){var t=e.m.toString();if(t=t.substr(1,1).toUpperCase(),t.length>1)e["X-Spam"]=!0,cb.chatNotice("Your guess should only be 1 letter! Try again.",e.user,"",bcp.red,"bold");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,"",bcp.red,"bold");else if(0==letters.includes(t))e["X-Spam"]=!0,cb.chatNotice("That letter has already been guessed! Try again.",e.user,"",bcp.red,"bold");else if(0==currentWord.includes(t)){incorrectGuess++,guessesRemaining--;var s=status();e["X-Spam"]=!0,guessed=!0,updateLetters(t),cb.chatNotice("Sorry, "+t+" is not a letter in the word. The Current State of the Hangman is:\n:sopphang"+s,"","",bcp.red,"bold"),modelWin()}else e["X-spam"]=!0,guessed=!0,updateBoard(t),updateLetters(t),cb.chatNotice("Congratulations, "+e.user+", for guessing a correct letter!\n"+cb.settings.letterGIF,"","",bcp.green,"bold"),userWin()}}else if(0==tipper.indexOf(e.user)&&0==gameOver&&1==wordGuess&&0==roundOver&&"!"==e.m.substring(0,1)){var t=e.m.toString();if(t=t.slice(1).toUpperCase(),wordGuess=!1,guessed=!0,t==currentWord)e["X-spam"]=!0,cb.settings.cheaters="No",roundOver=!0,winsTippers++,userWin();else if(t!=currentWord){e["X-spam"]=!0,incorrectGuess+=2,guessesRemaining-=2;var s=status();cb.chatNotice(e.user+" has incorrectly guessed the word!\nThe Current State of the Hangman is:\n:sopphang"+s,"","",bcp.red,"bold"),modelWin(),cb.drawPanel()}}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}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(cb.settings.name+" has chosen not to allow mods to make a new word.",e.user,"",bcp.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)}"/"==e.m.substring(0,1)&&0==gameOver&&"/rules"==e.m.substring(0,6)&&(e["X-Spam"]=!0,rules(e.user))}),cb.onEnter(function(e){rules(e.user)}),init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.