Apps Home
|
Create an App
Yesonee's Birthday Spank app
Author:
testty
Description
Source Code
Launch App
Current Users
Created by:
Testty
/** Name: Yesonee's Birthday Spank Counter Author: ty8633 Created: 12/06/2020 Written for Yesonee's room to keep a running total of spank tips during a show. Commands: /spanks - Shows current spank totals /setspanks XX - resets the Previous show total to XX /resetspanks - resets the current show totals to 0 **/ // settings cb.settings_choices = [ { name: 'tip_price', type: 'int', minValue: 1, label: 'Tip amount for spanks', defaultValue: 30, required: true }, { name: 'previous_count', type: 'int', minValue: 0, label: 'Enter Starting Count from previous show', defaultValue: 0, required: true }, { name: 'interval', type: 'int', minValue: 0, label: 'Interval to show count (in minutes - Enter 0 to disable)', defaultValue: 4, required: true } ]; // vars var starting_count = cb.settings.previous_count; var current_count = 0; var total_count = cb.settings.previous_count; var msg_counter = 0; var tot_msg_counter = 0; var msg_timer = cb.settings.interval * 60000; // functions cb.onTip(function(tip) { if (parseInt(tip['amount']) === cb.settings.tip_price) { current_count += 1; total_count = +starting_count + +current_count; msg_counter += 1; if (msg_counter >= 10) { msg_counter = 0; tot_msg_counter += 1; cb.sendNotice('Current Show Spanks: ' + current_count,'','',"#FF0000",'bold'); } if (tot_msg_counter >= 5) { tot_msg_counter = 0; cb.sendNotice('Total Spanks: ' + total_count,'','',"#FF0000",'bold'); } } }); cb.onMessage(function(m) { var msg_u = m.user; var msg = m.m.split(" "); var isMod = (cb.room_slug === msg_u || m.is_mod); if (isMod) { switch (msg[0]){ case "/Spanks": case "/spanks":{ show_count(); break; }; case "/setspanks": case "/SetSpanks": case "/Setspanks":{ if (Number.isInteger(parseInt(msg[1]))){ starting_count = msg[1]; total_count = +starting_count + +current_count; }; show_count(); break; }; case "/resetspanks": case "/Resetspanks": case "/ResetSpanks":{ current_count = +0; total_count = +starting_count + +current_count; show_count(); break; }; }; }; //cb.sendNotice(msg[1]); return m; }); function show_count() { var msg; var d = new Date(); msg = 'Previous Show Spanks: ' + starting_count + '\n'; msg += 'Current Show Spanks: ' + current_count + '\n'; msg += 'Total Spanks: ' + total_count; //msg += "\n"+d.toLocaleTimeString(); cb.sendNotice(msg,'','',"#FF0000",'bold'); }; function show_spanks_time() { show_count(); cb.setTimeout(show_spanks_time,msg_timer); }; function init() { var msg; msg = "Yesonee's Birthday Spanks\n"; msg += "Tip "+cb.settings.tip_price+" to add to the count."; cb.sendNotice(msg,'',"#FFCCCC","#CC0000",'bold'); show_count(); cb.setTimeout(show_spanks_time,msg_timer); }; init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.