Apps Home
|
Create an App
not ready
Author:
brd2dth2
Description
Source Code
Launch App
Current Users
Created by:
Brd2dth2
// Tip Timer! // Tip to keep the show going. // by Leighton var remaining_time = 0; var running_time = 0; cb.settings_choices = [ {name: 'preshow_time', type: 'int', minValue: 1, maxValue: 32767, label: "Length of 'pre-show' in minutes:"}, {name: 'tokens_per_min', type: 'int', minValue: 1, maxValue: 32767, label: "Tokens to extend showtime by 1 minute:"}, {name: 'reminder', type: 'int', minValue: 1, maxValue: 32767, label: "Time between topic updates in minutes:"}, {name: 'sudden_death', type: 'int', minValue: 1, maxValue: 32767, label: "When to start the minute by minute countdown:"} ]; function update_subject() { if (remaining_time < cb.settings.sudden_death) { var new_subject = 'Tip to keep the show going. Show ends in less than ' + remaining_time + ' minutes unless you tip ' + cb.settings.tokens_per_min + '!'; } else { var new_subject = 'Tip to keep the show going. Show ends in ' + remaining_time + ' minutes unless you tip ' + cb.settings.tokens_per_min + '!'; } cb.changeRoomSubject(new_subject); } cb.onTip(function (tip) { remaining_time += Math.floor( parseInt(tip['amount']) / cb.settings.tokens_per_min ); cb.chatNotice("~~~~ Time Left: " + remaining_time + " ~~~~"); update_subject(); cb.chatNotice(tip); }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Time Remaining:', 'row1_value': remaining_time, 'row2_label': 'Tokens per Minute', 'row2_value': cb.settings.tokens_per_min, 'row3_label': 'Running Time:', 'row3_value': running_time }; }); function countdown() { running_time++; remaining_time--; cb.drawPanel(); if (remaining_time <= 0 ) { var new_subject = 'Time\'s Up!'; cb.changeRoomSubject(new_subject); cb.chatNotice("~~~~ Time's Up! ~~~~"); } else { if (remaining_time > cb.settings.sudden_death) { if ( !(remaining_time % cb.settings.reminder) ) { update_subject(); } } else { update_subject(); } } cb.setTimeout(countdown, 60000); } function init() { cb.setTimeout(countdown, 60000); remaining_time =+ cb.settings.preshow_time; update_subject(); } init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.