Apps Home
|
Create an App
dod-Bug001
Author:
dod404
Description
Source Code
Launch App
Current Users
Created by:
Dod404
//Short Description: // ** dev in progress ;) ** //Full Description // intend to track a full history of current show for broadcaster stats // pb : I just don't see howto save datas xD cb.settings_choices seems a good place, but... //commands // /tipshow -> display 1 line to copy/past in 'higher and last...' before next start // /tiphist -> display 1 line to copy/past in 'full history...' before next start // /tipnice -> display nicely the current tip history board // this shows all visitors during the show in nice format // Broadcaster is included in visitors, so a output can be like the following : // ---------------------------------------------------------------------------- // Username | Tipped this session | Tipped total | % presence in total show | // ---------------------------------------------------------------------------- // *myself* | -3256 | -53125 | 100% | // myfan | 1100 | 12200 | 100% | // mymod | 250 | 1900 | 95% | // nicetipper | 925 | 3200 | 33% | // greyasshole| 0 | 0 | 46% | // 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 users = [ {name: cb.room_slug , // broadcaster always present in stats tips: 0, // tipped this session (will be negative for room_slug) totalTips : 0, // "" idem for all sessions logged showsCount:0 // number of shows played/visited in that log },] cb.settings_choices = [ {name:'highlast', type:'str', required: false, label:'higher and last (set to empty to reset display)', default_value:'' }, {name:'histo', type:'str', required: false, label:'full history (set to empty to reset history)', default_value:''}, ]; cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Tips Received :', 'row1_value': '' + total_tipped, 'row2_label': 'Higher tip :', 'row2_value': high_tip_amount + format_username(high_tip_username), 'row3_label': 'Last tip :', 'row3_value': last_tip_amount + format_username(last_tip_username) }; }); // handlers cb.onTip(function(tip) { total_tipped += tip['amount'] 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'] } var userLog = users[last_tip_username] if (userLog){ users[last_tip_username] += last_tip_amount }else{ users += {last_tip_username,last_tip_amount} } cb.drawPanel(); histHighLast(); }); function format_username(val) { if (val === null) { return "--"; } else { return ' ' + val.substring(0, 20); } }; function reset(){ total_tipped = 0 last_tip_amount = 0 last_tip_username = '' high_tip_amount = 0 high_tip_username = '' }; function histHighLast(){ // total_tipped,high_tip_username,high_tip_amount,last_tip_username,last_tip_amount var HL = total_tipped HL += ',' HL += high_tip_username HL += ',' HL += high_tip_amount HL += ',' HL += last_tip_username HL += ',' HL += last_tip_amount HL += ',' cb.settings.highlast = HL }; function init() { if (cb.settings['highlast'] == '') { reset() }else{ total_tipped = 9 last_tip_amount = 1 last_tip_username = 'sweet_family19' high_tip_amount = 5 high_tip_username = 'sweet_family19' } histHighLast() } init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.