Apps Home
|
My Uploads
|
Create an App
AutoResetGoal_panelLayout
Author:
zabelbaby
Description
Source Code
Launch App
Current Users
Created by:
Zabelbaby
App Images
// vars var current_goal_tipped = 0; var backgroundImage = '7e004278-1037-486a-bb0f-241bfd232976'; var row1_label = 'Received/Goal: '; var row1_value = ''; var row2_label = 'Highest Tip: '; var row2_value = ''; var row3_label = 'Latest Tip Received: '; var row3_value = ''; var fontSize = 11; var kingTipName = ''; var kingTipAmount = 0; var lastestTipAmount = 0; var latestTipName = ''; cb.settings_choices = [ {name: 'tokens', type: 'int', minValue: 1, default: 100}, {name: 'goal_description', type: 'str', minLength: 1, maxLength: 255} ]; // handlers cb.onTip(function(tip) { current_goal_tipped += tip['amount']; if (current_goal_tipped == cb.settings.tokens) { current_goal_tipped -= cb.settings.tokens; } update_subject(); lastestTipAmount = tip['amount'] latestTipName = tip['from_user'] if(lastestTipAmount > kingTipAmount) { kingTipAmount = lastestTipAmount; kingTipName = latestTipName; } cb.drawPanel(); }); cb.onDrawPanel(function(user) { row1_value = '' + current_goal_tipped + ' / ' + cb.settings.tokens; row2_value = kingTipName; row3_value = latestTipName; return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': row1_label, 'top': 5, 'left': 61, 'font-size': fontSize, 'color': 'orange', }, { 'type': 'text', 'text': row2_label, 'top': 29, 'left': 73, 'font-size': fontSize, 'color': 'orange', }, { 'type': 'text', 'text': row3_label, 'top': 52, 'left': 28, 'font-size': fontSize, 'color': 'orange', }, { 'type': 'text', 'text': row1_value, 'top': 5, 'left': 147, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', 'text': row2_value, 'top': 29, 'left': 147, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', 'text': row3_value, 'top': 51, 'left': 147, 'font-size': fontSize, 'color': 'white', } ] }; }); // Functions function refresh() { cb.log("Refresh called"); cb.setTimeout(refresh, 20000); cb.drawPanel(); } function update_subject() { var new_subject = cb.settings.goal_description + " [" + tips_remaining() + " tokens remaining]"; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } function tips_remaining() { var r = cb.settings.tokens - current_goal_tipped; if (r < 0) { return 0; } else { return r; } } function init() { update_subject(); } init(); cb.setTimeout(refresh, 20000);
© Copyright Chaturbate 2011- 2026. All Rights Reserved.