Apps Home
|
My Uploads
|
Create an App
User Tracker APP
Author:
greymatter
Description
Source Code
Launch App
Current Users
Created by:
Greymatter
App Images
tipper_list = []; tips_list = []; var tip_total = 0; var newTop = 0; var broadcaster; var tipper; //make it so the user can customize each message? cb.settings_choices = [ //{name: 'msgonentry', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Display warning to greys on entry?"}, {name: 'set', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Type message here', label: "Set welcome message \n ex: ", required: false}, ]; opener = cb.settings['set']; cb.onEnter(function(user) { // opener is the customization made in the settings cb.sendNotice(opener + ', ' + user['user'] + '! \n Stick around and play with me, you won\'t be disappointed ;)', user['user'], '#eb9cff', '#fff', 'bolder'); }); cb.onTip(function (tip) { var tip_this_time = parseInt(tip['amount']); tip_total += parseInt(tip['amount']); broadcaster = tip['to_user']; tipper = tip['from_user']; var tip_index; // check if tipper is already in the tipper list if (tipper_list.indexOf(tipper) === -1) { tipper_list.push(tipper) tips_list.push(tip_this_time) } else { tip_index = tipper_list.indexOf(tipper) tips_list[tip_index] += tip_this_time } cb.chatNotice("Unique tippers: " + tipper_list.join(', '), broadcaster); //cb.chatNotice("Last tipper: " + tipper, broadcaster); cb.chatNotice("Tips so far: " + tip_total, broadcaster); //TODO: find highest value in the object, and then its key is the top tipper. if (!tip['from_user_tipped_recently']) { cb.sendNotice("Wow, thank you! Keep it up, stud ;)", tip['from_user']); } cb.drawPanel(); }); // define a function that finds top tip value function findTopTipper(list_of_tips, list_of_tippers, current_top_tip) { for (let tip in list_of_tips) { if (list_of_tips[tip] >= current_top_tip) { current_top_tip = list_of_tips[tip]; var topIndex = tip; } } return list_of_tippers[topIndex]; } cb.onDrawPanel(function(user) { var backgroundImage = '8533d0bf-1690-41eb-8404-726fb054a1ce'; var tipsReceived = tip_total; var lastTipReceived = tipper; var fontSize = 11; var topChamp = findTopTipper(tips_list, tipper_list, newTop) return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': 'TIPS RECEIVED', 'top': 5, 'left': 28, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', // user with highest total tips 'text': 'BEST LOVER', 'top': 29, 'left': 28, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', 'text': 'LATEST LOVER', 'top': 52, 'left': 28, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', 'text': tipsReceived, 'top': 5, 'left': 147, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', //The name of the one who has tipped the most should go here 'text': topChamp, 'top': 29, 'left': 147, 'font-size': fontSize, 'color': 'white', }, { 'type': 'text', 'text': lastTipReceived, 'top': 51, 'left': 147, 'font-size': fontSize, 'color': 'white', }, ], }; }); cb.drawPanel();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.