Apps Home
|
Create an App
Eva
Author:
kerndev
Description
Source Code
Launch App
Current Users
Created by:
Kerndev
//Setup cb.settings_choices = [ {name:'tip_jar_timer', type:'int', minValue:1, maxValue:255, defaultValue:10, label: "How many seconds between tip jar token removal"}, {name:'tip_jar_loss', type:'int', minValue:1, maxValue:255, defaultValue:5, label: "How many tokens should fall out of the jar"} ]; //Variables let tippers = []; let HighTipper = null; let TipJar = 0; let TipJarTimer = cb.settings.tip_jar_timer * 1000; let TipJarLoss = cb.settings.tip_jar_loss; let TipMenu = { 4: "Requests / Ask about private", 9: "Blow you a kiss", 12: "Because you love me", 14: "Because you missed me", 16: "Show tongue", 17: "Suck Finger", 18: "Sexy tattoo tour", 19: "Show feet", 22: "Stand and do a twirl", 24: "3 Spanks", 33: "Massage and take our boobs", 57: "Kitty close up", 63: "2 Min dildo BJ", 74: "Doggy pose close up", 81: "Oil boobs or ass", 96: "Extreme close up of your choice", 101: "Take off cloths", 103: "Finger kitty, extra finger per 20 tokens", 118: "2 Mins with vibrator", 123: "2 Mins with dildo", 317: "Anal", 342: "Double Dildo Penetration", 438: "Two dildos in vagina" } //Startup let Timer = cb.setTimeout(callTipJar, TipJarTimer); let TimerState = true; //Handlers cb.onMessage(function (msg) { if(msg['is_mod'] === true){ msg['background'] = '#ffaaaa' } if(msg['user'] == cb.room_slug || msg['is_mod'] === true){ //Commmands switch(msg['m']){ case "/start": msg['X-Spam'] = true; if(TimerState){ //its running wtf cb.chatNotice("Jar is already running"); }else{ Timer = cb.setTimeout(callTipJar, TipJarTimer); TimerState = true; cb.chatNotice("Tip Jar started") } break; case "/stop": msg['X-Spam'] = true; if(!TimerState){ //Its already dead, stop beating it please cb.chatNotice("Jar is already stopped."); }else{ cb.cancelTimeout(Timer); TimerState = false; cb.chatNotice("Tip Jar has been stopped"); } break; case "/faster": msg['X-Spam'] = true; if(TimerState){ if(TipJarTimer !== 0) { TipJarTimer -= 1000; cb.chatNotice("Tip jar interval decreased to " + TipJarTimer/1000); } } break; case "/slower": msg['X-Spam'] = true; if(TimerState){ TipJarTimer += 1000; cb.chatNotice("Tip Jar interval increased to " + TipJarTimer/1000) } break; } } if(msg['m'] === "/menu" || msg['m'] === "/tipmenu"){ cb.log("Menu Requested"); printTipMenu(); } return msg; }); cb.onTip(function (tip) { let tipper = getTipper(tip); cb.log(tipper); tipper.Tips += parseInt(tip['amount']); TipJar += parseInt(tip['amount']); cb.log(TipJar); getHighestTipper(); sendTipMessage(tip); updatePanel(); }); //Custom Functions function getTipper(tip) { for(let i = 0; i < tippers.length; i++) { if (tippers[i].Name === tip['from_user']) { return tippers[i]; } } //if here not tipper not found cb.log("No tipper in array, creating"); let tipper = { Name: tip['from_user'], Tips: 0 }; tippers.push(tipper); return tipper; } function getHighestTipper() { let hTip = 0; for(let i = 0; i < tippers.length; i++){ if(tippers[i].Tips > hTip){ hTip = tippers[i].Tips; HighTipper = tippers[i]; } } } function sendTipMessage(tip) { if(tip['amount'] >= 25 && tip['amount'] <= 29){ cb.chatNotice("Thank you for the handful of nickles " + tip['from_user']); } else if(tip['amount'] >=30 && tip['amount'] <= 99){ cb.chatNotice("Thank you for the bag of nickles " + tip['from_user']); } } function updatePanel() { if(HighTipper != null) { cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Tip Jar :', 'row1_value': TipJar, 'row2_label': 'Highest Tip:', 'row2_value': HighTipper.Name + " [" + HighTipper.Tips + "]", 'row3_value': '0' }; }); } cb.drawPanel(); } function callTipJar() { if(TipJar === 0){ //Dont do anything }else{ TipJar -= TipJarLoss; if(TipJar === 0){ cb.chatNotice("Tip jar has emptied :("); } } updatePanel(); cb.setTimeout(callTipJar, TipJarTimer); } function printTipMenu(){ for(var tipItem in TipMenu){ if(TipMenu.hasOwnProperty(tipItem)) { cb.chatNotice("For " + tipItem + " tks: " + TipMenu[tipItem]); } } }
© Copyright Chaturbate 2011- 2025. All Rights Reserved.