Apps Home
|
Create an App
Multi Goals By Goals
Author:
everlast_69
Description
Source Code
Launch App
Current Users
Created by:
Everlast_69
// Variables var subjectTags; var numberofEntries = 15; var currentGoalnum = 0; var goalsforPrize = 0; var currentPrizenum = 1; var tokenstoGoal = 0; var totalTokens = 0; var repeatGoal = false; var current_goal_tipped = 0; var prizes = []; var currentPrize = ""; var goalsforSubject = ""; cb.settings_choices = [ {name: 'goaltokens', type: 'int', minValue: 1, defaultValue: 25, label:"Tokens For Goal", required: true}, {name: 'hashtab', type: 'str', minLength: 1, maxLength: 255, label: "Additional subject items", defaultValue: "#pussy, #cum,#tits"}, {name: 'goalformat', type: 'str', minLength: 1, maxLength: 1, label: "Prize format is '#:prize' where the # is the number of goals. The number can be exact as 10 or relative as +10. Exact means prize at this many goals. Relative is prize at +# of goals after last prize.", required: false}, {name: 'prize1', type: 'str', minLength: 1, maxLength: 255, label: "Prize 1", defaultValue: "5:flash tits", required: true}, {name: 'prize2', type: 'str', minLength: 1, maxLength: 255, label: "Prize 2", defaultValue: "+5:flash ass", required: false}, {name: 'prize3', type: 'str', minLength: 1, maxLength: 255, label: "Prize 3", defaultValue: "20:flash pussy", required: false}, {name: 'prize4', type: 'str', minLength: 1, maxLength: 255, label: "Prize 4", defaultValue: "", required: false}, {name: 'prize5', type: 'str', minLength: 1, maxLength: 255, label: "Prize 5", defaultValue: "", required: false}, {name: 'prize6', type: 'str', minLength: 1, maxLength: 255, label: "Prize 6", defaultValue: "", required: false}, {name: 'prize7', type: 'str', minLength: 1, maxLength: 255, label: "Prize 7", defaultValue: "", required: false}, {name: 'prize8', type: 'str', minLength: 1, maxLength: 255, label: "Prize 8", defaultValue: "", required: false}, {name: 'prize9', type: 'str', minLength: 1, maxLength: 255, label: "Prize 9", defaultValue: "", required: false}, {name: 'prize10', type: 'str', minLength: 1, maxLength: 255, label: "Prize10!", defaultValue: "", required: false}, {name: 'prize11', type: 'str', minLength: 1, maxLength: 255, label: "Prize 11", defaultValue: "", required: false}, {name: 'prize12', type: 'str', minLength: 1, maxLength: 255, label: "Prize 12", defaultValue: "", required: false}, {name: 'prize13', type: 'str', minLength: 1, maxLength: 255, label: "Prize 13", defaultValue: "", required: false}, {name: 'prize14', type: 'str', minLength: 1, maxLength: 255, label: "Prize 14", defaultValue: "", required: false}, {name: 'prize15', type: 'str', minLength: 1, maxLength: 255, label: "Prize 15", defaultValue: "", required: false} ]; // Handlers cb.onTip(function(tip){ totalTokens += tip['amount']; current_goal_tipped += tip['amount'] if (current_goal_tipped >= tokenstoGoal) { goalReached(tip['from_user']); } }); cb.onDrawPanel(function(user) { if (currentPrizenum == 1) { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Remaining):', 'row1_value': '' + currentGoalnum + ' / ' + goalsforPrize + ' (' + (goalsforPrize - currentGoalNum) + ')', 'row2_label': 'Hit Goal For:', 'row2_value': '' + currentPrizenum - 1 + ' times', 'row3_label': 'Last Reached:', 'row3_value': 'Never' }; } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Remaining):', 'row1_value': '' + currentGoalnum + ' / ' + goalsforPrize + ' (' + (goalsforPrize - currentGoalNum) + ')', 'row2_label': 'Prize Hit For:', 'row2_value': '' + currentPrizenum - 1 + ' times', 'row3_label': 'Last Reached:', 'row3_value': '' + Math.floor(((new Date()).getTime() - last_time_goal_reached.getTime()) / 60000) + ' minutes ago' }; } }); // Functions function makegoalsforSubject() { goalsforSubject = "@" + goalsforPrize + ":" + currentPrize; for (i = currentPrizenum - 1; i < prizes.length; i++) { var y = prizes[i] + " "; var z = y.split(":"); goalsforSubject += ";@" + z[0] + ":" + z[1]; } cb.log(goalsforSubject); } function refresh() { cb.log("Refresh called"); cb.setTimeout(refresh, 20000); cb.drawPanel(); } function update_subject() { } function goalReached(user) { cb.log("goal Reached"); } function build_prizes_array() { for (i = 1; i < numberofEntries + 1;i++) { if (eval("cb.settings.prize" + i) != "") { prizes.push(eval("cb.settings.prize" + i)); } } subjectTags = cb.settings.hashtab; cb.log(prizes.length); for (i = 0; i < prizes.length; i++) { cb.log(prizes[i]); } } function set_next_prize(i) { var x ; var y ; y = prizes[i-1] + " "; x = y.split(":"); // y[0] = number of goals // y[1] = prize. cb.log("Next Prize"); cb.log(x[0] + " " + x[1]); if (x[0].startsWith("+")) { z = x[0].substring(1); goalsforPrize += z; }else{ goalsforPrize += x[0]; } currentPrize = x[1]; cb.log(":current goal " + goalsforPrize + ":" + currentPrize); } function init() { build_prizes_array(); currentPrizenum = 1; set_next_prize(currentPrizenum); makegoalsforSubject(); } init(); cb.setTimeout(refresh, 20000);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.