Apps Home
|
Create an App
<SeXyPoRnY-ApP>
Author:
sexypornycp
Description
Source Code
Launch App
Current Users
Created by:
Sexypornycp
/** Name: Ultra App Author: britney_and_justin Creation Date: 3/21/14 Date Last Edited: 3/29/14 Live Verson: Beta Test Version: Beta **/ /** Credit Due: System ==> Original Author CrazyTicket ==> acrazyguy Auto-Reset Tip Goal ==> biron Tip Multi-Goal ==> mx2k6 Keep it Going ==> acoola Sequence Tips ==> Cliche123 & Nolidoux Wheel of Fortune ==> sweetdann **/ //user settings { cb.settings_choices = [ {name: 'showTimerToggle', label: 'Would you like to set a timer for the show to end?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'showTimerDuration', label: 'Enter your desired show duration in minutes', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 60}, {name: 'showTokenTargetToggle', label: 'Would you like to set a token target for the show?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'showTokenTarget', label: 'Enter your desired show token target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 2000}, {name: 'hiddenShowToggle', label: 'Would you like the show to become a hidden camera show if the token target is not when the time runs out?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'hiddenShowTokenPrice', label: 'Enter your desired ticket price', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 25}, {name: 'hiddenShowToggle', label: 'Would you like users who have tipped above your ticket price to be granted tickets if the show goes hidden??', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'hiddenShowMods', label: 'Would you like to give free tickets to your mods?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'hiddenShowFans', label: 'Would you like to give free tickets to your fan club members?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'appSubjectControl', label: 'Would you like the app to control the room subject?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'roomSubject', label: 'If not, what would you like to set as the room subject', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'flashPriceToggle', label: 'Would you like to set a price for flashes/requests?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'flashPrice', label: 'Set your price for flashes/requests', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 25}, {name: 'goalSystem', label: 'Choose the goal system you would like to use', type: 'choice', choice1: 'Auto-Reset Tip Goal', choice2: 'Tip Multi-Goal', choice3: 'Keep It Going', choice4: 'Sequence Tips', defaultValue: 'Auto-Reset Tip Goal'}, {name: 'artgHeader', label: '======Auto-Rest Tip Goal Settings======', type: 'choice', choice1: '', defaultValue: '', required: false}, {name: 'artgGoalTarget', label: 'Tip Goal Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'artgGoalTitle', label: 'Tip Goal Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'CUM EVERYWHERE!'}, {name: 'artgSpecialTargetToggle', label: 'Do you want to have a special event at X goals?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'artgSpecialTarget', label: 'After how many goals reached would you like to have a special event?', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 10}, {name: 'artgSpecialEvent', label: 'X Goals special event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'CUM EXPLOSION!'}, {name: 'tmgHeader', label: '======Tip Multi-Goal Settings======', type: 'choice', choice1: '', defaultValue: '', required: false}, {name: 'tmgNumTargets', label: 'How many goals would you like to set?', type: 'int', minValue: 1, maxValue: 10, defaultValue: 10}, {name: 'tmgLoop', label: 'Would you like to switch to Auto-Reset Tip Goal after the final goal is reached? (Don\'t forget to configure Auto-Reset Tip Goal if you choose yes.)', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'tmgTargetTip1', label: 'Goal 1 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent1', label: 'Goal 1 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip2', label: 'Goal 2 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent2', label: 'Goal 2 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip3', label: 'Goal 3 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent3', label: 'Goal 3 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip4', label: 'Goal 4 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent4', label: 'Goal 4 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip5', label: 'Goal 5 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent5', label: 'Goal 5 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip6', label: 'Goal 6 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent6', label: 'Goal 6 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip7', label: 'Goal 7 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent7', label: 'Goal 7 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip8', label: 'Goal 8 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent8', label: 'Goal 8 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip9', label: 'Goal 9 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent9', label: 'Goal 9 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'tmgTargetTip10', label: 'Goal 10 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'tmgTargetEvent10', label: 'Goal 10 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'kigHeader', label: '======Keep It Going Settings======', type: 'choice', choice1: '', defaultValue: '', required: false}, {name: 'kigStartShow', label: 'At what tip amount should the show start?', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 100}, {name: 'kigReduceRate', label: 'How frequently, in seconds, should the jar be reduced?', type: 'int', minValue: 3, maxValue: 1000000, defaultValue: 5}, {name: 'kigReduceAmount', label: 'By how many tokens should the jar be reduced?', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 2}, {name: 'kigEvent', label: 'Enter the event that will be "kept going."', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stHeader', label: '======Sequence Tips Settings======', type: 'choice', choice1: '', defaultValue: '', required: false}, {name: 'stTarget', label: 'What would you like to set as the highest tip in your sequence?',type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 50}, {name: 'stOrder', label: 'Would you like your sequence to run in ascending order or in descending order?', type: 'choice', choice1: 'Ascending', choice2: 'Descending', defaultValue: 'Ascending'}, {name: 'stLargeTip', label: 'Would you like tips that are greater than the "Next Tip Needed" to count as being the "Next Tip Needed?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'stFinalGoal', label: 'Final Goal Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stMulti', label: 'Do you want to set mini goals when certain tips are reached?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'stMultiNumber', label: 'If yes, how many mini goals would you like to have?',type: 'int', minValue: 1, maxValue: 10, defaultValue: 3}, {name: 'stTargetTip1', label: 'Goal 1 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 10}, {name: 'stTargetEvent1', label: 'Goal 1 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip2', label: 'Goal 2 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 15}, {name: 'stTargetEvent2', label: 'Goal 2 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip3', label: 'Goal 3 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 20}, {name: 'stTargetEvent3', label: 'Goal 3 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip4', label: 'Goal 4 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 25}, {name: 'stTargetEvent4', label: 'Goal 4 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip5', label: 'Goal 5 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 30}, {name: 'stTargetEvent5', label: 'Goal 5 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip6', label: 'Goal 6 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 35}, {name: 'stTargetEvent6', label: 'Goal 6 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip7', label: 'Goal 7 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 40}, {name: 'stTargetEvent7', label: 'Goal 7 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip8', label: 'Goal 8 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 45}, {name: 'stTargetEvent8', label: 'Goal 8 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip9', label: 'Goal 9 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 50}, {name: 'stTargetEvent9', label: 'Goal 9 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '}, {name: 'stTargetTip10', label: 'Goal 10 Token Target', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 55}, {name: 'stTargetEvent10', label: 'Goal 10 Event', type: 'str', minLength: 1, maxLength: 1000, defaultValue: ' '} ] } //variables { //variable ==> purpose { } //panel variables { var row1Left = ''; var row2Left = ''; var row3Left = ''; var row1Right = ''; var row2Right = ''; var row3Right = ''; } var purple = '#B369B3'; var tipperArray = new Array; var numTippers = 0; var hiddenArray = new Array; var numHidden = 0; var tipTotal = 0; var initialize = 0; var startTime = 0; var timerDuration = 0; var timeAdded = 0; var tipJar = 0; var showStarted = 0; var oldSubject = ' '; var nextTip; if(cb.settings.stOrder == 'Ascending') { nextTip = 1; } else { nextTip = cb.settings.stTarget; } } //functions { /** Function ==> Purpose setPanel ==> draws the information above and below the feed **/ function tipperArrayPopulate(user) { tipperArray[numTippers] = new Array; tipperArray[numTippers][0] = user; tipperArray[numTippers][1] = 0; numTippers++; } function findTipper(user) { //find the index of the user for(var i = 0; i < tipperArray.length; i++) { if(tipperArray[i][0] == user) { break; } } //the user is not in the array. add him and call findTipper if(i == tipperArray.length) { tipperArrayPopulate(user); findTipper(user); } return i; } function hiddenArrayPopulate(user) { hiddenArray[numHidden] = user; numHidden++; } function setPanel(tip) { var subject = ''; if(tip == null) { tip = 0; } switch(cb.settings.goalSystem) { case 'Auto-Reset Tip Goal': { if(cb.settings.appSubjectControl == 'Yes') { if(cb.settings.flashPriceToggle == 'Yes') { subject += cb.settings.flashPrice + ' for flash/request, '; } subject += cb.settings.artgGoalTitle + ' at goal'; if(cb.settings.artgSpecialTargetToggle == 'Yes') { subject += ', ' + cb.settings.artgSpecialEvent + ' @ ' + cb.settings.artgSpecialTarget + ' goals!'; } if(subject != oldSubject) { cb.changeRoomSubject(subject); oldSubject = subject; } } //row 1 var toGoal = tipTotal; var goalsHit = Math.floor(tipTotal/cb.settings.artgGoalTarget); while(toGoal >= cb.settings.artgGoalTarget) { toGoal = toGoal - cb.settings.artgGoalTarget; } row1Left = toGoal + ' / ' + cb.settings.artgGoalTarget; row1Right = 'Goals Hit: ' + goalsHit; //row 2 if(cb.settings.flashPriceToggle == 'Yes') { row2Left = 'Flash/Request: '; row2Right = cb.settings.flashPrice + ' tokens'; } //row 3 if(cb.settings.artgSpecialTargetToggle == 'Yes') { row3Left = '@' + cb.settings.artgSpecialTarget + ' goals: '; row3Right = cb.settings.artgSpecialEvent; } break; } case 'Tip Multi-Goal': { var goalTotal = 0; var currentGoal = 0; var progress = 0; var goalArray = new Array; //build goalArray { goalArray[0] = cb.settings.tmgTargetTip1; goalArray[1] = cb.settings.tmgTargetTip2; goalArray[2] = cb.settings.tmgTargetTip3; goalArray[3] = cb.settings.tmgTargetTip4; goalArray[4] = cb.settings.tmgTargetTip5; goalArray[5] = cb.settings.tmgTargetTip6; goalArray[6] = cb.settings.tmgTargetTip7; goalArray[7] = cb.settings.tmgTargetTip8; goalArray[8] = cb.settings.tmgTargetTip9; goalArray[9] = cb.settings.tmgTargetTip10; } //subject setting if(cb.settings.appSubjectControl == 'Yes') { if(cb.settings.flashPriceToggle == 'Yes') { subject += cb.settings.flashPrice + ' for flash/request, '; } goalTotal += cb.settings.tmgTargetTip1; if(tipTotal < goalTotal) { subject += cb.settings.tmgTargetEvent1 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip2; if(cb.settings.tmgNumTargets > 1 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent2 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip3; if(cb.settings.tmgNumTargets > 2 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent3 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip4; if(cb.settings.tmgNumTargets > 3 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent4 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip5; if(cb.settings.tmgNumTargets > 4 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent5 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip6; if(cb.settings.tmgNumTargets > 5 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent6 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip7; if(cb.settings.tmgNumTargets > 6 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent7 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip8; if(cb.settings.tmgNumTargets > 7 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent8 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip9; if(cb.settings.tmgNumTargets > 8 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent9 + ' @ ' + goalTotal; } goalTotal += cb.settings.tmgTargetTip10; if(cb.settings.tmgNumTargets > 9 && tipTotal < goalTotal) { subject += ' ' + cb.settings.tmgTargetEvent10 + ' @ ' + goalTotal; } if(subject != oldSubject) { cb.changeRoomSubject(subject); oldSubject = subject; } } goalTotal = 0; i = 0; while(tipTotal > goalTotal) { if(goalTotal + goalArray[i] > tipTotal) { break; } else { goalTotal += goalArray[i]; i++ } } progress = tipTotal - goalTotal; if(i == cb.settings.tmgNumTargets && cb.settings.tmgLoop == 'Yes') { cb.settings.goalSystem = 'Auto-Reset Tip Goal'; setPanel(); break; } row1Left = progress + ' / ' + goalArray[i]; row1Right = i + ' / ' + cb.settings.tmgNumTargets + ' goals met'; if(cb.settings.flashPriceToggle == 'Yes') { row2Left = 'Flash/Request: '; row2Right = cb.settings.flashPrice + ' tokens'; } row3Left = 'Final Goal: '; switch(cb.settings.tmgNumTargets) { case 1: row3Right = cb.settings.tmgTargetEvent1; break; case 2: row3Right = cb.settings.tmgTargetEvent2; break; case 3: row3Right = cb.settings.tmgTargetEvent3; break; case 4: row3Right = cb.settings.tmgTargetEvent4; break; case 5: row3Right = cb.settings.tmgTargetEvent5; break; case 6: row3Right = cb.settings.tmgTargetEvent6; break; case 7: row3Right = cb.settings.tmgTargetEvent7; break; case 8: row3Right = cb.settings.tmgTargetEvent8; break; case 9: row3Right = cb.settings.tmgTargetEvent9; break; case 10: row3Right = cb.settings.tmgTargetEvent10; break; } break; } case 'Keep It Going': { //subject setting if(cb.settings.appSubjectControl == 'Yes') { if(cb.settings.flashPriceToggle == 'Yes') { subject += cb.settings.flashPrice + ' for flash/request, '; } subject += cb.settings.kigEvent + ' while the jar has tokens. ' + cb.settings.kigStartShow + ' tokens to start!'; if(subject != oldSubject) { cb.changeRoomSubject(subject); oldSubject = subject; } } tipJar += tip; if(tipJar >= cb.settings.kigStartShow) { showStarted = 1; } if(tipJar == 0) { row1Left = 'Get it going!'; row1Right = 'Start tipping!'; } else { row1Left = 'Tip Jar: '; row1Right = tipJar + ' tokens'; } row2Left = 'To Start: '; row2Right = cb.settings.kigStartShow + ' tokens'; row3Left = 'Goal: '; row3Right = cb.settings.kigEvent; break; } case 'Sequence Tips': { if(cb.settings.stLargeTip == 'Yes' && tip >= nextTip) { if(cb.settings.stOrder == 'Ascending') { nextTip++; } else { nextTip--; } } else if(tip == nextTip) { if(cb.settings.stOrder == 'Ascending') { nextTip++; } else { nextTip--; } } if(cb.settings.appSubjectControl == 'Yes') { if(cb.settings.flashPriceToggle == 'Yes') { subject += cb.settings.flashPrice + ' for flash/request, '; } if(cb.settings.stMulti == 'Yes') { if(nextTip < cb.settings.stTargetTip1) { subject += ' ' + cb.settings.stTargetEvent1 + ' @ ' + cb.settings.stTargetTip1; } if(cb.settings.stMultiNumber > 1 && nextTip < cb.settings.stTargetTip2) { subject += ' ' + cb.settings.stTargetEvent2 + ' @ ' + cb.settings.stTargetTip2; } if(cb.settings.stMultiNumber > 2 && nextTip < cb.settings.stTargetTip3) { subject += ' ' + cb.settings.stTargetEvent3 + ' @ ' + cb.settings.stTargetTip3; } if(cb.settings.stMultiNumber > 3 && nextTip < cb.settings.stTargetTip4) { subject += ' ' + cb.settings.stTargetEvent4 + ' @ ' + cb.settings.stTargetTip4; } if(cb.settings.stMultiNumber > 4 && nextTip < cb.settings.stTargetTip5) { subject += ' ' + cb.settings.stTargetEvent5 + ' @ ' + cb.settings.stTargetTip5; } if(cb.settings.stMultiNumber > 5 && nextTip < cb.settings.stTargetTip6) { subject += ' ' + cb.settings.stTargetEvent6 + ' @ ' + cb.settings.stTargetTip6; } if(cb.settings.stMultiNumber > 6 && nextTip < cb.settings.stTargetTip7) { subject += ' ' + cb.settings.stTargetEvent7 + ' @ ' + cb.settings.stTargetTip7; } if(cb.settings.stMultiNumber > 7 && nextTip < cb.settings.stTargetTip8) { subject += ' ' + cb.settings.stTargetEvent8 + ' @ ' + cb.settings.stTargetTip8; } if(cb.settings.stMultiNumber > 8 && nextTip < cb.settings.stTargetTip9) { subject += ' ' + cb.settings.stTargetEvent9 + ' @ ' + cb.settings.stTargetTip9; } if(cb.settings.stMultiNumber > 9 && nextTip < cb.settings.stTargetTip10) { subject += ' ' + cb.settings.stTargetEvent10 + ' @ ' + cb.settings.stTargetTip10; } } if(cb.settings.stOrder == 'Ascending') { subject += ' ' + cb.settings.stFinalGoal + ' @ ' + cb.settings.stTarget; if(nextTip > cb.settings.stTarget) { subject = 'Goal reached! Enjoy the show!'; } } else { subject += ' ' + cb.settings.stFinalGoal + ' @ 0'; if(nextTip == 0) { subject = 'Goal reached! Enjoy the show!'; } } if(subject != oldSubject) { cb.changeRoomSubject(subject); oldSubject = subject; } } if(subject == 'Goal reached! Enjoy the show!') { row1Left = 'Goal Reached!'; row1Right = 'Enjoy the show!'; } else { row1Left = 'Next Tip Needed: '; row1Right = nextTip; } if(cb.settings.flashPriceToggle == 'Yes') { row2Left = 'Flash/Request: '; row2Right = cb.settings.flashPrice + ' tokens'; } else { row2Left = cb.settings.stFinalGoal; row2Right = 'at goal!' } if(cb.settings.stOrder == 'Ascending') { row3Left = 'Ascending: ' row3Right = 'From 1 to ' + cb.settings.stTarget; } else { row3Left = 'Descending: ' row3Right = 'From ' + cb.settings.stTarget + ' to 0'; } break; } case 'Wheel of Fortune'://not implemented { break; } case 'Token Keno'://not implemented { break; } case 'Roll The Dice!'://not implemented { break; } } cb.drawPanel(); } function startTimer(t, mod) { //there is no timer already running if(startTime == 0 && timeAdded == 0) { //verify a valid option was sent with /starttimer if(t >= 0 && t.toString().indexOf('.') == -1) { timerDuration = t; //notice of timer start if(mod != null) { cb.sendNotice(mod + ' has set a timer for ' + timerDuration + ' minutes!','',purple); } //local variable to convert noticeTime (minutes) to milliseconds var millis = timerDuration * 60000; var fiveMinutes = millis - 300000; var oneMinute = millis - 60000; //actual timer cb.setTimeout(timer,millis); //five minutes remaining announcement if(fiveMinutes > 0) { cb.setTimeout(fiveMinuteWarning,fiveMinutes); } //one minute remaining announcement cb.setTimeout(oneMinuteWarning,oneMinute); //set the start time startTime = new Date(); } else if(t != null) { cb.sendNotice(t + ' is not a valid option for /starttimer.\nType /ubhelp starttimer to see how to use /starttimer.',mod,purple); } else if(t == null) { cb.sendNotice('You did not enter a valid option for /starttimer.\nType /ubhelp starttimer to see how to use /starttimer.',mod,purple); } } //there is a timer running and time has been added else if(startTime != 0 && timeAdded != 0 && mod == null) { timeAdded = 0; timerDuration = t; //local variable to convert noticeTime (minutes) to milliseconds var millis = timerDuration * 60000; var fiveMinutes = millis - 300000; var oneMinute = millis - 60000; //actual timer cb.setTimeout(timer,millis); //five minutes remaining announcement if(fiveMinutes > 0) { cb.setTimeout(fiveMinuteWarning,fiveMinutes); } //one minute remaining announcement cb.setTimeout(oneMinuteWarning,oneMinute); } //there is a timer running and someone tried to start a new timer else if(startTime != 0 && timeAdded == 0 || startTime != 0 && timeAdded != 0 && mod != null) { cb.sendNotice('There is a timer running already.',mod,purple); } } function timer() { //check to see if /addTime has been used if(timeAdded == 0) { cb.sendNotice('Time is up!','',purple); startTime = 0; timerDuration = 0; if(cb.settings.hiddenShowToggle == 'Yes' && tipTotal < cb.settings.showTokenTarget) { hideShow('timer'); } } else { if(timeAdded == 5) { cb.sendNotice('There are 5 minutes remaining!','',purple); } startTimer(timeAdded); } } function fiveMinuteWarning() { if(timeAdded == 0) { cb.sendNotice('There are 5 minutes remaining!','',purple); } } function oneMinuteWarning() { if(timeAdded == 0) { cb.sendNotice('There is 1 minute remaining!','',purple); } } function timeLeft(user) { if(startTime != 0) { //local variable for the current time var currentTime = new Date(); //local variable to hold the time left var timeLeft = startTime.getHours()*3600 + startTime.getMinutes()*60 + startTime.getSeconds() + timerDuration*60 - currentTime.getHours()*3600 - currentTime.getMinutes()*60 - currentTime.getSeconds(); //local variables for hours, minutes, and seconds remaining var hours = timeLeft/3600; hours = Math.floor(hours); var minutes = (timeLeft-hours*3600)/60; minutes = Math.floor(minutes); var seconds = timeLeft-hours*3600-minutes*60; //account for timeAdded minutes += timeAdded; //fix numbers after timeAdded if(hours < 0) { hours = 0; minutes = 0; } if(hours > 0) { if(hours > 9) { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds,user,purple); } } else { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds,user,purple); } } } else if(hours == 0 && minutes > 0) { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':0' + seconds,user,purple); } } else if(hours == 0 && minutes == 0 && seconds > 0) { if(seconds > 9) { cb.sendNotice('Time Remaining: 00:00' + ':' + seconds,user,purple); } else { cb.sendNotice('Time Remaining: 00:00' + ':0' + seconds,user,purple); } } else { cb.sendNotice('hours: ' + hours + '\nminutes: ' + minutes + '\nseconds: ' + seconds); } } else { cb.sendNotice('There is no timer running.',user,purple); } } function printTime() { user = ''; if(startTime != 0) { //local variable for the current time var currentTime = new Date(); //local variable to hold the time left var timeLeft = startTime.getHours()*3600 + startTime.getMinutes()*60 + startTime.getSeconds() + timerDuration*60 - currentTime.getHours()*3600 - currentTime.getMinutes()*60 - currentTime.getSeconds(); //local variables for hours, minutes, and seconds remaining var hours = timeLeft/3600; hours = Math.floor(hours); var minutes = (timeLeft-hours*3600)/60; minutes = Math.floor(minutes); var seconds = timeLeft-hours*3600-minutes*60; //account for timeAdded minutes += timeAdded; //fix numbers after timeAdded if(hours < 0) { hours = 0; minutes = 0; } if(hours > 0) { if(hours > 9) { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds,user,purple); } } else { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds,user,purple); } } } else if(hours == 0 && minutes > 0) { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':0' + seconds,user,purple); } } else if(hours == 0 && minutes == 0 && seconds > 0) { if(seconds > 9) { cb.sendNotice('Time Remaining: 00:00' + ':' + seconds,user,purple); } else { cb.sendNotice('Time Remaining: 00:00' + ':0' + seconds,user,purple); } } else { cb.sendNotice('hours: ' + hours + '\nminutes: ' + minutes + '\nseconds: ' + seconds); } } else { cb.sendNotice('There is no timer running.',user,purple); } } function addTime(t, mod) { if(t > 0 && t.toString().indexOf('.') == -1) { if(startTime != 0) { timeAdded = parseInt(t); //notice of timer start if(timeAdded == 1) { cb.sendNotice(mod + ' has has added 1 minute to the timer!','',purple); } else { cb.sendNotice(mod + ' has has added ' + timeAdded + ' minutes to the timer!','',purple); } } else { cb.sendNotice('There is no timer running.',mod,purple); } } else if(t != null) { cb.sendNotice(t + ' is not a valid option for /addtime.\nType /ubhelp addtime to see how to use /addtime.',mod,purple); } else if(t == null) { cb.sendNotice('You did not enter a valid option for /addtime.\nType /ubhelp addtime to see how to use /addtime.',mod,purple); } } function hideShow(trigger) { cb.limitCam_start('',hiddenArray); if(trigger == 'timer') { cb.sendNotice('Time is up and the goal was not reached!\nIf you have not tipped at least ' + cb.settings.hiddenShowTokenPrice + ' tokens, you may do so now to continue watching the show.','',purple); } toTicket(); } function toTicket() { var tipNeeded; for(var i = 0; i < tipperArray.length; i++) { tipNeeded = cb.settings.hiddenShowTokenPrice - tipperArray[i][1]; cb.sendNotice('You will be granted a ticket if you tip ' + tipNeeded + ' tokens.',tipperArray[i][0],purple); } } function notifierSpam() { cb.setTimeout(notifierSpamTimer,300000); } function notifierSpamTimer() { if(startTime != 0 && tipTotal < cb.settings.showTokenTarget) { cb.sendNotice('The show target is currently ' + tipTotal + ' / ' + cb.settings.showTokenTarget + '. If the target is not met when the timer runs out, the show will become hidden and only users who have tipped at least ' + cb.settings.hiddenShowTokenPrice + ' will be able to keep watching!\nType /showtimeleft to see how much time is remaining in the show!','',purple); notifierSpam(); } } function addUser(user, mod) { if(user != null) { hiddenArrayPopulate(user); cb.limitCam_addUsers(hiddenArray); cb.sendNotice(mod + ' has given you a ticket to the show!',user,purple); cb.sendNotice('You have given a ticket to ' + user,mod,purple); } else { cb.sendNotice('You did not enter a username.',mod,purple); } } function changeGoal(option, user) { var valid = 0; switch(option) { case '1': { valid = 1; if(cb.settings.goalSystem != 'Auto-Reset Tip Goal') { cb.settings.goalSystem = 'Auto-Reset Tip Goal'; setPanel(); cb.sendNotice('You have changed the goal system to Auto-Reset Tip Goal. Have fun!',user,purple); } else { cb.sendNotice('The goal system is already set to Auto-Reset Tip Goal. Enter /changegoal to see the available options.',user,purple); } break; } case '2': { valid = 1; if(cb.settings.goalSystem != 'Tip Multi-Goal') { cb.settings.goalSystem = 'Tip Multi-Goal'; setPanel(); cb.sendNotice('You have changed the goal system to Tip Multi-Goal. Have fun!',user,purple); } else { cb.sendNotice('The goal system is already set to Tip Multi-Goal. Enter /changegoal to see the available options.',user,purple); } break; } case '3': { valid = 1; if(cb.settings.goalSystem != 'Keep It Going') { cb.settings.goalSystem = 'Keep It Going'; setPanel(); cb.sendNotice('You have changed the goal system to Keep It Going. Have fun!',user,purple); } else { cb.sendNotice('The goal system is already set to Keep It Going. Enter /changegoal to see the available options.',user,purple); } break; } case '4': { valid = 1; if(cb.settings.goalSystem != 'Sequence Tips') { cb.settings.goalSystem = 'Sequence Tips'; setPanel(); cb.sendNotice('You have changed the goal system to Sequence Tips. Have fun!',user,purple); } else { cb.sendNotice('The goal system is already set to Sequence Tips. Enter /changegoal to see the available options.',user,purple); } break; } } if(option == null) { valid = 1; cb.sendNotice('Enter /changegoal x to change the goal system. Here are your choices:',user,purple); cb.sendNotice ( '1: Auto-Reset Tip Goal' + '\n2: Tip Multi-Goal' + '\n3: Keep It Going' + '\n4: Sequence Tips' ,user); cb.sendNotice('Be sure that you choose a system that you have already configured in the app menu!',user,purple) } if(valid == 0) { cb.sendNotice(option + ' is not a valid option for /changegoal. Enter /changegoal to see the available options.',user,purple); } } function updateJar() { if(tipJar > 0 && showStarted == 1) { tipJar = tipJar - cb.settings.kigReduceAmount; if(tipJar <= 0) { tipJar = 0; showStarted = 0; cb.sendNotice('The tip jar is empty! Tip ' + cb.settings.kigStartShow + ' tokens to start the show again!','',purple); } } cb.setTimeout(updateJar,cb.settings.kigReduceRate*1000); setPanel(); } function sellTickets(mod) { var sold = 0; for(var i = 0; i < tipperArray.length; i++) { if(!cbjs.contains(hiddenArray,tipperArray[i][0]) && tipperArray[i][1] >= cb.settings.hiddenShowTokenPrice) { addUser(tipperArray[i][0],cb.room_slug); sold++; } } cb.sendNotice('You have sent out ' + sold + ' tickets.',mod,purple); } } //cb.onMessage { cb.onMessage(function(msg) { var message = msg['m'].split(' '); //commands if(message[0].charAt(0) == '/') { msg['X-Spam'] = true; switch(message[0]) { case '/uacommands': { cb.sendNotice('startshow\nshowtimeleft\nprinttime\naddshowtime\nadduser\nchangegoal\nhide\nunhide\nselltickets',msg['user']); break; } case '/startshow': { //permission check if(msg['user'] == cb.room_slug) { startTimer(cb.settings.showTimerDuration, cb.room_slug); notifierSpam(); } else { cb.sendNotice('Only broadcasters are able to use that command.',msg['user'],purple); } break; } case '/showtimeleft': { timeLeft(msg['user']); break; } case '/printtime': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug) { printTime(); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.',msg['user'],purple); } break; } case '/addshowtime': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug) { addTime(message[1], msg['user']); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.',msg['user'],purple); } break; } case '/adduser': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug) { addUser(message[1],msg['user']); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.',msg['user'],purple); } break; } case '/changegoal': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug) { changeGoal(message[1],msg['user']); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.',msg['user'],purple); } break; } case '/hide': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug) { if(!cb.limitCam_isRunning()) { hideShow('command'); cb.sendNotice('The show is now a hidden camera show.',msg['user'],purple); if(msg['user'] != cb.room_slug) { cb.sendNotice('The show is now a hidden camera show.',cb.room_slug,purple); } } else { cb.sendNotice('The show is already hidden.',msg['user'],purple); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.',msg['user'],purple); } break; } case '/unhide': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug) { if(cb.limitCam_isRunning()) { cb.limitCam_stop(); cb.sendNotice('The show is now a hidden camera show.',msg['user'],purple); if(msg['user'] != cb.room_slug) { cb.sendNotice('The show is no longer a hidden camera show.',cb.room_slug,purple); } } else { cb.sendNotice('The show is already public.',msg['user'],purple); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.',msg['user'],purple); } break; } case '/selltickets': { //permission check if(msg['is_mod'] || msg['user'] == cb.room_slug || cbjs.arrayContains(eModArray,msg['user'])) { sellTickets(msg['user']); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.\nType "/ubhelp commands" to see a full list of the available commands.',msg['user'],purple); } break; } } } //ticket show stuff { //free mod tickets if(cb.settings.hiddenShowMods == 'Yes' && msg['is_mod'] && !cbjs.arrayContains(hiddenArray,msg['user'])) { addUser(msg['user'],cb.room_slug); } //free fanclub tickets if(cb.settings.hiddenShowFans == 'Yes' && msg['in_fanclub'] && !cbjs.arrayContains(hiddenArray,msg['user'])) { addUser(msg['user'],cb.room_slug); } } return msg; }); } //cb.onTip { cb.onTip(function(tip) { tipTotal += parseInt(tip['amount']); setPanel(parseInt(tip['amount'])); tipperArray[findTipper(tip['from_user'])][1] += parseInt(tip['amount']); if(cb.settings.hiddenShowToggle == 'Yes' && tipperArray[findTipper(tip['from_user'])][1] >= cb.settings.hiddenShowTokenPrice && !cbjs.arrayContains(hiddenArray,tip['from_user'])) { hiddenArrayPopulate(tip['from_user']); cb.sendNotice('You have been granted a ticket and are guaranteed to see the full show!',tip['from_user'],purple); } }); } //cb.onDrawPanel { cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': row1Left, 'row1_value': row1Right, 'row2_label': row2Left, 'row2_value': row2Right, 'row3_label': row3Left, 'row3_value': row3Right } }); } //init { if(initialize == 0) { setPanel(); if(cb.settings.showTimerToggle == 'Yes') { cb.sendNotice('Type /startshow to begin the show timer.',cb.room_slug, purple); } if(cb.settings.goalSystem == 'Keep It Going') { updateJar(); } } }
© Copyright Chaturbate 2011- 2026. All Rights Reserved.