Apps Home
|
Create an App
RR private 001
Author:
callmeeeeeedaddyj
Description
Source Code
Launch App
Current Users
Created by:
Callmeeeeeedaddyj
/** * Bot: Russian Roulette Game * Version: 1.1 * Author: gargoyle1 * Date: 04.11.15 */ var timeleft = 3; var result; var chambers = 6; 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:'bullets', type:'choice', label:'Number of bullets', choice1:1, choice2:2, choice3:3, choice4:4, choice5:5, defaultValue:1}, {name:'drum', type:'choice', label:'Turn drum after every shot?', choice1: 'yes', choice2: 'no', defaultValue: 'yes'}, {name:'tokens', type:'int', label:'Tip for shoot', 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:'empty', type:'str', minLength:1, maxLength:15, label:'Note for empty chamber', defaultValue:'CLICK!'}, {name:'shot', type:'str', minLength:1, maxLength:15, label:'Note for bullet in chamber', defaultValue:'BANG!'}, ]; cb.onEnter(function(user) { cb.sendNotice('Play Russian Roulette with me, ' + user['user'] + ', by gargoyle1!', user['user'], '', textcolor, 'bold'); cb.sendNotice(cb.settings.bullets + ' bullet(s) in drum! Turn the drum for every shot? ' + cb.settings.drum + '!', user['user'], '', textcolor, 'bold'); cb.sendNotice('Shoot 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.sendNotice(cb.room_slug + ' takes the gun and begins!', '', '', textcolor, 'bold'); cb.setTimeout(countDown, 1000); cb.setTimeout(secondshot, 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 timer 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('/bullets x = set to x bullets in drum', msg['user'], '', '', ''); cb.sendNotice('/turndrum yes/no = set turn drum yes or no', msg['user'], '', '', ''); cb.sendNotice('/tokens x = set to x tokens for shot', msg['user'], '', '', ''); cb.sendNotice('', cb.room_slug, '', '', ''); cb.sendNotice('/award # text = set text for award', msg['user'], '', '', ''); cb.sendNotice('/penalty # text = set text for penalty', msg['user'], '', '', ''); cb.sendNotice('/empty # text = set text for empty chamber', msg['user'], '', '', ''); cb.sendNotice('/shot # text = set text for bullet in chamber', 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] == '/bullets') { msg['X-Spam'] = true; if (message[1] > 0 && message[1] < 6) { cb.settings.bullets = message[1]; cb.sendNotice('Number of bullets set to ' + cb.settings.bullets + '!', '', '', textcolor, 'bold'); } } if (message[0] == '/turndrum') { msg['X-Spam'] = true; if (message[1] == 'yes' || message[1] == 'no') { cb.settings.drum = message[1]; cb.sendNotice('Turn drum set to ' + cb.settings.drum + '!', '', '', 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] == '/empty') { msg['X-Spam'] = true; cb.settings.empty = filltext[1]; cb.sendNotice('Result for empty chamber set to: ' + cb.settings.empty, cb.room_slug, '', '', ''); } if (filltext[0] == '/shot') { msg['X-Spam'] = true; cb.settings.shot = filltext[1]; cb.sendNotice('Result for bullet in chamber set to: ' + cb.settings.shot, '', cb.room_slug, '', '', ''); } } return msg; }); function message() { messagetext(); cb.setTimeout(message, cb.settings.message_timer * 60000); } function messagetext() { cb.sendNotice('Play Russian Roulette with me, by Gargoyle1!', '', '', textcolor, 'bold'); cb.sendNotice(cb.settings.bullets + ' bullet(s) in drum! Turn the drum for every shot? ' + cb.settings.drum + '!', '', '', textcolor, 'bold'); cb.sendNotice('Shoot 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 > 0) { cb.sendNotice((timeleft--) + ' ...', '', '', textcolor, 'bold'); cb.setTimeout(countDown, 1000); } else { cb.setTimeout(shotresult, 1000); timeleft = 3; } }; function shotresult() { var dieRoll = Math.floor((Math.random() * chambers) + 1); if (dieRoll > cb.settings.bullets) result = cb.settings.empty; if (dieRoll <= cb.settings.bullets) result = cb.settings.shot; cb.chatNotice('... ' + result, '', '', textcolor, 'bold'); nodrumroll(); } function secondshot() { if (result == cb.settings.empty) { cb.sendNotice(username + ' takes the gun and goes on!', '', '', textcolor, 'bold'); cb.setTimeout(countDown, 1000); } else { cb.sendNotice(cb.room_slug + ' loose!', '', '', textcolor, 'bold') } } function nodrumroll() { if (cb.settings.drum == 'no') { if (result == cb.settings.shot) { chambers = 6; } else { chambers = chambers -1; } } } function init() { setcolor(); message(); cb.sendNotice('Type c/ for setting commands, ' + cb.room_slug + '!', cb.room_slug, '', '', 'bold'); } init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.