Apps Home
|
Create an App
bbf-twistapp
Author:
bbm1979_1
Description
Source Code
Launch App
Current Users
Created by:
Bbm1979_1
//Twister by slavabo [cbslavabo[at]gmail.com] //* MODIFIED VERSION (CHANGED LABELS AND SPIN INTERVAL OPTIONS) //* OTHER CHANGES WILL BE POSTED HERE LATER // // var rls = 'v2.0'; //ReLeaSe version of game var tct = [0,[]]; //Tip Count Totals [ttl,['user1','user2',..]] var cht = [0,'']; //Current High Tip [amt,'tipper'] var spc = String.fromCharCode(160); //SPaCe: non collapsible character // var ssa = 0; //Seconds Since Action var spn = 0; //SPiNs remaining var sps = []; //SPecial Spins var lma = ''; //Last Moved Appendage (ex: 'rh') var cbp = []; //Current Body Placement ['rh':'b', 'rf':'g', 'lh':'r', 'lf':'y'] var psd = false; //PauSeD: used to pause gameplay var whl = ['RIGHT','LEFT','HAND','FOOT','BLUE','GREEN','RED','YELLOW']; var clr = {BLUE:'#9999FF',GREEN:'#99FF99',RED:'#FF9999',YELLOW:'#FFFF99'} //CoLoRs // cb.settings_choices = [ {name:'cst', type:'int', minValue:1, maxValue:999, defaultValue:10, label:'Spin Cost (1-999)'}, //CoST {name:'sis', type:'choice', choice1:20, choice2:15, choice3:10, defaultValue:10, label:'Spin Interval (seconds)'}, {name:'ris', type:'choice', choice1:20, choice2:30, choice3:60, choice4:120, choice5:300, defaultValue:60, label:'Request Interval (seconds)'}, {name:'ttm', type:'int', minValue:60, maxValue:990, defaultValue:600, label:'Time To Move (seconds)'}, {name:'htc', type:'choice', choice1:'Enable', choice2:'Disable', defaultValue:'Enable', label:'High Tipper\'s Choice'}, ]; cb.tipOptions(function(user) { if (cb.settings.htc=='Disable') return; var opt = []; for (var bbb=2;bbb<4;bbb++) for (var aaa=0;aaa<2;aaa++) for (var ccc=4;ccc<8;ccc++) opt.push({label:(whl[aaa]+' '+whl[bbb]+' '+whl[ccc]).toLowerCase()+' *ignore*'}); return {options:opt, label:'*** TIP MORE THAN "Highest Tip" ('+cht[0]+'tkn) TO CHOOSE BELOW***'}; }); cb.onTip(function (tip) { tct[0] += tip['amount']; var rgx = /^(?:right|left) (?:hand|foot) (?:blue|green|red|yellow)(?:\s.*)?$/g.test(tip['message']); //ReGeX (tip message matches spin format) if (tip['amount']>cht[0]&&tip['amount']>=cb.settings.cst) { if (cb.settings.htc=='Enable'&&rgx) sps.push(tip['message']); cht[0] = tip['amount']; cht[1] = tip['from_user']; } else if (cb.settings.htc=='Enable'&&rgx) cb.chatNotice('*** Error: you must tip more than \'Highest Tip\' ('+cht[0]+'tkn) to choose your spin.',tip['from_user']); spinWheel(spn+=Math.floor(tip['amount']/cb.settings.cst)); cb.drawPanel(); }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Who\'s the best?:', 'row1_value': (cht[0])?cht[0]+' ('+cht[1]+')':'(No Tips Yet)', //'row1_label': 'Total Tips:', //'row1_value': (tct[0])?tct[0]:'None :-(', 'row2_label': 'Spin Cost:', 'row2_value': (cb.settings.cst==1)?cb.settings.cst+' Token':cb.settings.cst+' Tokens', //'row3_label': 'Highest Tip:', //'row3_value': (cht[0])?cht[0]+' ('+cht[1]+')':'(No Tips Yet)' }; }); cb.onMessage(function (msg) { if (/(?:camshacks|danacamsessions|milfic).*c[o0]m/ig.test(msg['m'])) msg['X-Spam'] = true; //block spam if ((msg['user']==cb.room_slug||msg['is_mod'])&&msg['m']=='/pause') { psd = (psd)?false:true; cb.chatNotice('*** Twister gameplay has been toggled by '+msg['user']+' (pause='+psd+').','','','','bold'); if (!psd) spinWheel(); msg['X-Spam'] = true; } else if ((msg['user']==cb.room_slug||msg['is_mod'])&&msg['m']=='/fall') { psd = true; cb.chatNotice('*** ' + cb.room_slug + ' has fallen. Twister gameplay has been paused by '+msg['user']+' (pause='+psd+').','','','','bold'); msg['X-Spam'] = true; } else if ((msg['user']==cb.room_slug||msg['is_mod'])&&msg['m']=='/play') { psd = false; cb.chatNotice('*** Twister gameplay has been resumed by '+msg['user']+' (pause='+psd+').','','','','bold'); if (!psd) spinWheel(); msg['X-Spam'] = true; } else if (msg['m']=='/about') { cb.chatNotice('*** TWISTER '+rls+': sis='+cb.settings.sis+'; ris='+cb.settings.ris+'; htc='+cb.settings.htc,msg['user']); msg['X-Spam'] = true; } if ((msg['user']==cb.room_slug||msg['is_mod'])&&msg['m']=='/?') { cb.sendNotice('/pause - Toggle the game\n/fall - Pause the game\n/play - Start the game\n/subject [NEW SUBJECT] - Set a new subject\n/ttm [TIME IN SECONDS] - Set the idle time before freeing first hand', '', '#666666', '#ffffff', 'normal', 'red'); cb.sendNotice('/pause - Toggle the game\n/fall - Pause the game\n/play - Start the game\n/subject [NEW SUBJECT] - Set a new subject\n/ttm [TIME IN SECONDS] - Set the idle time before freeing first hand', cb.room_slug, '#666666', '#ffffff', 'normal', ''); msg['X-Spam'] = true; } else if ((msg['user']==cb.room_slug||msg['is_mod'])&&msg['m'].substring(0,4)=='/ttm') { // Change TTM (Time To Move) if (msg['m'].indexOf(" ") > -1){ // If the message contains a space, get argument cb.settings.ttm = msg['m'].substring(msg['m'].indexOf(' ') + 1); } else{ cb.settings.ttm = 180; } cb.sendNotice('TTM has been set to ' + cb.settings.ttm + ' seconds by ' + msg['user'], '', '#666666', '#ffffff', 'bold', 'red'); cb.sendNotice('TTM has been set to ' + cb.settings.ttm + ' seconds by ' + msg['user'], cb.room_slug, '#666666', '#ffffff', 'bold', ''); msg['X-Spam'] = true; } else if ((msg['user']==cb.room_slug||msg['is_mod'])&&msg['m'].substring(0,8)=='/subject') { if (msg['m'].indexOf(" ") > -1){ // If the message contains a space, get argument cb.changeRoomSubject(msg['m'].substring(msg['m'].indexOf(' ') + 1)) msg['X-Spam'] = true; } else{ // DO NOTHING IF NO SUBJECT IS SET } } else if (spn>=10&&(!(msg['in_fanclub']||msg['has_tokens']||msg['is_mod']||msg['tipped_recently']||msg['user']==cb.room_slug))) msg['m'] = msg['m'].replace(":",";"); return msg; }); // function spinWheel(nil) { if (spn&&ssa>=cb.settings.sis) { //spin no more than once every X seconds if (psd) { cb.chatNotice('*** Spins Pending: '+spn+' ... Waiting for broadcaster to type /pause to resume spins.'); return false; } spn--; ssa=0; if (sps.length) { var pt0 = sps.shift().toUpperCase().split(" "); var pt1 = pt0[0]; var pt2 = pt0[1]; var pt3 = pt0[2]; var cca = pt1.charAt(0)+pt2.charAt(0); //Current Chosen Appendage ssa = -8; //pause an extra 8 seconds before next spin } else { do { var pt1 = whl[Math.floor(Math.random()*2)]; var pt2 = whl[Math.floor(Math.random()*2)+2]; //array offset 2 var pt3 = whl[Math.floor(Math.random()*4)+4]; //array offset 4 var cca = pt1.charAt(0)+pt2.charAt(0); //Current Chosen Appendage } while (cbp[cca]==pt3.charAt(0)||cca==lma); } cbp[cca] = pt3.charAt(0); lma = cca; var pt4 = (spn>1)?'s':'', pt4 = (spn)?' ['+spn+' spin'+pt4+' remaining]':''; cb.chatNotice('*** '+pt1+spc+spc+spc+pt2+spc+spc+spc+pt3+' ***'+pt4,'',clr[pt3],'','bold'); } if (spn) cb.setTimeout(spinWheel,1000); } function counter() { if (!psd && cb.settings.ttm == ssa){ // If the game is not paused and the Time To Move 1 is reached, post notice //cb.chatNotice(cb.room_slug + ' may move first hand [idle: '+ssa+'sec]'); //cb.sendNotice('YOU MAY MOVE YOUR FIRST HAND!', cb.room_slug, '#000000', '#ffffff', 'bold', ''); cb.sendNotice('YOU MAY MOVE YOUR FIRST HAND!','', '#000000', '#ffffff', 'bold', ''); } else if (!psd && cb.settings.ttm * 2 == ssa){ // If the game is not paused and the Time To Move 2 is reached, post notice //cb.chatNotice(cb.room_slug + ' may move second hand [idle: '+ssa+'sec]'); //cb.sendNotice('YOU MAY MOVE YOUR SECOND HAND!', cb.room_slug, '#000000', '#ffffff', 'bold', ''); cb.sendNotice('YOU MAY MOVE YOUR SECOND HAND!','', '#000000', '#ffffff', 'bold', ''); } if (++ssa&&ssa%cb.settings.ris==0) { //request tokens if X seconds since activity if (psd) cb.chatNotice('*** Twister is currently paused. Waiting for broadcaster to type /pause to resume gameplay.'); else { cb.chatNotice('Tip *'+cb.settings.cst+'tkn* to spin the Twister wheel! [idle: '+ssa+'sec]'); cb.chatNotice('After ' + cb.settings.ttm + ' seconds without tips, ' + cb.room_slug + ' may move 1 hand. After ' + cb.settings.ttm * 2 + ' seconds without tips, ' + cb.room_slug + ' may move 2 hands.'); } } cb.setTimeout(counter,1000); } // cb.changeRoomSubject('Twister- tip '+cb.settings.cst+'tkn to spin the wheel! (tip in multiples for more fun'+((cb.settings.htc=='Enable')?' | tip more than the Highest Tip to choose your spin':'')+')'); if (cb.settings.htc=='Enable') cb.chatNotice('*** ATTENTION *** ignore the spins in the tip note. If the tip was high enough, it will send a spin notice with that user\'s choice.',cb.room_slug) //cb.chatNotice('*** ATTENTION *** you or a mod may type /pause, /fall, /play at any time to (un)pause the spins (such as after falling if you need a second to recuperate).',cb.room_slug) cb.sendNotice('*** ATTENTION *** Type /? for commands.',cb.room_slug, '#666666', '#ffffff', 'normal', ''); counter(); cb.onEnter(function(user) { if (user['user'] == 'hax55' && cb.room_slug == 'johnnywildex'){ cb.chatNotice('Hey, fucker!'); } if (user['is_mod']){ cb.sendNotice('*** TWISTER IS ACTIVE ***\nType /? for commands.',user['user'], '#666666', '#ffffff', 'normal', ''); } });
© Copyright Chaturbate 2011- 2025. All Rights Reserved.