Apps Home
|
Create an App
testy101
Author:
markus1987test111
Description
Source Code
Launch App
Current Users
Created by:
Markus1987test111
cb.settings_choices = [ {name: "goalUsers", type:"int", minValue: 1, maxValue: 999, defaultValue: 10, label: "Number of user to reach repeated goal"}, {name: "goalMax", type:"int", minValue: 1, maxValue: 999, defaultValue: 10, label: "Number of repeated goals to reach final goal"}, {name: "RepGoalText", type:"str", minLength:1, maxLength:255, label:"Repeated gaol", defaultValue:"", required:false}, {name: "FinalGoalText", type:"str", minLength:1, maxLength:255, label:"Final goal", defaultValue:"", required:false}, {name: "HashtagText", type:"str", minLength:1, maxLength:255, label:"Hashtags", defaultValue:"", required:false}, ]; var counter = 0; var currentGoal = 0; var arrayCount = -1; var missing = 0; var change = 0; var addUser = false; var goalUsers = cb.settings.goalUsers; var RepGoalText = cb.settings.RepGoalText; var FinalGoalText = cb.settings.FinalGoalText; var HashtagText = cb.settings.HashtagText; var goalMax = cb.settings.goalMax; var finalGoalR = false; var goalR = false; var endfor = 0; var new_subject = ""; var visitors = []; cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'User until goal reached', 'row1_value': missing + ' user', 'row2_label': 'Missing goals 4 final goal', 'row2_value': goalMax - currentGoal, 'row3_label': 'Final goal', 'row3_value': FinalGoalText }; }); cb.onEnter(function(user) { if (goalR == false) { checkEntry(user); } }); function checkEntry(user) { addUser = true; for (var i=0; i<=arrayCount; i++) { if (visitors[i]["name"] == user["user"]) { addUser = false; cb.sendNotice("Welcome back, " + user["user"]); } } if (addUser == true) { arrayCount++; visitors[arrayCount] = new Object (); visitors[arrayCount]["name"] = user["user"]; counter = counter+1; missing = goalUsers - counter; cb.sendNotice("Debug: checkEntry") if (missing < 1 ) { missing = 0; counter = 0; goalReached(); } else { setStatus(); cb.sendNotice(progressBar()); } cb.drawPanel(); } } function goalReached() { if (goalR == false) { if (currentGoal == goalMax) { finalGoalReached(); } else { progressBar(); cb.sendNotice("****************", "", "#A4A4A4", "#0B0B61", "bold"); cb.sendNotice("Goal reached: " +RepGoalText, "", "#FFFFFF", "#0B0B61", "bold"); cb.sendNotice("****************", "", "#A4A4A4", "#0B0B61", "bold"); missing = goalUsers; currentGoal++; } setStatus(); } } function finalGoalReached() { goalR = true; progressBar(); cb.changeRoomSubject("!!! FINAL GOAL REACHED !!! ("+FinalGoalText+")"); cb.sendNotice("****************", "", "#2E2E2E", "#FFFFFF", "bold"); cb.sendNotice("~~ FINAL GOAL REACHED! ~~ ("+FinalGoalText+") ", "", "#2E2E2E", "#FFFFFF", "bold"); cb.sendNotice("****************", "", "#2E2E2E", "#FFFFFF", "bold"); missing = 0; } function setStatus() { if (currentGoal == goalMax) { if (finalGoalR == false) { new_subject = "FINAL GOAL: " + FinalGoalText + " " + HashtagText; cb.changeRoomSubject(new_subject); finalGoalR = true; } } } function round(value, decimals) { return Number(Math.round(value+"e"+decimals)+"e-"+decimals); } function progressBar() { var countBar = ""; var countBars = ""; var countProgress = ""; var countPercenty = ""; var countPercent = ""; var countPercentInt = ""; var countLeft = ""; if (counter > goalUsers) { countPercent = 100; } else { countPercent = round((counter/goalUsers)*100,2); } countPercentInt = parseInt(countPercent,10); // 10 countLeft = (goalUsers - counter); var countBars = { g00 : "\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g05 : "\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g10 : "\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g15 : "\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g20 : "\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g25 : "\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g30 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g35 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g40 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g45 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g50 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g55 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g60 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g65 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592\u2592", g70 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592\u2592", g75 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592\u2592", g80 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592\u2592", g85 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592\u2592", g90 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592\u2592", g95 : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2592", gxx : "\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593", }; // Expand to be more detailed. if (countPercentInt < 5) { countBar = countBars.g00; } else if (countPercentInt < 10) { countBar = countBars.g05; } else if (countPercentInt < 15) { countBar = countBars.g10; } else if (countPercentInt < 20) { countBar = countBars.g15; } else if (countPercentInt < 25) { countBar = countBars.g20; } else if (countPercentInt < 30) { countBar = countBars.g25; } else if (countPercentInt < 35) { countBar = countBars.g30; } else if (countPercentInt < 40) { countBar = countBars.g35; } else if (countPercentInt < 45) { countBar = countBars.g40; } else if (countPercentInt < 50) { countBar = countBars.g45; } else if (countPercentInt < 55) { countBar = countBars.g50; } else if (countPercentInt < 60) { countBar = countBars.g55; } else if (countPercentInt < 65) { countBar = countBars.g60; } else if (countPercentInt < 70) { countBar = countBars.g65; } else if (countPercentInt < 75) { countBar = countBars.g70; } else if (countPercentInt < 80) { countBar = countBars.g75; } else if (countPercentInt < 85) { countBar = countBars.g80; } else if (countPercentInt < 90) { countBar = countBars.g85; } else if (countPercentInt < 95) { countBar = countBars.g90; } else if (countPercentInt < 100) { countBar = countBars.g95; } else if (countPercentInt >= 100) { countBar = countBars.gxx; } if (countPercent<0) { countPercent = 0; } countProgress = countBar+" ("+countPercent+"%)"; /* var debug = "\n DEBUG: "; debug += "\n counter: "+counter; debug += "\n goalUsers: "+goalUsers; debug += "\n countPercenty: "+countPercenty; debug += "\n countPercent: "+countPercent; debug += "\n countPercentInt: "+countPercentInt; debug += "\n countLeft: "+countLeft; debug += "\n countBars: "+countBars; debug += "\n countBar: "+countBar; debug += "\n countProgress: "+countProgress+"\n"; cb.sendNotice(debug); */ return countProgress; } function init() { missing = goalUsers; currentGoal = 1; new_subject = "Next goal: " + RepGoalText + " " + HashtagText; cb.changeRoomSubject(new_subject); cb.drawPanel(); cb.sendNotice(progressBar()); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.