Apps Home
|
Create an App
Xmas Tip Menu
Author:
garterxxx
Description
Source Code
Launch App
Current Users
Created by:
Garterxxx
// 🎄 Xmas Tip Menu Script by Glow 🎄 // Variables var total_tips = 0; var goal_tips = 0; var last_tipper = null; var last_tip = 0; var ht_username = null; var ht_amount = 0; var goal = 0; // Settings cb.settings_choices = [ { name: 'goal', type: 'int', minValue: 0, defaultValue: 1000, label: "Goal Amount (Set to 0 to Disable)" }, { name: 'reset', type: 'choice', choice1: 'Yes', choice2: 'No', label: "Reset the Goal when it is Met?" }, { name: 'goalAd', type: 'str', minLength: 0, MaxLength: 300, label: "Goal Description (Optional)", required: false }, { name: 'item1', type: 'str', minLength: 1, maxLength: 30, label: "Menu Item 1 (required)", defaultValue: "Mistletoe Kiss 💋" }, { name: 'price1', type: 'int', minValue: 0, defaultValue: 50, label: "Item 1 Price (required)" }, { name: 'item2', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 2 (required)", defaultValue: "Elf Dance 💃" }, { name: 'price2', type: 'int', minValue: 0, defaultValue: 100, label: "Item 2 Price (required)" }, { name: 'item3', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 3", required: false, defaultValue: "Candy Cane Tease 🍬" }, { name: 'price3', type: 'int', minValue: 0, label: "Item 3 Price", required: false, defaultValue: 150 }, { name: 'item4', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 4", required: false, defaultValue: "Santa Costume Show 🎅" }, { name: 'price4', type: 'int', minValue: 0, label: "Item 4 Price", required: false, defaultValue: 200 }, { name: 'item5', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 5", required: false, defaultValue: "Snowy Shower ❄️" }, { name: 'price5', type: 'int', minValue: 0, label: "Item 5 Price", required: false, defaultValue: 250 }, { name: 'chat_ad', type: 'int', minValue: 0, maxValue: 999, defaultValue: 10, label: 'Advertise Menu in Chat Every _____ Mins (Set 0 to Disable)' } ]; // Tip Handlers cb.onTip(function(tip) { total_tips += tip['amount']; goal_tips += tip['amount']; last_tip = tip['amount']; last_tipper = tip['from_user']; if(tip['amount'] > ht_amount){ ht_amount = tip['amount']; ht_username = tip['from_user']; } // Notify menu item if matched for(let i=1;i<=10;i++){ if(tip['amount'] === cb.settings['price'+i]){ cb.chatNotice(cb.settings['item'+i] + ' 🎄'); } } update_app(); cb.drawPanel(); }); // Chat Commands cb.onMessage(function(msg){ if(msg['user']==ht_username) msg['background']='#CCFF99'; if(msg['m']=='/menu'){ cb.chatNotice('----- 🎄 Xmas Tip Menu 🎄 -----', msg['user']); for(var i=0;i<listMenu.length;i++){ cb.chatNotice(listMenu[i], msg['user']); } } if(msg['m']=='/showmenu' && msg['user']==cb.room_slug){ cb.chatNotice('----- 🎄 Xmas Tip Menu 🎄 -----'); for(var i=0;i<listMenu.length;i++){ cb.chatNotice(listMenu[i]); } } return msg; }); // Display Panel cb.onDrawPanel(function(user){ var panel_goal = cb.settings.goal === 0 ? 'No Goal' : goal_tips+'/'+cb.settings.goal; return { 'template':'3_rows_12_22_31', 'row1_label':'🎄 Xmas Tip Menu Active!', 'row1_value':'Type /menu to see it', 'row2_label':'Top Xmas Helper:', 'row2_value': nullCheck(ht_username)+' ('+ht_amount+' 🎁)', 'row3_value':'Tip '+cb.settings.price1+'tks For "'+cb.settings.item1+'"' }; }); // Build Menu List var listMenu=[]; for(let i=1;i<=10;i++){ if(cb.settings['item'+i] && cb.settings['price'+i]){ listMenu.push(cb.settings['item'+i]+' 🎄 For '+cb.settings['price'+i]+'tks'); } } // Goal Functions function update_app(){ if(cb.settings.goal===0) return; if(goal_tips>=cb.settings.goal) goal_reached(); } function goal_reached(){ cb.chatNotice("🎅 Goal Reached! "+(cb.settings.goalAd || "Santa's sleigh is full! Next tip unwraps a surprise! 🎁")); if(cb.settings.reset==="Yes") goal_tips -= cb.settings.goal; } function nullCheck(str){return str?str.substring(0,15):"---";} // Chat Ad Loop function chatAd(){ cb.chatNotice('🎄 Tip Menu Active! '+cb.settings.price1+'tks for "'+cb.settings.item1+'" or type /menu for full Xmas menu 🎁'); cb.setTimeout(chatAd, (cb.settings.chat_ad*60000)); } if(cb.settings.chat_ad>0) cb.setTimeout(chatAd,(cb.settings.chat_ad*60000)); init(); function init(){update_app();}
© Copyright Chaturbate 2011- 2026. All Rights Reserved.