|
|
come together
cb.onEnter(function(user) {
cb.chatNotice('Welcome ' + user['user'] + '!');
});
// modified version of admin app
// vars
var total_tipped = 0;
var high_tip_username = null;
var high_tip_amount = 0;
var last_tip_username = null;
var last_tip_amount = 0;
var subject_is_set_with_0 = false;
var control_duration = 0;
var new_subject = null;
var private_indicator = "!";
var timer_value = 0;
var notice_timer_value = 0;
var rules_list = null;
cb.settings_choices = [
{name: 'room_subject', type: 'str', minLength: 1, maxLength:255, default: 'The Slave & Master Game' },
{name: 'display_rules', type: 'choice',
choice1:'Never',
choice2:'Every 10 seconds',
choice3:'Every 30 seconds',
choice4:'Every minute',
choice5:'Every 2 minutes',
choice6:'Every 3 minutes',
choice7:'Every 5 minutes',
choice8:'Every 10 minutes',
choice9:'Every 15 minutes', defaultValue: 'Every 3 minutes' },
{name: 'Level_1_Sugar_Daddy_minimum_tokens', type: 'int', minValue: 1, default: 50 },
{name: 'Level_1_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default: 1 },
{name: 'Level_2_Sugar_Daddy_minimum_tokens', type: 'int', minValue: 1, default: 100, required: false },
{name: 'Level_2_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default: 2, required: false },
{name: 'Level_3_Sugar_Daddy_minimum_tokens', type: 'int', minValue: 1, default: 200, required: false },
{name: 'Level_3_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default: 5, required: false },
{name: 'Level_4_Sugar_Daddy_minimum_tokens', type: 'int', minValue: 1, required: false },
{name: 'Level_4_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, required: false },
{name: 'Level_5_Sugar_Daddy_minimum_tokens', type: 'int', minValue: 1, required: false },
{name: 'Level_5_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, required: false },
{name: 'Private_for_big_sugar_daddy', type: 'choice',
choice1:'Yes',
choice2:'No', defaultValue: 'Yes', required: false},
{name: 'Big_Sugar_Daddy_minimum_tokens', type: 'int', minValue: 1, default: 500, required: false },
{name: 'Private_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default:10, required: false }
];
// handlers
cb.onTip(function(tip) {
// update total
total_tipped += tip['amount']
// if the option for Big Sugar Daddy is turned on, neither the token minimum or duration is left blank, and the current tip is higher than the Big Sugar Daddy minimum...
if ((tip['amount'] >= cb.settings.Big_Sugar_Daddy_minimum_tokens) && ((cb.settings.Private_for_big_sugar_daddy == 'Yes')) && (cb.settings.Private_duration_in_minutes != null) && (cb.settings.Big_Sugar_Daddy_minimum_tokens != null))
{
// show the corresponding duration in the message
control_duration = cb.settings.Private_duration_in_minutes
// append the message to specify "in a private room"
private_indicator = " in a private room!"
}
// if it's not a Big Sugar Daddy tip, apply the regular logic to determine the corresponding length of time
else
{
// if level 2 is greater than current tip, or level 2 is null, this is a level 1 tip
if ((cb.settings.Level_2_Sugar_Daddy_minimum_tokens > tip['amount']) || (cb.settings.Level_2_Sugar_Daddy_minimum_tokens == null) || (cb.settings.Level_2_duration_in_minutes == null))
{
control_duration = cb.settings.Level_1_duration_in_minutes
}
// if the former is not true, and if level 3 is greater than current tip, or level 3 is null, this is a level 2 tip
else if ((cb.settings.Level_3_Sugar_Daddy_minimum_tokens > tip['amount']) || (cb.settings.Level_3_Sugar_Daddy_minimum_tokens == null) || (cb.settings.Level_3_duration_in_minutes == null))
{
control_duration = cb.settings.Level_2_duration_in_minutes
}
// if the former is not true, and if level 4 is greater than current tip, or level 4 is null, this is a level 3 tip
else if ((cb.settings.Level_4_Sugar_Daddy_minimum_tokens > tip['amount']) || (cb.settings.Level_4_Sugar_Daddy_minimum_tokens == null) || (cb.settings.Level_4_duration_in_minutes == null))
{
control_duration = cb.settings.Level_3_duration_in_minutes
}
// if the former is not true, and if level 5 is greater than current tip, or level 5 is null, this is a level 4 tip
else if ((cb.settings.Level_5_Sugar_Daddy_minimum_tokens > tip['amount']) || (cb.settings.Level_5_Sugar_Daddy_minimum_tokens == null) || (cb.settings.Level_5_duration_in_minutes == null))
{
control_duration = cb.settings.Level_4_duration_in_minutes
}
// if the former is not true, and this is not a Big Sugar Daddy tip, then it is a level 5 tip
else if ((cb.settings.Big_Sugar_Daddy_minimum_tokens > tip['amount']) || (cb.settings.Big_Sugar_Daddy_minimum_tokens == null) || (cb.settings.Private_duration_in_minutes == null) || (cb.settings.Private_for_big_sugar_daddy == 'No'))
{
control_duration = cb.settings.Level_5_duration_in_minutes
}
}
timer_value = (1000 * 60 * control_duration)
// if the current tip is higher than the highest tip thus far
if ((tip['amount'] > high_tip_amount) && (tip['amount'] >= cb.settings.Level_1_Sugar_Daddy_minimum_tokens))
{
// update high score and display new subject
high_tip_amount = tip['amount']
high_tip_username = tip['from_user']
update_subject();
cb.setTimeout(times_up, timer_value)
}
// consider removing this part
last_tip_amount = tip['amount']
last_tip_username = tip['from_user']
if (tip['amount'] > high_tip_amount) {
high_tip_amount = tip['amount']
high_tip_username = tip['from_user']
}
// end section to consider for removal
cb.drawPanel();
});
cb.onDrawPanel(function(user) {
return {
'template': '3_rows_of_labels',
'row1_label': 'High Score:',
'row1_value': '' + high_tip_amount,
'row2_label': 'Master:',
'row2_value': format_username(high_tip_username),
'row3_label': 'Total Tips:',
'row3_value': total_tipped
};
});
// helper functions
function update_subject() {
new_subject = "Highest tip: "+ high_tip_amount + " tks - Master " + high_tip_username + ", tell me what to do for " + control_duration + " minute(s)" + private_indicator;
cb.log("Changing subject to: " + new_subject);
cb.changeRoomSubject(new_subject);
}
function format_username(val) {
if (val === null) {
return "--";
} else {
return val.substring(0, 12);
}
}
function times_up() {
cb.chatNotice("Time's up, thanks for playing!");
high_tip_username = "--"
cb.drawPanel();
}
function build_rules_list(){
rules_list = "Giving the highest tip makes you the Master, and you get to control the model & the show!\nBe the Master for " + cb.settings.Level_1_duration_in_minutes + " minutes with the highest tip of " + cb.settings.Level_1_Sugar_Daddy_minimum_tokens + " or more."
if ((cb.settings.Level_2_Sugar_Daddy_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null))
{
rules_list += ("\nBe the Master for " + cb.settings.Level_2_duration_in_minutes + " minutes with the highest tip of " + cb.settings.Level_2_Sugar_Daddy_minimum_tokens + " or more.")
}
if ((cb.settings.Level_3_Sugar_Daddy_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null))
{
rules_list += ("\nBe the Master for " + cb.settings.Level_3_duration_in_minutes + " minutes with the highest tip of " + cb.settings.Level_3_Sugar_Daddy_minimum_tokens + " or more.")
}
if ((cb.settings.Level_4_Sugar_Daddy_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null))
{
rules_list += ("\nBe the Master for " + cb.settings.Level_4_duration_in_minutes + " minutes with the highest tip of " + cb.settings.Level_4_Sugar_Daddy_minimum_tokens + " or more.")
}
if ((cb.settings.Level_5_Sugar_Daddy_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null))
{
rules_list += ("\nBe the Master for " + cb.settings.Level_5_duration_in_minutes + " minutes with the highest tip of " + cb.settings.Level_5_Sugar_Daddy_minimum_tokens + " or more.")
}
if ((cb.settings.Private_duration_in_minutes != null) && (cb.settings.Big_Sugar_Daddy_minimum_tokens != null) && (cb.settings.Private_for_big_sugar_daddy == 'Yes'))
{
rules_list += ("\nBe the Top Master for " + cb.settings.Private_duration_in_minutes) + " minutes and get to boss me around in a 30 min private show with the highest tip of " + cb.settings.Big_Sugar_Daddy_minimum_tokens + " or more."//rules_list += ( + cb.settings.Private_duration_in_minutes + " minutes and get to boss me around in a 30 min private show with the highest tip of " + Big_Sugar_Daddy_minimum_tokens + " or more.")
}
}
function set_notice_timer(){
switch(cb.settings.display_rules)
{
case 'Never':
notice_timer_value = (0)
break;
case 'Every 10 seconds':
notice_timer_value = (10 * 1000)
break;
case 'Every 30 seconds':
notice_timer_value = (30 * 1000)
break;
case 'Every minute':
notice_timer_value = (60 * 1000)
break;
case 'Every 2 minutes':
notice_timer_value = (2 * 60 * 1000)
break;
case 'Every 3 minutes':
notice_timer_value = (3 * 60 * 1000)
break;
case 'Every 5 minutes':
notice_timer_value = (6 * 60 * 1000)
break;
case 'Every 10 minutes':
notice_timer_value = (10 * 60 * 1000)
break;
case 'Every 15 minutes':
notice_timer_value = (15 * 60 * 1000)
break;
}
cb.chatNotice(rules_list);
cb.setTimeout(set_notice_timer, notice_timer_value)
}
function init() {
new_subject = cb.settings.room_subject
cb.log("Changing subject to: " + new_subject);
cb.changeRoomSubject(new_subject);
build_rules_list();
set_notice_timer();
}
init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.