Apps Home
|
Create an App
tedtmc2
Author:
wbrock
Description
Source Code
Launch App
Current Users
Created by:
Wbrock
/** lovin_cali_girl's manual f-machine app tested at https://yyanx.github.io/CB-TestBed/ Special Commands for Broadcaster & Mods "!pause-m" will pause the MAIN timer and send tips to a queue "!resume-m" will restart the MAIN timer and set back to normal "!fmmanual=" will manually set the BONUS timer to whatever number follows the "=" "!fmbonus=" will double the value of the tips for whatever number is after the "=" "!donotusetrigger" will turn OFF the feature that you need to get to a minimun number of tokens before the machine starts "!usetrigger" will turn ON the feature that you need to get to a minimun number of tokens before the machine starts "!fmgoal=" will change the goal amount "!stopads" will stop the repeating notifier of cost "!startads" will re-start the repeating notifier "!nomoretips" will not add more tips to the remainging runtime of the machine "!acceptmoretips" will resume adding more tips to the remaining runtime of the machine "!grayscannotplay" will turn off giving grays the 30 second time credit "!grayscanplay" will tunr on giving grays the 30 second time credit */ var _timeCanBeAdded = true; var _triggerHasBeenPulled = false; var _triggerBeingUsed = parseInt(cb.settings.use_trigger); var _triggerAmount = parseInt(cb.settings.trigger_value); var isItGoing = 0; var isItPaused = 0; var areAdsStopped = 0; var isBonusGoing = 0; var tipJar = 0; var roomName = cb.settings.room_name; var roomHashTags = cb.settings.room__hash_tags; var startApp = new Date(); var reduceTJ = 1000; var _time_multiplier = 1; var _chance_cost = cb.settings.chance_cost; var _timeRemainingString = "0 hr. 0 min. 0 sec."; var _bonusTimeRemainingString = "0 min. 0 sec."; var _bonusSecsRemaining = 0; var _bonusMessage = ":ml-gl Tips are worth DOUBLE until the BONUS timer runs out! :ml-gl"; var _msg4users = "" + _time_multiplier + " second(s) per token"; var _min = cb.settings.chance_min; var _max = cb.settings.chance_max; var _f_spokenCounter = 0; var _operate_string = "Your tips activate the fuck-machine... " + _time_multiplier + " second per token"; var _chance_string = "FEELING LUCKY? If you tip exactly " + _chance_cost + " tokens, your tip could turn into anything between " + _min + " and " + _max + " tokens."; // // Outgoing "credits" message for users with tokens as they enter the room // var creditString1 = "\n" + ( (parseInt(cb.settings.credit_amount)==1) ? ':100tkste3' : ':200tkste3'); var creditString2 = "You have been given a " + ( (parseInt(cb.settings.credit_amount)==1) ? '100' : '200') + " token credit to be used only in this room for this session."; var creditString3 = "CONDITION: You need to stay here CONTINUOUSLY for " + parseInt(cb.settings.min_time_required) + " minutes before you can use it."; var creditString4 = "After " + parseInt(cb.settings.min_time_required) + " minutes, you can tip any amount and your " + ( (parseInt(cb.settings.credit_amount)==1) ? '100' : '200') + " token credit will be added to your tip. It will NOT cost you more than you tipped."; var creditMessage = creditString1 + "\n" + creditString2 + "\n" + creditString3 + "\n" + creditString4 + "\n"; // // Outgoing "credits" message for GRAYS as they enter the room // var grayCreditString1 = ":lcg_no_tokens_read_this"; var grayCreditString2 = "You have been given a 30 second time credit even though you have no tokens."; var grayCreditString3 = "CONDITION: You need to stay here CONTINUOUSLY for " + parseInt(cb.settings.min_time_required) + " minutes before you can use it."; var grayCreditString4 = "After " + parseInt(cb.settings.min_time_required) + " minutes, just type 'credit' in the chat, and 30 seconds will be added onto the machine."; var grayCreditMessage = "\n" + grayCreditString1 + "\n" + grayCreditString2 + "\n" + grayCreditString3 + "\n" + grayCreditString4 + "\n"; var graysCanPlay = parseInt(cb.settings.give_grays_credit); // // Outgoing explaination of how the machine works on tips // var welcomeMessage1 = ":fuckmachinetip"; var welcomeMessage2 = "The machine will go full speed for " + (_triggerAmount / 60) + " minutes as soon as " + _triggerAmount + " tokens are received."; var welcomeMessage3 = "Once the machine is going full speed, it will remain that way until time runs out."; var welcomeMessage4 = "You can keep it going by tipping."; var welcomeMessage = welcomeMessage1 + "\n" + welcomeMessage2 + "\n" + welcomeMessage3 + "\n" + welcomeMessage4; cb.changeRoomSubject(roomName + ' ' + roomHashTags); cb.setTimeout(checkJar, reduceTJ); cb.sendNotice( _chance_string, "" , "#FFDDFF", "#FF55FF", "bold", ""); var userObjsArray = []; /** * * Chaturbate APP CONFIG settings * */ cb.settings_choices = [ {name:'room_name', type: 'str', minLength: 1, maxLength: 255, required: true, label:'Room Name:', default:'My Room'}, {name:'room__hash_tags', type: 'str', minLength: 1, maxLength: 500, label:'Room Hash Tags:', default:'#fuckmachine'}, {name:'chance_cost', type:'int', minValue:1, maxValue:100, default:20, label:'Cost to take a chance.'}, {name:'chance_min', type:'int', minValue:1, maxValue:100, default:15, label:'The lowest value their chance could turn into.'}, {name:'chance_max', type:'int', minValue:1, maxValue:1000, default:40, label:'The highest value their chance could turn into.'}, {name:'use_trigger', type:'int', minValue:0, maxValue:1, default:0, label:'Use a goal value to start the timer. 1 is ON. 0 is OFF.'}, {name:'trigger_value', type:'choice', label:'The amount of tips needed to trigger the timer.', choice1:'60', choice2:'120', choice3:'180', choice4:'240', choice5:'300', choice6:'360', choice7:'420', choice8:'480', choice9:'540', choice10:'600', choice11:'900', choice12:'1200', defaultValue:'180'}, {name:'give_credit', type:'int', minValue:0, maxValue:1, default:0, label:'Give the user a 100-200 token credit. 1 is ON. 0 is OFF.'}, {name:'min_time_required', type:'int', minValue:1, maxValue:30, default:30, label:'Number of minutes until credit can be used.'}, {name:'credit_amount', type:'int', minValue:1, maxValue:2, default:1, label:'1 for 100 tokens, or 2 for 200 tokens.'}, {name:'give_grays_credit', type:'int', minValue:0, maxValue:1, default:0, label:'Give time credit to grays? 0 for NO, or 1 for YES.'} ]; /** * * Calculate how much time remains for the machine to be running * and reset the _timeRemainingString variable. * */ function calcTimeRemaining(){ // Get todays date and time var now = new Date().getTime(); var _dateInTheFuture = now + (tipJar * reduceTJ); var distance = _dateInTheFuture - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); _timeRemainingString = "" + hours + " hr. " + minutes + " min. " + seconds + " sec."; } /** * * Calculate how much time is remaining for the BONUS period * */ function calcBonusTimeRemaining() { // Get todays date and time var now = new Date().getTime(); var _dateInTheFuture = now + (_bonusSecsRemaining * reduceTJ); var distance = _dateInTheFuture - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); if (_time_multiplier > 1) { //_bonusTimeRemainingString = "" + _time_multiplier + " secs. per token BONUS ends in " + minutes + " min. " + seconds + " sec."; _bonusTimeRemainingString = "BONUS - Tips worth DOUBLE for " + minutes + " min. " + seconds + " sec."; } else { _bonusTimeRemainingString = "" + _time_multiplier + " second(s) per token"; } } /** * * THREAD FOR BONUS USE * */ function bonusCountdown() { if ((isBonusGoing == 1) && (isItPaused == 0)) { if (_bonusSecsRemaining > 0) { _bonusSecsRemaining = _bonusSecsRemaining - 1; if (_bonusSecsRemaining < 1) { isBonusGoing = 0; _time_multiplier = 1; _msg4users = "" + _time_multiplier + " second per token"; _operate_string = "Your tips activate the fuck-machine... 1 second per token"; cb.sendNotice(_operate_string, "", "#FFDDFF", "#FF55FF", "bold", ""); } } } calcBonusTimeRemaining(); cb.setTimeout(bonusCountdown, 1000); if( _timeCanBeAdded == true ){ _msg4users = _bonusTimeRemainingString; } else{ _msg4users = ""; } } bonusCountdown(); /** * * This is the MAIN countdown timer function * */ function checkJar() { if (_triggerBeingUsed === 0) { if ((isItGoing == 1) && (isItPaused == 0)) { if (tipJar > 0) { tipJar = tipJar - 1; if (tipJar < 0) { resetApp(); } } else { resetApp(); } } } if (_triggerBeingUsed === 1) { if (_triggerHasBeenPulled === true) { if ((isItGoing == 1) && (isItPaused == 0)) { if (tipJar > 0) { tipJar = tipJar - 1; if (tipJar < 0) { resetApp(); _triggerHasBeenPulled = false; // <<== the only difference } } else { resetApp(); _triggerHasBeenPulled = false; // <<== the only difference } } } } calcTimeRemaining(); cb.setTimeout(checkJar, reduceTJ); // recursive call cb.drawPanel(); } /** * * A recurring sendNotice thread * */ function AddToChat() { if(_timeCanBeAdded == true){ if (isItPaused === 0) { if (areAdsStopped === 0){ if (_triggerBeingUsed === 0) { cb.sendNotice(_operate_string, "", "#FFDDFF", "#FF55FF", "bold", ""); cb.sendNotice(_chance_string, "", "#FFDDFF", "#FF55FF", "bold", ""); } else { _operate_string = "The machine will run at max speed every " + _triggerAmount + "th token for " + (_triggerAmount / 60) + " minutes"; cb.sendNotice(_operate_string, "", "#b2fffe", "#b283fe", "bold", ""); cb.sendNotice(_chance_string, "", "#FFDDFF", "#FF55FF", "bold", ""); if (((_triggerAmount - tipJar) >= 0) && (isItGoing === 0)) { cb.sendNotice("Max speed for " + (_triggerAmount / 60) + " minutes will begin with " + (_triggerAmount - tipJar) + " more tokens.", '', '', '#9b232f', 'bold'); if( _triggerAmount - tipJar <= 60 ){ cb.sendNotice(":next" + (_triggerAmount - tipJar), '', '', '#9b232f', 'bold' ); } } } if (_time_multiplier > 1) { cb.sendNotice(_bonusMessage, '', '', '#9b232f', 'bold'); } } } } cb.setTimeout(AddToChat, 90000); } AddToChat(); /** * * Draws the panel. Only APPS can use the panel. * */ cb.onDrawPanel(function(user) { if (_triggerBeingUsed === 0) { return { 'template': '3_rows_11_21_31', 'row1_value': roomName, 'row2_value': _msg4users, 'row3_value': 'Machine stops in : ' + _timeRemainingString }; } else{ if (_triggerHasBeenPulled === true) { if (isItGoing == 1) { if (tipJar > 0) { return { 'template': '3_rows_11_21_31', 'row1_value': roomName, 'row2_value': _msg4users, 'row3_value': 'Machine stops in : ' + _timeRemainingString }; } else{ return { 'template': '3_rows_11_21_31', 'row1_value': roomName, 'row2_value': _msg4users, 'row3_value': (_triggerAmount / 60) + ' min. max speed in ' + (_triggerAmount - tipJar) + ' more tokens' }; } } } else { if (_timeCanBeAdded === true) { return { 'template': '3_rows_11_21_31', 'row1_value': roomName, 'row2_value': _msg4users, 'row3_value': (_triggerAmount / 60) + ' min. max speed in ' + (_triggerAmount - tipJar) + ' more tokens' }; } else{ return { 'template': '3_rows_11_21_31', 'row1_value': roomName, 'row2_value': _msg4users, 'row3_value': '' }; } } } }); /** * * ON MESSAGE..... * */ cb.onMessage(function(msg) { var str = ''; var arr = []; if ( (msg.m.includes('/menu')) || ( msg.m.includes('/tipmenu'))) { msg['X-Spam'] = true; cb.sendNotice( "There is no menu. The machine will go full speed for " + (_triggerAmount / 60) + " minutes as soon as " + _triggerAmount + " tokens are received. Once the machine is going full speed, it will remain that way until time runs out. You can keep it going by tipping. :fuckmachinetip", msg['user'], '', '#9b23ff', 'bold'); } if(( !msg.has_tokens ) && ( graysCanPlay )){ if (msg.m.toLowerCase().includes('credit')){ msg['X-Spam'] = true; ApplyCredit( msg.user ); } } // // only the broadcaster or a mod can change the cost per second // if ((msg.user === cb.room_slug) || (msg.is_mod === true)) { if (msg.m.includes('!fmbonus=')) { //if (msg.m.substring(0, 9) == '!fmbonus=') { ActivateBonus(msg); //} else if (msg.m.substring(0, 10) == '!fmmanual=') { }else if (msg.m.includes('!fmmanual=')) { SetTimerManually(msg); //} else if (msg.m.substring(0, 8) == '!fmgoal=') { }else if (msg.m.includes('!fmgoal=')) { SetGoalManually(msg); //} else if (msg.m == '!pause-m') { }else if (msg.m.includes('!pause-m')) { msg['X-Spam'] = true; PauseMachine(); //} else if (msg.m == '!resume-m') { }else if (msg.m.includes('!resume-m')) { msg['X-Spam'] = true; ResumeMachine(); //} else if (msg.m == '!stopads') { }else if (msg.m.includes('!stopads')) { msg['X-Spam'] = true; areAdsStopped = 1; cb.sendNotice( "Ads are stopped - only the broadcaster can see this message", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //} else if (msg.m == '!startads') { }else if (msg.m.includes('!startads')) { msg['X-Spam'] = true; areAdsStopped = 0; cb.sendNotice( "Ads are started - only the broadcaster can see this message", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //} else if (msg.m == '!nomoretips') { }else if (msg.m.includes('!nomoretips')) { msg['X-Spam'] = true; NoMoreTips(); cb.sendNotice( "Time can no longer be added to the timer.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //} else if (msg.m == '!acceptmoretips') { }else if (msg.m.includes('!acceptmoretips')) { msg['X-Spam'] = true; AcceptMoreTips(); cb.sendNotice( "Time can now be added to the timer.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //else if(msg.m == '!grayscannotplay'){ } else if (msg.m.includes('!grayscannotplay')) { msg['X-Spam'] = true; graysCanPlay = 0; cb.sendNotice( "Grays can NOT use credit.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //else if(msg.m == '!grayscanplay'){ } else if (msg.m.includes('!grayscanplay')) { msg['X-Spam'] = true; graysCanPlay = 1; cb.sendNotice( "Grays CAN use credit.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //else if(msg.m == '!donotusetrigger'){ } else if (msg.m.includes('!donotusetrigger')) { msg['X-Spam'] = true; _triggerBeingUsed = 0; cb.sendNotice( "Trigger is turned OFF.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //} else if(msg.m == '!usetrigger'){ } else if (msg.m.includes('!usetrigger')) { msg['X-Spam'] = true; _triggerBeingUsed = 1; cb.sendNotice( "Trigger is turned ON.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); //else if (msg.m == '!test'){ } else if (msg.m.includes('!test')) { msg['X-Spam'] = true; var tokensToGive = 0; tokensToGive = (parseInt(cb.settings.credit_amount)==1) ? 100 : 200; var enteredTime = new Date().getTime(); // the number of millisends since midnight Jan. 1, 1970 var userObj = {username:'broadcaster', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'mod', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'fan', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'hasTokens', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'tippedRecently', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'tippedAlotRecently', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'tippedTonsRecently', entered:enteredTime, credit: tokensToGive, hasTokens: 1}; userObjsArray.push(userObj); userObj = {username:'grey', entered:enteredTime, credit: 30, hasTokens: 0}; userObjsArray.push(userObj); cb.sendNotice( "Fake users have entered the room.", cb.room_slug, "#b2fffe", "#b283fe", "bold", ""); } } }); var _startMsg = "=== START THE MACHINE ==="; var _stopMsg = "=== STOP THE MACHINE ==="; var _random = 0; var _new_line = 0; /** * * ON TIP..... * */ cb.onTip(function (tip) { if( _timeCanBeAdded === true ) { // // // A normal tip to start the machine tells the users it's started // // if( _triggerBeingUsed === 0 ){ if((tipJar === 0) && ( isItPaused === 0 )){ cb.sendNotice( _startMsg, cb.room_slug, "#00FF00", "", "bold", ""); cb.sendNotice( "The machine has started thanks to " + tip.from_user, "" , "#00FF00", "", "bold", ""); } } // // // When the machine is PAUSED, tell the users it's paused and that their tips will be added // // if(( isItPaused === 1 )&&(tipJar >= 0)){ cb.sendNotice( "The machine is PAUSED. Tips will be added onto the queue.", '', '', '#9b232f', 'bold'); } // // // When someone FEELS LUCKY, and tipped the correct amount to take a chance // // if( parseInt(tip.amount) == _chance_cost ){ var bonusAmount = 0; if(( isBonusGoing == 1 )&&( isItGoing == 1 )){ _random = Math.round( Math.random() * (+(_max/1.5) - +_min) + +_min); _random *= 1.2; _random = Math.round(_random); } else{ _random = Math.round( Math.random() * (+_max - +_min) + +_min); } bonusAmount = _random * _time_multiplier; //cb.sendNotice( "bonusAmount = " + bonusAmount + "", '', '', '#9b232f', 'bold'); if( bonusAmount > parseInt(tip.amount) ){ cb.sendNotice( tip.from_user + "'s tip went from " + tip.amount + " to " + bonusAmount + " :smiley", "" , "#FFDDFF", "#FF55FF", "bold", ""); }else if( bonusAmount === parseInt(tip.amount) ){ cb.sendNotice( tip.from_user + "'s tip went from " + tip.amount + " to " + bonusAmount, "" , "#FFDDFF", "#FF55FF", "bold", ""); }else if( bonusAmount < parseInt(tip.amount) ){ cb.sendNotice( tip.from_user + "'s tip went from " + tip.amount + " to " + bonusAmount + " :cryy", "" , "#FFDDFF", "#FF55FF", "bold", ""); } tipJar += bonusAmount; if( parseInt(cb.settings.give_credit)) { ApplyCredit( tip.from_user ); } } // // // Not a "FEELING LUCKY" tip... just a normal tip that adds to the time... // // else{ tipJar += parseInt(tip.amount) * _time_multiplier; if( parseInt(cb.settings.give_credit)) { ApplyCredit( tip.from_user ); } } // // // If it BONUS time... special message // // if( _time_multiplier > 1 ){ cb.sendNotice( _bonusMessage, '', '', '#9b232f', 'bold'); } // // // every 15th line of text, spam the room // // _new_line++; if( _new_line == 15 ){ _new_line = 0; cb.sendNotice( _chance_string, "" , "#FFDDFF", "#FF55FF", "bold", ""); } // // See if we need to turn the machine on or not // TurnOnMachine(); } cb.drawPanel(); }); function TurnOnMachine(){ if( _triggerBeingUsed === 1 ){ // // The trigger has not been pulled yet. // if( _triggerHasBeenPulled === false ){ // // We got enough tips to start the machine. // if(tipJar >= _triggerAmount){ cb.sendNotice( _startMsg, cb.room_slug, "#00FF00", "", "bold", ""); cb.sendNotice( "The goal has been reached. \nMax speed until the timer runs out. \nKeep it going.", "" , "#00FF00", "", "bold", ""); _triggerHasBeenPulled = true; isItGoing = 1; } else{ cb.sendNotice( "Max speed for " + (_triggerAmount / 60) + " minutes will begin with " + (_triggerAmount - tipJar) + " more tokens.", '', '', '#9b232f', 'bold'); isItGoing = 0; } } } else{ isItGoing = 1; } } /** * * If user-credits are being used, * and if the user qualifies, * then add the credits to the user's tip. * */ function ApplyCredit( name ){ for( var x = 0; x < userObjsArray.length; x++ ){ if( userObjsArray[x].username === name ) { var oldTime = userObjsArray[x].entered; var newTime = new Date().getTime(); var minutes = (newTime - oldTime)/60000; if ((minutes >= parseInt(cb.settings.min_time_required) ) && ( userObjsArray[x].credit > 0)){ // apply the credit to the tip jar tipJar += userObjsArray[x].credit; TurnOnMachine(); // send announcement to the room if (userObjsArray[x].hasTokens == 1 ){ cb.sendNotice( name.toUpperCase() + "'s " + ( (parseInt(cb.settings.credit_amount)==1) ? ':100tkste3' : ':200tkste3') + " credit was applied to the tip. :celebration-eluv", '', '', '#9b23aa', 'bold'); } else{ cb.sendNotice( name.toUpperCase() + "'s time credit was added to the machine. :celebration-eluv", '', '', '#9b23aa', 'bold'); } // start the user over userObjsArray[x].entered = newTime; // send message to user if (userObjsArray[x].hasTokens == 1 ){ cb.sendNotice( name.toUpperCase() + ", thank you for sticking with me. As a sign of my appreciation, here is another " + ( (parseInt(cb.settings.credit_amount)==1) ? '100' : '200') + " token credit which you can use in another " + parseInt(cb.settings.min_time_required) + " minutes.", name, '', '#006312', 'bold'); } else{ cb.sendNotice( name.toUpperCase() + ", thank you for sticking with me. As a sign of my appreciation, here is another 30 second time credit which you can use in another " + parseInt(cb.settings.min_time_required) + " minutes.", name, '', '#006312', 'bold'); } } } } } /** * * Upon entering the room, we see if the user has already * been in the room during this session. If he has not, he * is added to the list of visitors. If he has been, his * timestamp is updated. * * The user is presented with the 'token credits' message * if that option was configured upon app start up. * */ cb.onEnter(function (user) { cb.sendNotice( welcomeMessage, user.user, '', '#9b23ff', 'bold'); var enteredTime = new Date().getTime(); // the number of millisends since midnight Jan. 1, 1970 // // Brand new user // if( UserExists(user.user) === 0 ){ var tokensToGive = 0; if ( user.has_tokens ){ tokensToGive = (parseInt(cb.settings.credit_amount)==1) ? 100 : 200; } else{ tokensToGive = 30; } var userObj = {username:user.user, entered:enteredTime, credit: tokensToGive, hasTokens: user.has_tokens ? 1 : 0}; userObjsArray.push(userObj); if( parseInt(cb.settings.give_credit) > 0){ // // if the user has tokens // if( user.has_tokens ){ cb.sendNotice( creditMessage, user.user, '', '#9b23aa', 'bold'); } // // the user is a "gray" // else{ if( parseInt(cb.settings.give_grays_credit) == 1 ){ cb.sendNotice( grayCreditMessage, user.user, '', '#9b23aa', 'bold'); } } } } // // Not a brand new user. Update the time the user entered the room the second time. // else{ UpdateUserTimestamp( user.user, enteredTime ); } }); /** * * Looks to see if a user already exists in the userObjsArray * */ function UserExists( name ) { var retVal = 0; for( var x = 0; x < userObjsArray.length; x++ ){ // the person already exists in the array if( userObjsArray[x].username === name ) { retVal = 1; break; } } //cb.sendNotice("userObjsArray size is " + userObjsArray.length + ""); return retVal; } /** * * * */ function UpdateUserTimestamp( name, enteredTime ) { if( parseInt(cb.settings.give_credit) > 0){ for( var x = 0; x < userObjsArray.length; x++ ){ if( userObjsArray[x].username === name ) { userObjsArray[x].entered = enteredTime; if( userObjsArray[x].credit > 0){ cb.sendNotice( creditMessage, name, '', '#9b23aa', 'bold'); } } } } } /** * * * */ function ActivateBonus(msg) { var str = ''; var arr = []; _time_multiplier = 2; msg['X-Spam'] = true; str = msg.m; arr = str.split('='); arr[1] = arr[1].replace(/\D/g, ''); _bonusSecsRemaining += (parseInt(arr[1])); isBonusGoing = 1; _operate_string = "Your tips activate the fuck-machine... " + _time_multiplier + " seconds per token"; cb.sendNotice(_bonusMessage, '', '', '#9b232f', 'bold'); cb.drawPanel(); } /** * * * */ function SetTimerManually(msg){ var str = ''; var arr = []; msg['X-Spam'] = true; str = msg.m; arr = str.split('='); arr[1] = arr[1].replace(/\D/g,''); tipJar += (parseInt(arr[1]) * 60); TurnOnMachine(); cb.drawPanel(); } /** * * * */ function SetGoalManually(msg){ var str = ''; var arr = []; msg['X-Spam'] = true; str = msg.m; arr = str.split('='); arr[1] = arr[1].replace(/\D/g,''); _triggerAmount = parseInt(arr[1]); } /** * * When the trigger to PAUSE the machine is pulled... * */ function PauseMachine(){ isItPaused = 1; cb.sendNotice( "The machine is PAUSED. Tips will be added onto the queue.", "" , "#FF0000", "#FFFFFF", "bold", ""); roomName = "PAUSED - TIPS WILL BE ADDED TO THE QUEUE"; cb.drawPanel(); } /** * * Don't extend the time anymore * */ function NoMoreTips(){ cb.sendNotice( "The machine will run until the timer runs down to zero. Tips will NOT extend the time.", "" , "#FF0000", "#FFFFFF", "bold", ""); _timeCanBeAdded = false; roomName = "TIPS WILL NO LONGER ADD TIME"; _msg4users = ""; cb.drawPanel(); } /** * * Accept more tips to extend the time * */ function AcceptMoreTips(){ cb.sendNotice( "Tips can once again extend the time the machine runs.", "" , "#00AA00", "#FFFFFF", "bold", ""); _timeCanBeAdded = true; roomName = cb.settings.room_name; _msg4users = "" + _time_multiplier + " second per token"; cb.drawPanel(); } /** * * When the trigger to RESUME the machine is pulled... * */ function ResumeMachine(){ isItPaused = 0; cb.sendNotice( "THE MACHINE HAS RESUMED", "" , "#00FF00", "", "bold", ""); if(_timeCanBeAdded == true){ roomName = cb.settings.room_name; }else{ roomName = "TIPS WILL NO LONGER ADD TIME"; } cb.drawPanel(); } /** * * RESETS the app when time runs out... * */ function resetApp() { tipJar = 0; isItGoing = 0; cb.sendNotice( _stopMsg, cb.room_slug, "#FF0000", "#FFFFFF", "bold", ""); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.