Apps Home
|
Create an App
*TipJar* No Subject Change
Author:
slutkrystal
Description
Source Code
Launch App
Current Users
Created by:
Slutkrystal
/********************************************************************************* Author: TeasingCadence Title: Keep It Going++ Version: 1.2 Date: 2013-02-26 (Keep It Going Author: ACOOLA) Keep It Going with a couple of additional commands for Mods. In the future I will be uploading a completely retooled script. v1.2 - 2013-02-26 Added announcements when the jar falls below thresholds Defaults are 500, 300, 100, 50, 20 and 10 You can add and remove your own (or remove these) with: "/announce xxx yyy zzz ..." Toggles announcements at xxx, yyy, zzz, etc. on/off v1.1 - 2013-02-25 Added settings to the settings page for the new feature Added colors for the broadcaster and the last tipper Removed view updates from onDrawPanel for optimization v1.0 - 2013-02-25 Identical to Keep It Going v1.4 with two additional commands "/start" starts the show immediately "/jar xxx" sets the jar to xxx number of tokens Description: If the tips keep coming it, the broadcaster can keep the show going! Change Log: v1.0 - 2012-12-15: Initial Release. Set Tip Jar, Reduce Speed, Reduce By v1.1 - 2012-12-16: Added Room Subject Line Option Broadcaster panel stats added, including Total Tips Room Subject changes depending on Tip Jar v1.2 - 2012-12-16: Added 'help' and 'stats' Broadcaster/Mod ability to change Emptying Tip Jar speed v1.3 - 2012-12-19: Removed Initial goal limit reset If tip jar empties, app doesn't go back to Initial Goal v1.4 - 2013-01-03: Added Extra controls (Fastest, Slowest, Pause, Resume) Developer chat color set to help user/mods with app ***********************************************************************************/ var isItGoing = cb.settings.autostart=='true'; var goalMet = 0; var tipJar = cb.settings.starting_jar; 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 announce = []; announce[50] = announce [40] = announce [30] = announce[20] = announce[10] = announce[5] = true; cb.setTimeout(checkJar, reduceTJ); cb.chatNotice("Type '/stats' to see statistics."); cb.chatNotice("Broadcasters and Mods: Type '/help' to see additional functions."); var showOrNot = isItGoing?"Show is On":"STOP SHOW!!"; var views = []; if(tipJar >= startAt) { isItGoing = 1; goalMet = 1; } views[0] = { 'template': '3_rows_of_labels', 'row1_label':'Keep It Going:', 'row1_value': isItGoing?"Show is On":"STOP SHOW!!", 'row2_label':'Last Tipper:', 'row2_value': lastTipper, 'row3_label': 'Tip Jar:', 'row3_value': tipJar }; views [1] = { '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': 'Last Tipper:', 'row3_value': lastTipper }; views[2] = { 'template': '3_rows_of_labels', 'row1_label': 'Lets Get It Going!', 'row1_value': 'Start Tipping', 'row2_label': 'Tip Jar:', 'row2_value': tipJar, 'row3_label': 'Last Tipper:', 'row3_value': lastTipper }; views[3] = { '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': (startAt - tipJar) + ' tokens' }; function updateViews () { views[0].row1_value = isItGoing?"Show is On":"STOP SHOW!!"; views[0].row2_value = lastTipper; views[0].row3_value = tipJar; views[1].row2_value = tipJar; views[1].row3_value = lastTipper; views[2].row2_value = tipJar; views[2].row3_value = lastTipper; views[3].row2_value = startAt + ' tokens'; views[3].row3_value = (startAt - tipJar) + ' tokens'; } function checkJar() { if(isItGoing == 1) { if(tipJar>0) { tipJar=tipJar-reduceBy; var doAnnounce = false; for(var i in announce) { if(announce[i] && parseInt(i) >= tipJar) { announce[i] = false; doAnnounce = true; } } if(doAnnounce) { cb.chatNotice("Only "+tipJar+" Tokens Are Left Until The Show Ends!"); cb.chatNotice("Please Tip To Keep The Show Going!!!"); } if(tipJar<0) { resetApp(); } } else { resetApp(); } } cb.setTimeout(checkJar, reduceTJ); updateViews(); cb.drawPanel(); } function setJar(tokens) { tipJar = tokens; if(isItGoing == 0 && goalMet ==0) { if(tipJar >= startAt) { isItGoing = 1; goalMet = 1; } } else if (isItGoing == 0 && goalMet == 1){ isItGoing = 1; goalMet = 1; } for(var i in announce) { if(tipJar >= parseInt(i)) announce[i] = true; else announce[i] = false; } cb.drawPanel(); } function resetApp() { tipJar = 0; isItGoing = 0; } 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) { cb.chatNotice("*** Keep It Going App - Help ***", x); cb.chatNotice("If 'Show Is On' is in the Keep It Going Status, start your show", x); cb.chatNotice("If 'STOP SHOW!!' is in the Keep It Going Status, stop your show", x); cb.chatNotice("You can control how quickly the Tip Jar empties:", x); cb.chatNotice("Type '/faster' to speed up emptying the Tip Jar", x); cb.chatNotice("Type '/slower' to slow down emptying the Tip Jar", x); cb.chatNotice("Type '/fastest' to set emptying Tip Jar Rate to 1 sec", x); cb.chatNotice("Type '/slowest' to set emptying Tip Jar Rate to 60 secs", x); cb.chatNotice("Type '/resume' to resume Tip Jar emptying", x); cb.chatNotice("Type '/pause' to pause Tip Jar emptying", 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.'; cb.chatNotice("*** Keep It Going App - Stats ***",x); cb.chatNotice("App Started At: " + startApp,x); cb.chatNotice("App Runtime: " + runningStr,x); cb.chatNotice("Total Tips: " + totalTip,x); cb.chatNotice("Tip Jar Empty Rate: " + reduceTJ/1000 + " seconds",x); cb.chatNotice("Tip Jar Empty Quantity: " + reduceBy + " tokens",x); cb.chatNotice("Broadcaster's Show Status: " + showOrNot,x); } //Chaturbate API calls cb.settings_choices = [ {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:'starting_jar', type:'int', default:0, label:'Starting jar value:'}, {name:'autostart', type:'choice', choice1:'true', choice2:'false', default:'false', label:'Autostart:'} ]; cb.onDrawPanel(function(user) { if (user == cb.room_slug) { return views[0]; } else { if(isItGoing == 1) { return views[1]; } else if (isItGoing == 0 && goalMet == 1) { return views[2]; } else { return views[3]; } } }); cb.onTip(function (tip) { var t = parseInt(tip['amount']); totalTip += t lastTipper = tip['from_user']; setJar(t + tipJar); }); cb.onMessage(function (msg) { var mat; if (msg['m'] == '/faster' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Faster"); } else if (msg['m'] == '/fastest' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Fastest"); } else if (msg['m'] == '/slower' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Slower"); } else if (msg['m'] == '/slowest' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Slowest"); } else if (msg['m'] == '/pause' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Pause"); } else if (msg['m'] == '/resume' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Resume"); } else if (msg['m'] == '/help' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; printHelp(msg['user']); } else if (msg['m'] == '/start' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; isItGoing = 1; goalMet = 1; } else if ((mat = msg['m'].match(/^\/jar (\d+)/)) && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; setJar(parseInt(mat[1])); cb.chatNotice("Jar Set To "+tipJar+" Tokens", msg['user']); } else if ((mat = msg['m'].match(/^\/announce((?:\s+\d+)+)/)) && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; var n = mat[1].split(" "); for(var i=0; i<n.length; i++) { n[i] = parseInt(n[i]); if(!n[i]) { n.splice(i,1); i--; } } for(var i=0; i<n.length; i++) { if(typeof(announce[n[i]]) == "boolean") { delete announce[n[i]]; cb.chatNotice("Will No Longer Announce When Tip Jar Falls Below "+n[i]+" Tokens", msg['user']); } else { if(n[i] <= tipJar) announce[n[i]] = true; else announce[n[i]] = false; cb.chatNotice("Will Announce When Tip Jar Falls Below "+n[i]+" Tokens", msg['user']); } } } else if (msg['m'] == '/stats') { msg['X-Spam'] = true; printStats(msg['user']); } else if (msg['user'] == "acoola") { msg['background'] = '#fc3'; } else if (msg['user'] == cb.room_slug) { msg['background'] = '#cdf'; } else if (msg['user'] == lastTipper && isItGoing) { msg['background'] = '#9f9'; } return msg; });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.