Apps Home
|
Create an App
goals
Author:
chasityvance
Description
Source Code
Launch App
Current Users
Created by:
Chasityvance
/* 6 Commands by remmbermytitans */ // vars var total_tipped = 0; var high_tip_username = null; var high_tip_amount = 0; var last_tip_command = ''; var last_tip_user = null; cb.settings_choices = [ {name: 'Control_Command_1', type: 'str', minLength: 1, maxLength: 100}, {name: 'Control_TokenAmount_1', type: 'int', minValue: 1, default: 10}, {name: 'Control_Command_2', type: 'str', minLength: 1, maxLength: 100}, {name: 'Control_TokenAmount_2', type: 'int', minValue: 1, default: 20}, {name: 'Control_Command_3', type: 'str', minLength: 1, maxLength: 100}, {name: 'Control_TokenAmount_3', type: 'int', minValue: 1, default: 30}, {name: 'Control_Command_4', type: 'str', minLength: 1, maxLength: 100}, {name: 'Control_TokenAmount_4', type: 'int', minValue: 1, default: 40}, {name: 'Control_Command_5', type: 'str', minLength: 1, maxLength: 100}, {name: 'Control_TokenAmount_5', type: 'int', minValue: 1, default: 50}, {name: 'Control_Command_6', type: 'str', minLength: 1, maxLength: 100}, {name: 'Control_TokenAmount_6', type: 'int', minValue: 1, default: 60}, {name: 'Goal_Description', type: 'str', minLength: 1, maxLength: 511, default: 'You choose what I do!'}, {name: 'Token_Goal', type: 'int', minValue: 1, default: 1000}, {name: 'Message_When_Goal_Reached', type: 'str', minLength: 1, maxLength: 100} ]; // handlers cb.onTip(function(tip) { total_tipped += tip['amount'] update_App(); last_tip_user = tip['from_user'] if (tip['amount'] == cb.settings.Control_TokenAmount_1) last_tip_command = cb.settings.Control_Command_1; else if (tip['amount'] == cb.settings.Control_TokenAmount_2) last_tip_command = cb.settings.Control_Command_2; else if (tip['amount'] == cb.settings.Control_TokenAmount_3) last_tip_command = cb.settings.Control_Command_3; else if (tip['amount'] == cb.settings.Control_TokenAmount_4) last_tip_command = cb.settings.Control_Command_4; else if (tip['amount'] == cb.settings.Control_TokenAmount_5) last_tip_command = cb.settings.Control_Command_5; else if (tip['amount'] == cb.settings.Control_TokenAmount_6) last_tip_command = cb.settings.Control_Command_6; else last_tip_command = "No command"; if (tip['amount'] > high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } cb.drawPanel(); }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Tips Received:', 'row1_value': total_tipped + '/' + tips_remaining(), 'row2_label': 'Highest Tip:', 'row2_value': format_username(high_tip_username) + '(' + high_tip_amount + ')', 'row3_label': 'Latest Command:', 'row3_value': last_tip_command + '\n(' + format_username(last_tip_user) + ')' }; }); // helper functions function update_App() { if (tips_remaining() == 0) { var new_subject = "Goal met! " + cb.settings.Message_When_Goal_Reached; cb.log(new_subject); cb.changeRoomSubject(new_subject); } else { var new_subject = cb.settings.Goal_Description + " " + cb.settings.Control_Command_1 + ": " + cb.settings.Control_TokenAmount_1 + " tokens. " + cb.settings.Control_Command_2 + ": " + cb.settings.Control_TokenAmount_2 + " tokens. " + cb.settings.Control_Command_3 + ": " + cb.settings.Control_TokenAmount_3 + " tokens. " + cb.settings.Control_Command_4 + ": " + cb.settings.Control_TokenAmount_4 + " tokens. " + cb.settings.Control_Command_5 + ": " + cb.settings.Control_TokenAmount_5 + " tokens. " + cb.settings.Control_Command_6 + ": " + cb.settings.Control_TokenAmount_6 + " tokens. " + " [" + tips_remaining() + " tokens remaining]"; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } } function tips_remaining() { var r = cb.settings.Token_Goal - total_tipped; if (r < 0) { return 0; } else { return r; } } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function init() { update_App(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.