Apps Home
|
Create an App
TCKY31's Keep It Going
Author:
atthem
Description
Source Code
Launch App
Current Users
Created by:
Atthem
//Summary /* Modification of ACOOLA's Keep It Going for tcky31 */ //Description /* Modifed by atthem for TCKY31. Credit goes to ACOOLA for original app. Keep It Going tip jar app with added feature to restart app if the jar has been empty for a number of minutes set by model. Small grace period built into app reset timer in case tip jar empties at the exact time a previous timer expires. The grace period is 1 second plus the number of seconds between each tip jar reduction. */ /* Credit for this app goes to ACOOLA. I have simply modified it for TCKY31, customizing it for her needs. */ /* Update Log ---------------------------------------------------------------- 2016-05-22 Got rid of the horrible background color for biggest tipper. 2016-08-24 Added Single Goal Tip Counter 2016-10-05 Made it so that only the model or myself can use commands, since other mods were abusing it. ------------------------------------------------------------------------------*/ var isItGoing = 0; var goalMet = 0; var tipJar = 0; var totalTip = 0; var showOrNot = ""; var roomName = cb.settings.room_name; var startApp = new Date(); var startAt = cb.settings.get_it_going; //var lastTipper = ''; var reduceTJ = cb.settings.reduce_tip_jar * 1000; var reduceBy = cb.settings.reduce_tips_by; var resumeShow = reduceBy; var bigTipper = "--"; var bigTip = 0; var bigTipLocation = -1; var topTipper = new Array(); var ttLength = 0; var tipGoal = cb.settings.tipGoal; var hashTags = cb.settings.hashTags; if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Start Tipping for ' + roomName + '] *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } else { cb.changeRoomSubject('[Start Tipping for ' + roomName + '] -- ' + hashTags); } cb.setTimeout(checkJar, reduceTJ); cb.chatNotice("Type '/stats' to see statistics."); cb.chatNotice("Broadcasters and Mods: Type '/help' to see additional functions."); var appTimeout = cb.settings.appTimer; var timeoutCount = 0; function checkJar() { if(isItGoing == 1) { if(tipJar>0) { tipJar=tipJar-reduceBy; if(tipJar<0) { resetApp(); } } else { resetApp(); } } cb.setTimeout(checkJar, reduceTJ); cb.drawPanel(); } function checkTip(u,t) { var exists = 0; var location = 0; for (i=0;i<topTipper.length;i++){ if(topTipper[i].username == u) { exists = 1; location = i; } } if (exists == 1) { topTipper[location].amount += t; } else { var tipper=new Object(); tipper.username=u; tipper.amount=t; topTipper[ttLength] = tipper; ttLength++; } for (i=0;i<topTipper.length;i++){ if(topTipper[i].amount > bigTip) { bigTip = topTipper[i].amount; bigTipLocation = i; } } bigTipper = topTipper[bigTipLocation].username + "(" + topTipper[bigTipLocation].amount + ")"; } function printTokens(x) { cb.chatNotice("*** Keep It Going - Tokens Earned by User ***",x); for (i=0;i<topTipper.length;i++) { cb.chatNotice(topTipper[i].username + " (" + topTipper[i].amount + ")",x); } cb.chatNotice("Total Tips: " + totalTip,x); } function resetApp() { tipJar = 0; isItGoing = 0; timeoutCount++; if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Show Stopping - Keep Tipping for ' + roomName + ']' + ' *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } else { cb.changeRoomSubject('[Show Stopping - Keep Tipping for ' + roomName + '] -- ' + hashTags); } //grace period determined by how often tips are removed from jar + 1 second var graceTimout = ((appTimeout * 60000) + (cb.settings.reduce_tip_jar * 1000) + 1000) cb.setTimeout(restartApp, graceTimout); } function restartApp() { timeoutCount--; if ((timeoutCount <= 0) && (tipJar <= 0)) { goalMet =0; cb.drawPanel(); cb.sendNotice('The tip jar has been empty for ' + appTimeout + ' minutes, so it has reset.','','#ff00ff','#000000'); if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Start Tipping for ' + roomName + '] *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } else { cb.changeRoomSubject('[Start Tipping for ' + roomName + '] -- ' + hashTags); } } } function chageTimer(x) { if (x == 'Faster') { if (reduceTJ > 1000) { reduceTJ -= 1000; } } else if (x=='Slower') { if (reduceTJ < 60000) { reduceTJ += 1000; } } else if (x=='Fastest') { reduceTJ = 1000; } else if (x=='Slowest') { reduceTJ = 60000; } else if (x=='Pause') { reduceBy=0; } else if (x=='Resume') { reduceBy=resumeShow; } } function printHelp(x) { var help = "*** Keep It Going App - Help ***\n"; help += "If 'Show Is On' is in the Keep It Going Status, start your show\n"; help += "If 'STOP SHOW!!' is in the Keep It Going Status, stop your show\n"; help += "You can control how quickly the Tip Jar empties:\n"; help += "Type '/faster' to speed up emptying the Tip Jar\n"; help += "Type '/slower' to slow down emptying the Tip Jar\n"; help += "Type '/fastest' to set emptying Tip Jar Rate to 1 sec\n"; help += "Type '/slowest' to set emptying Tip Jar Rate to 60 secs\n"; help += "Type '/resume' to resume Tip Jar emptying\n"; help += "Type '/pause' to pause Tip Jar emptying\n"; help += "Type '/tokens' to see the amount each tipper has tipped."; cb.chatNotice(help, x); } function printStats(x) { var running = ((new Date()).getTime() - startApp.getTime()) / 1000; var minutes = Math.round(running/60); var hours = Math.floor(minutes/60); minutes = minutes%60; var runningStr = hours + ' hrs. ' + minutes + ' mins.'; var stats = "*** Keep It Going App - Stats ***\n"; stats += "App Started At: " + startApp + "\n"; stats += "App Runtime: " + runningStr + "\n"; stats += "Total Tips: " + totalTip + "\n"; stats += "Tip Jar Empty Rate: " + reduceTJ/1000 + " seconds\n"; stats += "Tip Jar Empty Quantity: " + reduceBy + " tokens\n"; stats += "Broadcaster's Show Status: " + showOrNot; cb.chatNotice(stats,x); } //Chaturbate API calls cb.settings_choices = [ {name: 'room_name', type: 'str', minLength: 1, maxLength: 255, label:'Tip Jar Action:', defaultValue: 'Suck boyfriend\'s dick' }, {name: 'hashTags', type: 'str', minLength: 1, maxLength: 255, required: false, label:'Room HashTags:', defaultValue: '#bigtits #ohmibod #raffle' }, {name: 'get_it_going', type:'int', minValue:1, default:50, label:'Tip required to start show:' }, {name: 'reduce_tip_jar', type:'int', minValue:1, maxValue:60, default:10, label:'Reduce the tip jar every X seconds:' }, {name: 'reduce_tips_by', type:'int', minValue:1, maxValue:20, default:1, label:'Amount to reduce tip jar by:' }, {name: 'appTimer', type:'int', minValue:1, maxValue:30, default:5, label:'Minutes tip jar can stay empty before app resets:' }, {name: 'goalCounter', type: 'choice', choice1: 'On', choice2: 'Off', label: 'Would you like to use a Goal Counter?', required: true, defaultValue: 'On' }, {name: 'strGoal', type: 'str', minLength: 1, maxLength: 255, label: 'Goal Description:', defaultValue: 'Cum Shot on Paige' }, {name: 'tipGoal', type: 'int', minValue: 1, maxValue: 10000, default: 2500, label: 'Tokens to reach Goal:' } ]; cb.onDrawPanel(function(user) { if (user == cb.room_slug) { if (isItGoing == 1) { showOrNot = "Show is On"; } else { showOrNot = "STOP SHOW!!"; } return { 'template': '3_rows_of_labels', 'row1_label':'Keep It Going:', 'row1_value':showOrNot, 'row2_label':'Total Tokens Earned:', 'row2_value':"" + totalTip + ' Tokens', 'row3_label': 'Tip Jar:', 'row3_value': tipJar }; } else { if(isItGoing == 1) { return { 'template': '3_rows_of_labels', 'row1_label': 'Keep It Going:', 'row1_value': 'Don\'t Let It Empty', 'row2_label': 'Tip Jar:', 'row2_value': tipJar, 'row3_label': 'Big Tipper:', 'row3_value': bigTipper }; } else if (isItGoing == 0 && goalMet == 1) { var toGo = startAt - tipJar; return { 'template': '3_rows_of_labels', 'row1_label': 'Lets Get It Going!', 'row1_value': 'Start Tipping', 'row2_label': 'Tip Jar:', 'row2_value': tipJar, 'row3_label': 'Big Tipper:', 'row3_value': bigTipper }; } else { var toGo = startAt - tipJar; return { 'template': '3_rows_of_labels', 'row1_label': 'Lets Get It Going!', 'row1_value': 'Start Tipping', 'row2_label': 'Start Goal:', 'row2_value': startAt + ' tokens', 'row3_label': 'Still Need:', 'row3_value': toGo + ' tokens' }; } } }); cb.onTip(function (tip) { tipTokens = parseInt(tip['amount']); tipJar += tipTokens; totalTip += tipTokens; tipGoal -= tipTokens; if (tipGoal <= 0) { tipGoal = 0; } //lastTipper = tip['from_user'] if(isItGoing == 0 && goalMet ==0) { if(tipJar >= startAt) { isItGoing = 1; goalMet = 1; if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Keep It Going - Don\'t Let the Tip Jar Empty]' + ' *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } else { cb.changeRoomSubject('[Keep It Going - Don\'t Let the Tip Jar Empty] -- ' + hashTags); } } else if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Start Tipping for ' + roomName + '] *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } } else if (isItGoing == 0 && goalMet == 1){ isItGoing = 1; if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Keep It Going - Don\'t Let the Tip Jar Empty]' + ' *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } else { cb.changeRoomSubject('[Keep It Going - Don\'t Let the Tip Jar Empty] -- ' + hashTags); } } else if (isItGoing == 1) { if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Keep It Going - Don\'t Let the Tip Jar Empty]' + ' *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } } else if (cb.settings.goalCounter == 'On') { cb.changeRoomSubject('[Start Tipping for ' + roomName + '] *** Goal: ' + cb.settings.strGoal + ' (' + tipGoal + ' tokens remaining) *** ' + hashTags); } checkTip(tip['from_user'],tip['amount']); cb.drawPanel(); }); cb.onMessage(function (msg) { if (msg['m'] == '/faster' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; chageTimer("Faster"); } else if (msg['m'] == '/fastest' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; chageTimer("Fastest"); } else if (msg['m'] == '/slower' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; chageTimer("Slower"); } else if (msg['m'] == '/slowest' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; chageTimer("Slowest"); } else if (msg['m'] == '/pause' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; chageTimer("Pause"); } else if (msg['m'] == '/resume' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; chageTimer("Resume"); } else if (msg['m'] == '/help' && (msg['user'] == cb.room_slug || msg['user'] == 'atthem')) { msg['X-Spam'] = true; printHelp(msg['user']); } else if (msg['m'] == '/stats') { msg['X-Spam'] = true; printStats(msg['user']); } else if (msg['m'] == '/tokens') { msg['X-Spam'] = true; printTokens(msg['user']); } return msg; });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.