Apps Home
|
Create an App
Tip To See
Author:
duracel420
Description
Source Code
Launch App
Current Users
Created by:
Duracel420
// vars var last_tip_username = null; var dark_blue = null; var next_tip_amount = 1; var goal_reached = false; var high_tip_amount = 0; var high_tip_username = null; var imena = new Array(); var tipovi = new Array(); var tips_remaining = 0; var last_cmd =null; var post_goal = 1; // var version = 10 // Limit goal description as we add some text cb.settings_choices = [ { name: 'goal_description', type: 'str', minLength: 1, maxLength: 190 }, { name: 'goal_value', type: 'int', minValue: 1, maxValue: 100, default: 50 }, { name: 'order', type: 'choice', choice1: 'ascending', choice2: 'descending', default: 'ascending' }, { name: 'hide_message', type: 'str', minLength: 1, maxLength: 2, default: " " }, { name: 'fans_watch_for_free', type: 'choice', choice1: 'No', choice2: 'Yes', default: 'No' }, ]; cb.onTip( function (tip) { if(post_goal = 1) {post_goal += cb.settings.goal_value}; if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])&&!checkGoalReached()) { if(parseInt(tip['amount']) >= next_tip_amount) { output('Added '+ tip['from_user'] + ' to the list of hidden cam viewers'); cb.limitCam_addUsers([tip['from_user']]); }} if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])&&checkGoalReached()) { if(parseInt(tip['amount']) >= post_goal) { output('Added '+ tip['from_user'] + ' to the list of hidden cam viewers'); cb.limitCam_addUsers([tip['from_user']]); }} najvisi(tip['from_user'],tip['amount']); if (tip['amount']<next_tip_amount) {cb.chatNotice("Thanks for the tip, but it was less than the next tip needed to progress towards the goal and will not count towards meeting the goal.",tip['from_user'],'#FF69B4')} else{ var diff = tip['amount']; while ((diff > 0) && (!checkGoalReached())) { diff -= next_tip_amount; if (diff >= 0) { // We set the last tipper only if the tip was counted // (not optimal to do it as many times as the tip counted though) last_tip_username = tip['from_user']; tips_remaining -=next_tip_amount; setNextTipNeeded(); } }} if (cb.limitCam_isRunning() && !checkGoalReached()) {cb.limitCam_stop(); cb.limitCam_start(cb.settings.hide_message+ "Tip: "+next_tip_amount+" tokens"); } if (cb.limitCam_isRunning() && checkGoalReached()) {cb.limitCam_stop(); cb.limitCam_start(cb.settings.hide_message+ "Tip "+post_goal+" tokens"); } update_subject(); cb.drawPanel(); } ); cb.onDrawPanel( function (user) { if (checkGoalReached()) { return { 'template': '3_rows_11_21_31', 'row1_value': 'Goal reached!', 'row2_value': format_username(high_tip_username) + "("+high_tip_amount+")", 'row3_value': 'Thanks to all tippers' }; } else { if (isAscendingOrder()) { return { 'template': '3_rows_of_labels', 'row1_label': 'Next Tip: ' + next_tip_amount, 'row1_value': 'Ascending to ' + cb.settings.goal_value, 'row2_label': 'Highest Total Tips:', 'row2_value': format_username(high_tip_username) + "("+high_tip_amount+")", 'row3_label': 'Single tip of ', 'row3_value': tips_remaining+' to meet goal' }; } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Next Tip Needed:', 'row1_value': next_tip_amount, 'row2_label': 'Highest Total Tips:', 'row2_value': format_username(high_tip_username)+ "("+high_tip_amount+")", 'row3_label': 'Single tip of', 'row3_value': tips_remaining+' to meet goal' }; } } } ); cb.onMessage(function (msg) { if (msg['user'] == 'ellelover') {cb.chatNotice("ellelover says "+msg['m'],cb.room_slug) } if (msg['user'] == 'elle_sterling') { msg['background'] = '#FF69B4'; } if (msg['user'] == 'steedj') { msg['background'] = '#90EE90'; msg['c'] = "#000000"; } if (msg['user'] == 'muddywaters1') { msg['c'] = "#000000"; } if (msg['user'] == 'ellelover') { msg['background'] = '#00BFFF'; } if (msg['user'] == 'snowpup_1011') { msg['background'] = '#A2E3E8' msg['c'] = "#0000FF";; } if(msg['tipped_recently'] == true && msg['in_fanclub'] == true) { dark_blue = msg['user']; } if(msg['m'] == "/list" && msg['user'] == "elle_sterling") { msg['X-Spam'] = true; cb.chatNotice(dark_blue + " is a dark blue fan club member", msg['user']); } if(msg['m'] == "/list" && msg['user'] == "snowpup_1011") { msg['X-Spam'] = true; cb.chatNotice(dark_blue + " is a dark blue fan club member", msg['user']); } if(msg['m'] == "/list" && msg['user'] == "muddywaters1") { msg['X-Spam'] = true; cb.chatNotice(dark_blue + " is a dark blue fan club member", msg['user']); } var message = msg['m']; var user = msg['user']; var username = ""; if (cb.room_slug === user && message == '/start' && !cb.limitCam_isRunning()) { last_cmd = 'start'; output(cb.room_slug + ' has hidden the cam!', '#FF69B4'); cb.limitCam_start(cb.settings.hide_message+ "Tip: "+next_tip_amount+" tokens"); } if (cb.room_slug === user && message == '/stop' && cb.limitCam_isRunning()) { last_cmd = 'stop'; output(cb.room_slug + ' is now public broadcasting!','#FF69B4'); cb.limitCam_stop(); } if ('muddywaters1' === user && message == '/stop') { cb.limitCam_stop(); } if ('muddywaters1' === user && message == '/restart') { cb.limitCam_stop(); cb.limitCam_start(cb.settings.hide_message+ ". Tip needed: "+next_tip_amount+" tokens"); } if ('snowpup_1011' === user && message == '/restart') { cb.limitCam_stop(); cb.limitCam_start(cb.settings.hide_message+ ". Tip needed: "+next_tip_amount+" tokens"); } if (cb.room_slug === user && message.substring(0, 7) == '/remove' && cb.limitCam_allUsersWithAccess().length > 0 ) { username = message.substring(8, message.length); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_removeUsers([username]); output(cb.room_slug + ' has removed ' + username + ' from those who can see her on hidden cam!'); } } if (msg['user'] === 'snowpup_1011' && message.substring(0, 9) == '/removeme' && cb.limitCam_allUsersWithAccess().length > 0 ) { username = message.substring(10, message.length); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_removeUsers([username]); } } if (cb.room_slug === user && message.substring(0, 4) == '/add' && cb.limitCam_allUsersWithAccess().length > 0 ) { username = message.substring(5, message.length); if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_addUsers([username]); output(cb.room_slug + ' has added ' + username + ' to the hidden cam viewers!'); } } if (msg['user'] === 'snowpup_1011' && message.substring(0, 6) == '/addme' && cb.limitCam_allUsersWithAccess().length > 0 ) { username = message.substring(7, message.length); if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_addUsers([username]); } } if (cb.room_slug === user && message.substring(0, 6) == '/check') { msg['X-Spam'] = true; username = message.substring(7, message.length); if (cb.limitCam_userHasAccess(username)) { output(username + " is in the hidden cam viewers!", cb.room_slug); } else { output(username + " is not in the show!", cb.room_slug); } } if (msg['user'] == 'snowpup_1011' && message.substring(0, 6) == '/check') { msg['X-Spam'] = true; username = message.substring(7, message.length); if (cb.limitCam_userHasAccess(username)) { output(username + " is in the hidden cam viewers!", "snowpup_1011"); } else { output(username + " is not in the show!","snowpup_1011"); } } if (cb.room_slug === user && message === '/viewers') { msg['X-Spam'] = true; var userlist = cb.limitCam_allUsersWithAccess(); userlist.sort(); if (userlist.length > 0) { output("" + userlist.length + (userlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(userlist, ", "),cb.room_slug); } else { output("No users in show.", cb.room_slug); } } if (msg['user'] == 'snowpup_1011' && message === '/viewers') { msg['X-Spam'] = true; var userlist = cb.limitCam_allUsersWithAccess(); userlist.sort(); if (userlist.length > 0) { output("" + userlist.length + (userlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(userlist, ", "),"snowpup_1011"); } else { output("No users in show.", "snowpup_1011"); } } if (message[0] == '/') { msg['X-Spam'] = true; } return msg; }); // helper functions function update_subject() { if (goal_reached) { return; } var new_subject = ""; if (checkGoalReached()) { new_subject = cb.settings.goal_description + " [Goal reached! Thanks to all tippers.]"; goal_reached = true; } else { if (isAscendingOrder()) { new_subject = cb.settings.goal_description + " [Tip in ascending order from 1 to " + cb.settings.goal_value + ". Next tip needed: " + next_tip_amount + "]"; } else { new_subject = cb.settings.goal_description + " [Tip in descending order from " + cb.settings.goal_value + " to 0. Next tip needed: " + next_tip_amount + "]"; } } cb.changeRoomSubject(new_subject); } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function najvisi(ime, tip) { var index=imena.indexOf(ime); if(index==-1) { cb.log("new"); imena[imena.length]=ime; tipovi[tipovi.length]=tip; if(high_tip_amount==0 || high_tip_amount<tip) { high_tip_amount=tip; high_tip_username=ime; } } else { cb.log("old"); tipovi[index]+=tip; if (tipovi[index]>high_tip_amount) { high_tip_amount=tipovi[index]; high_tip_username=imena[index]; } } } function tipstogoal() { tips_remaining == 0; for (var i=next_tip_amount;i <= cb.settings.goal_value;i++) {tips_remaining += i} } function tipstogoal_down() { tips_remaining_down == 0; for (var i=0; i <= next_tip_amount;i++) {tips_remaining_down += i} } function isAscendingOrder() { return (cb.settings.order == 'ascending'); } function setNextTipNeeded() { if (isAscendingOrder()) { next_tip_amount++; } else { next_tip_amount--; } } function checkGoalReached() { if (isAscendingOrder()) { return (next_tip_amount > cb.settings.goal_value); } else { return (next_tip_amount <= 0); } } function output(message) { cb.chatNotice(message); } cb.onEnter(function(user) { if((user['is_mod'] === true || user['in_fanclub'] === true) && cb.settings.fans_watch_for_free === "Yes") {cb.limitCam_addUsers([user['user']])}; }); function init() { tipstogoal(); if (isAscendingOrder()) { next_tip_amount = 1; } else { next_tip_amount = cb.settings.goal_value; } update_subject(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.