Apps Home
|
My Uploads
|
Create an App
Roxies Tip Goal
Author:
raising_arizona
Description
Source Code
Launch App
Current Users
Created by:
Raising_Arizona
App Images
// =========================================== // // ============= Roxie's Tip Goal ============ // // =========================================== // // ======== Written By chopper_daddy ========= // // =========================================== // /* // == CHANGELOG == // // Feb 28 2019: Changed user colors for mod // Feb 27 2019: Added rotating notifier from badbadbubba (THANK YOU) // Feb 25 2019: Changed Greys to have light grey text. Added a "F" flag next to female chats. */ // ** Restarting Tip Goal ** // var times_goal_reached = 0; var last_time_goal_reached = null; var current_goal_tipped = 0; var last_user_tip = ' No Tips Yet '; var font_size = 11; var i = 0; // ** Rotating Notices ** // var MAXRMESSAGES = 8; // ** Tip Menu ** // var tip_amt = 0; var separator_char = " | "; var messageMenu; var messageIntro; var messageOutro; var MAXITEMS = 20; var mip = []; var mi = []; var MAXSEP = 6; var menuItemPrice; var menuItem; separators = [ { label: 'Hearts', shortcut: ':heart2' }, { label: 'Glitter', shortcut: ':pixelglitter' }, { label: 'Flowers', shortcut: ':tinyflower2' }, { label: 'Bow', shortcut: ':bluebow' }, { label: 'Hearts2', shortcut: ':pixelheart' }, { label: 'Smiley', shortcut: ':smile' }, ]; cb.settings_choices = [ // ** Tip Goal & Room name ** // { name: 'tokens', label: 'Goal', type: 'int', minValue: 1, default: 1000, required: true }, { name: 'goal_description', label: 'Goal Description', type: 'str', minLength: 1, maxLength: 255, required: true }, { name: 'emoji', type: 'str', label: 'Emoji', defaultValue: '2620', minLength: 1, maxLength: 20, required: false }, // ** Message Settings ** // { name: 'msgonentry', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Display Msg 1 privately on entry?' }, // ** Rotating Messages ** // { name: 'msg1', type: 'str', required: true, label: 'Message 1' }, { name: 'msg2', type: 'str', required: false, label: 'Message 2' }, { name: 'msg3', type: 'str', required: false, label: 'Message 3' }, { name: 'msg4', type: 'str', required: false, label: 'Message 4' }, { name: 'msg5', type: 'str', required: false, label: 'Message 5' }, { name: 'msg6', type: 'str', required: false, label: 'Message 6' }, { name: 'msg7', type: 'str', required: false, label: 'Message 7' }, { name: 'msg8', type: 'str', required: false, label: 'Message 8' }, // ** Colors ** // { name: 'msgcolor', type: 'str', label: 'Notice color', defaultValue: '#2E2D4D' }, // ** Timing Settings ** // { name: 'chat_ad', type: 'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notices (minimum 1)' }, { name: 'modelName', type: 'str', label: 'Your Name', required: false }, // ** Tip Menu ** // { name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3: 'Glitter', choice4: 'Flowers', choice5: 'Bow', choice6: 'Hearts2', choice7: 'Smiley', defaultValue: 'Vertical Bar', label: 'Separator character', required: false }, { name: 'customsep', type: 'str', label: 'Custom Separator', required: false }, { name: 'item1', type: 'str', label: 'Item 1' }, { name: 'item1price', type: 'int', minValue: 0, maxValue: 99999999, label: 'Item 1 Price' }, { name: 'item2', type: 'str', required: false, label: 'Item 2' }, { name: 'item2price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 2 Price' }, { name: 'item3', type: 'str', required: false, label: 'Item 3' }, { name: 'item3price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 3 Price' }, { name: 'item4', type: 'str', required: false, label: 'Item 4' }, { name: 'item4price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 4 Price' }, { name: 'item5', type: 'str', required: false, label: 'Item 5' }, { name: 'item5price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 5 Price' }, { name: 'item6', type: 'str', required: false, label: 'Item 6' }, { name: 'item6price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 6 Price' }, { name: 'item7', type: 'str', required: false, label: 'Item 7' }, { name: 'item7price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 7 Price' }, { name: 'item8', type: 'str', required: false, label: 'Item 8' }, { name: 'item8price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 8 Price' }, { name: 'item9', type: 'str', required: false, label: 'Item 9' }, { name: 'item9price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 9 Price' }, { name: 'item10', type: 'str', required: false, label: 'Item 10' }, { name: 'item10price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 10 Price' }, { name: 'item11', type: 'str', required: false, label: 'Item 11' }, { name: 'item11price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 11 Price' }, { name: 'item12', type: 'str', required: false, label: 'Item 12' }, { name: 'item12price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 12 Price' }, { name: 'item13', type: 'str', required: false, label: 'Item 13' }, { name: 'item13price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 13 Price' }, { name: 'item14', type: 'str', required: false, label: 'Item 14' }, { name: 'item14price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 14 Price' }, { name: 'item15', type: 'str', required: false, label: 'Item 15' }, { name: 'item15price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 15 Price' }, { name: 'item16', type: 'str', required: false, label: 'Item 16' }, { name: 'item16price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 16 Price' }, { name: 'item17', type: 'str', required: false, label: 'Item 17' }, { name: 'item17price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 17 Price' }, { name: 'item18', type: 'str', required: false, label: 'Item 18' }, { name: 'item18price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 18 Price' }, { name: 'item19', type: 'str', required: false, label: 'Item 19' }, { name: 'item19price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 19 Price' }, { name: 'item20', type: 'str', required: false, label: 'Item 20' }, { name: 'item20price', type: 'int', minValue: 0, maxValue: 99999999, required: false, label: 'Item 20 Price' }, { name: 'noticecolor', type: 'str', label: 'Notice Color (default: red)', defaultValue: '#9013FE' }, { name: 'noticebg', type: 'str', label: 'Notice Background Color (default: white)', defaultValue: '#ffffff' }, { name: 'chat_ad', type: 'int', minValue: 1, maxValue: 999, defaultValue: 1, label: 'Delay in minutes between notice being displayed (min 1)' } ]; var emoji = '0x' + cb.settings.emoji; // handlers cb.onTip(tip => { current_goal_tipped += tip['amount']; if (current_goal_tipped >= cb.settings.tokens) { goalReached(tip['from_user']); } last_user_tip = tip['from_user']; cb.drawPanel(); }); cb.onDrawPanel(function (user) { var tkns = cb.settings.tokens; var emj = String.fromCodePoint(emoji); var cgt = current_goal_tipped; var tgr = times_goal_reached; var lut = last_user_tip; var fz = font_size; return { "template": "image_template", "layers": [ { 'type': 'image', 'fileID': 'f19818ff-f9ef-4a40-b0fc-b0b5c2852f9f' }, // Row 1 { 'type': 'text', 'text': 'RECEIVED/GOAL', 'top': 12, 'left': 100, 'font-size': font_size, 'color': '#E540CC' }, { 'type': 'text', 'text': `${cgt}/${tkns}`, 'top': 12, 'left': 190, 'font-size': fz, 'color': '#E540CC' }, // Row 2 { 'type': 'text', 'text': 'GOAL REACHED', 'top': 31, 'left': 100, 'font-size': font_size, 'color': '#E540CC' }, { 'type': 'text', 'text': `${tgr} times`, 'top': 31, 'left': 190, 'font-size': fz, 'color': '#E540CC' }, // Row 3 { 'type': 'text', 'text': `${emj} ${lut} ${emj}`, 'top': 49, 'left': 100, 'font-size': fz, 'color': '#F4AD33' }, ], }; }); cb.onMessage((msg) => { if (msg['is_mod'] || msg['user'] == 'chopper_daddy') { if (startsWith(msg['m'], ' ')) { msg['background'] = '#2E2D4D'; msg['c'] = '#ffffff'; } else { msg['background'] = '#FFF3E4'; msg['c'] = 'red'; } } else if (msg['gender'] == 'f' && msg['user'] != 'raising_arizona') { msg['m'] = '[f] ' + msg['m']; } else if (msg['has_tokens'] === false) { msg['c'] = '#B4B4B4'; } return msg; }); // Functions function refresh() { cb.log("Refresh called"); cb.setTimeout(refresh, 20000); cb.drawPanel(); } function update_subject() { var new_subject = cb.settings.goal_description + " [" + tips_remaining() + " tokens remaining]"; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } function goalReached(userName) { last_time_goal_reached = new Date(); var curr_times_reached = Math.floor(current_goal_tipped / cb.settings.tokens); for (var i = 0; i < curr_times_reached; i++) { times_goal_reached++; current_goal_tipped -= cb.settings.tokens; cb.chatNotice("Goal was reached for the " + getNumberString(times_goal_reached) + " time!", '', "#FEF9CD", "#F26CBA", "bold"); cb.chatNotice('The user ' + userName + ' has reached the goal.', cb.room_slug, "#FEF9CD", "#F26CBA", "bold"); } } function getNumberString(number) { var numberString = null; var lastChar = String(number).charAt(String(number).length - 1); if ((lastChar == '1') && ((number % 100) != 11)) { numberString = number + "st"; } else if ((lastChar == '2') && ((number % 100) != 12)) { numberString = number + "nd"; } else if ((lastChar == '3') && ((number % 100) != 13)) { numberString = number + "rd"; } else { numberString = "" + number + "th"; } return (numberString); } function tips_remaining() { var r = cb.settings.tokens - current_goal_tipped; if (r < 0) { return 0; } else { return r; } } function startsWith(source, str) { return source.substring(0, str.length) === str; } function init() { update_subject(); } init(); cb.setTimeout(refresh, 20000); /////////////////////// // ROTATING NOTIFIER // /////////////////////// cb.onEnter(function (user) { if (cb.settings['msgonentry'] == 'yes') { cb.sendNotice('Welcome ' + user['user'] + '! ' + cb.settings['msg1'], user['user'], '', cb.settings['msgcolor'], 'bold'); } }); function chatAd() { var msg; while (cb.settings['msg' + (i + 1)] == 0) { i++; i %= MAXRMESSAGES; } msg = cb.settings['msg' + (i + 1)]; i++; i %= MAXRMESSAGES; cb.sendNotice(msg, '', '', cb.settings['msgcolor'], 'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000));
© Copyright Chaturbate 2011- 2025. All Rights Reserved.