Bots Home
|
Create an App
Rock Paper Scissors (Bot)
Author:
gargoyle1
Description
Source Code
Launch Bot
Current Users
Created by:
Gargoyle1
/** * Bot: Rock Paper Scissors Lizard Spock * Version: 1.1 * Author: gargoyle1 * Date: 04.11.15 */ var gametype = 3; var timeleft = 1; var result; var tipperhand; var performerhand; var username; var textcolor; colname = new Array('black','grey','blue','green','red','fire-red','pink'); colcode = new Array('#000000','#666699','#003399','#669a5e','#b84040','#ff0000','#ff6699'); cb.settings_choices = [ {name:'message_timer', type:'choice', label:'Game Message Repeating Time (minutes)', choice1:5, choice2:10, choice3:15, choice4:20, choice5:30, choice6:45, choice7:60, defaultValue:5}, {name:'color', type:'choice', label:'Note Color', choice1:'black', choice2:'grey', choice3:'blue', choice4:'green', choice5:'red', choice6:'fire-red', choice7:'pink', defaultValue:'grey', required:false}, {name:'game', type:'choice', label:'Game variation?', choice1: 'Rock Paper Scissors Lizard Spock', choice2: 'Classic Rock Paper Scissors', defaultValue: 'Rock Paper Scissors'}, {name:'tokens', type:'int', label:'Tip', minValue:1, maxValue:999, defaultValue: 20}, {name:'award', type:'str', minLength:1, maxLength:255, label:'Award', defaultValue: 'Take off one item of clothing'}, {name:'penalty', type:'str', minLength:1, maxLength:255, label:'Penalty', defaultValue: 'Take back on one item of clothing'}, {name:'rock', type:'str', minLength:1, maxLength:15, label:'Note for Rock', defaultValue: 'ROCK!'}, {name:'paper', type:'str', minLength:1, maxLength:15, label:'Note for Paper', defaultValue: 'PAPER!'}, {name:'scissors', type:'str', minLength:1, maxLength:15, label:'Note for Scissors', defaultValue: 'SCISSORS!'}, {name:'lizard', type:'str', minLength:1, maxLength:15, label:'Note for Lizard', defaultValue: 'LIZARD!'}, {name:'spock', type:'str', minLength:1, maxLength:15, label:'Note for Spock', defaultValue: 'SPOCK!'}, ]; cb.onEnter(function(user) { cb.sendNotice('Oh I know, let’s play Rock Paper Scissors Lizard Spock.', user['user'], '', textcolor, 'bold'); cb.sendNotice('It’s very simple...', user['user'], '', textcolor, 'bold'); cb.sendNotice(' Scissors cuts Paper. Paper covers Rock. Rock crushes Lizard. Lizard poisons Spock. Spock smashes Scissors. Scissors decapitates Lizard. Lizard eats Paper. Paper disproves Spock. Spock vaporizes Rock. And as it always has, Rock crushes Scissors.', user['user'], '', textcolor, 'bold'); cb.sendNotice('(Sheldon Cooper)', user['user'], '', textcolor, 'bold'); cb.sendNotice('', user['user'], '', textcolor, 'bold'); cb.sendNotice('We play ' + cb.settings.game + ' by gargoyle1!', user['user'], '', textcolor, 'bold'); cb.sendNotice('Play for ' + cb.settings.tokens + ' Tokens!', user['user'], '', textcolor, 'bold'); cb.sendNotice('When I loose: ' + cb.settings.award + '! When you loose: ' + cb.settings.penalty + '!', user['user'], '', textcolor, 'bold'); }); cb.onTip(function (tip) { if (parseInt(tip['amount']) == cb.settings.tokens) { cb.setTimeout(countDown, 1000); cb.setTimeout(winner, 6000); } }); cb.onMessage(function (msg) { if (msg['user'] == cb.room_slug || msg['is_mod']) { var message = msg['m'].split(' '); var filltext = msg['m'].split(' # '); if (msg['m'] == '/c') { msg['X-Spam'] = true; cb.sendNotice('/rules = show game rules', msg['user'], '', '', ''); cb.sendNotice('/time x = set game message time to x minutes', msg['user'], '', '', ''); cb.sendNotice('/color x = set color to x (name or code e.g. #FF6699)', msg['user'], '', '', ''); cb.sendNotice('', msg['user'], '', '', ''); cb.sendNotice('/variation classic/sheldon = set game variation to classic or sheldon cooper version', msg['user'], '', '', ''); cb.sendNotice('/tokens x = set to x tokens for shot', msg['user'], '', '', ''); cb.sendNotice('', msg['user'], '', '', ''); cb.sendNotice('/award # text = set text for award', msg['user'], '', '', ''); cb.sendNotice('/penalty # text = set text for penalty', msg['user'], '', '', ''); cb.sendNotice('/rock # text = set text for rock', msg['user'], '', '', ''); cb.sendNotice('/paper # text = set text for paper', msg['user'], '', '', ''); cb.sendNotice('/scissors # text = set text for scissors', msg['user'], '', '', ''); cb.sendNotice('/lizard # text = set text for lizard', msg['user'], '', '', ''); cb.sendNotice('/spock # text = set text for spock', msg['user'], '', '', ''); } if (msg['m'] == '/rules') { msg['X-Spam'] = true; messagetext(); } if (message[0] == '/time') { msg['X-Spam'] = true; cb.settings.message_timer = message[1]; timeleft = cb.settings.message_timer*60; mincount = 60; cb.sendNotice('Game message time set to ' + message[1] + ' minutes!', msg['user'], '', '', ''); } if (message[0] == '/color') { msg['X-Spam'] = true; cb.settings.color = message[1]; var codetest = message[1].split(''); if (codetest[0] == '#' && codetest.length == 7) { textcolor = message[1]; cb.sendNotice('Color set to code ' + textcolor + '!', msg['user'], '', '', ''); } else { setcolor(); } } if (message[0] == '/variation') { msg['X-Spam'] = true; if (message[1] == 'classic' || message[1] == 'sheldon') { if (message[1] == 'classic') { cb.settings.game = 'Classic Rock Paper Scissors'; } else { cb.settings.game = 'Rock Paper Scissors Lizard Spock'; } cb.sendNotice('change game variation to ' + cb.settings.game + '!', '', '', textcolor, 'bold'); } } if (message[0] == '/tokens') { msg['X-Spam'] = true; if (message[1] > 0) { cb.settings.tokens = message[1]; cb.sendNotice('Tip for shot set to ' + cb.settings.tokens + ' Tokens!', '', '', textcolor, 'bold'); } } if (filltext[0] == '/award') { msg['X-Spam'] = true; cb.settings.award = filltext[1]; cb.sendNotice('Award set to: ' + cb.settings.award + '!', '', '', textcolor, 'bold'); } if (filltext[0] == '/penalty') { msg['X-Spam'] = true; cb.settings.penalty = filltext[1]; cb.sendNotice('Penalty set to: ' + cb.settings.penalty + '!', '', '', textcolor, 'bold'); } if (filltext[0] == '/rock') { msg['X-Spam'] = true; cb.settings.empty = filltext[1]; cb.sendNotice('set text for rock to: ' + cb.settings.rock, msg['user'], '', '', ''); } if (filltext[0] == '/paper') { msg['X-Spam'] = true; cb.settings.empty = filltext[1]; cb.sendNotice('set text for paper to: ' + cb.settings.paper, msg['user'], '', '', ''); } if (filltext[0] == '/scissors') { msg['X-Spam'] = true; cb.settings.empty = filltext[1]; cb.sendNotice('set text for scissors to: ' + cb.settings.scissors, msg['user'], '', '', ''); } if (filltext[0] == '/lizard') { msg['X-Spam'] = true; cb.settings.empty = filltext[1]; cb.sendNotice('set text for lizard to: ' + cb.settings.lizard, msg['user'], '', '', ''); } if (filltext[0] == '/spock') { msg['X-Spam'] = true; cb.settings.empty = filltext[1]; cb.sendNotice('set text for spcok to: ' + cb.settings.spock, msg['user'], '', '', ''); } } return msg; }); function message() { messagetext(); cb.setTimeout(message, cb.settings.message_timer * 60000); } function messagetext() { cb.sendNotice('We play ' + cb.settings.game + ' by Gargoyle1!', '', '', textcolor, 'bold'); cb.sendNotice('Play for ' + cb.settings.tokens + ' Tokens!', '', '', textcolor, 'bold'); cb.sendNotice('When I loose: ' + cb.settings.award + '! When you loose: ' + cb.settings.penalty + '!', '', '', textcolor, 'bold'); } function setcolor() { for(var i=0;i<=6;i++) { if (cb.settings.color == colname[i]) { textcolor = colcode[i]; cb.sendNotice('Color set to ' + cb.settings.color + '!', msg['user'], '', '', ''); } } } function countDown() { if (timeleft <= 3) { cb.sendNotice((timeleft++) + ' ...', '', '', textcolor, 'bold'); cb.setTimeout(countDown, 1000); } else { cb.sendNotice(username + 's hand shows...', '', '', textcolor, 'bold'); rolldice(); tipperhand = result; cb.sendNotice(cb.room_slug + 's hand shows...', '', '', textcolor, 'bold'); rolldice(); performerhand = result; timeleft = 1; } }; function rolldice() { if (cb.settings.game == 'Classic Rock Paper Scissors') { gametype = 3; } else { gametype = 5; } var dieRoll = Math.floor((Math.random() * gametype) + 1); if (dieRoll == 1) result = cb.settings.rock; if (dieRoll == 2) result = cb.settings.paper; if (dieRoll == 3) result = cb.settings.scissors; if (dieRoll == 4) result = cb.settings.lizard; if (dieRoll == 5) result = cb.settings.spock; cb.chatNotice(result, '', '', textcolor, 'bold'); } function winner() { if (performerhand == cb.settings.rock) { if (tipperhand == cb.settings.scissors) { cb.sendNotice('Rock crushes Scissors!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.lizard) { cb.sendNotice('Rock crushes Lizard!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.paper) { cb.sendNotice('Paper covers Rock!', '', '', textcolor, 'bold'); winnote(); } if (tipperhand == cb.settings.spock) { cb.sendNotice('Spock vaporizes Rock!', '', '', textcolor, 'bold'); winnote(); } } if (performerhand == cb.settings.paper) { if (tipperhand == cb.settings.rock) { cb.sendNotice('Paper covers Rock!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.spock) { cb.sendNotice('Paper disproves Spock!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.scissors) { cb.sendNotice('Scissors cuts Paper!', '', '', textcolor, 'bold'); winnote(); } if (tipperhand == cb.settings.lizard) { cb.sendNotice('Lizard eats Paper!', '', '', textcolor, 'bold'); winnote(); } } if (performerhand == cb.settings.scissors) { if (tipperhand == cb.settings.paper) { cb.sendNotice('Scissors cuts Paper!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.lizard) { cb.sendNotice('Scissors decapitates Lizard!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.rock) { cb.sendNotice('Rock crushes Scissors!', '', '', textcolor, 'bold'); winnote(); } if (tipperhand == cb.settings.spock) { cb.sendNotice('Spock smashes Scissors!', '', '', textcolor, 'bold'); winnote(); } } if (performerhand == cb.settings.lizard) { if (tipperhand == cb.settings.paper) { cb.sendNotice('Lizard eats Paper!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.spock) { cb.sendNotice('Lizard poisons Spock!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.rock) { cb.sendNotice('Rock crushes Lizard!', '', '', textcolor, 'bold'); winnote(); } if (tipperhand == cb.settings.scissors) { cb.sendNotice('Scissors decapitates Lizard!', '', '', textcolor, 'bold'); winnote(); } } if (performerhand == cb.settings.spock) { if (tipperhand == cb.settings.rock) { cb.sendNotice('Spock vaporizes Rock!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.scissors) { cb.sendNotice('Spock smashes Scissors!', '', '', textcolor, 'bold'); loosenote(); } if (tipperhand == cb.settings.paper) { cb.sendNotice('Paper disproves Spock!', '', '', textcolor, 'bold'); winnote(); } if (tipperhand == cb.settings.lizard) { cb.sendNotice('Lizard poisons Spock!', '', '', textcolor, 'bold'); winnote(); } } } function winnote() { cb.sendNotice(username + ' wins the match!', '', '', textcolor, 'bold'); } function loosenote() { cb.sendNotice(cb.room_slug + ' wins the match!', '', '', textcolor, 'bold'); } function init() { setcolor(); message(); cb.sendNotice('Type c/ for setting commands, ' + cb.room_slug + '!', cb.room_slug, '', '', 'bold'); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.