Apps Home
|
My Uploads
|
Create an App
sub_goal_new
Author:
philwhelp
Description
Source Code
Launch App
Current Users
Created by:
Philwhelp
App Images
//working test 2 b repeat goal test.. // topic settings tags = cb.settings.tags; RoomSubject = cb.settings.RoomSubject; ReachedSubject = cb.settings.ReachedSubject; // tippers settings var TT = 0; // total tips var TU = 0; // total Users that have tipped var HTU = "----"; // high tipper Username var HTA = 0; // high tip[er Amount var LTU = "----"; // last tipper Username var LTA = 0; // last tipper Amount var KTU = "----"; // King tipper Username var KTA = 0; // King tipper Amount tipper =[]; // tippers arr //add goals to arr goals = []; //for goal arr. GoalT = cb.settings.GoalT ? getNo(cb.settings.GoalT) : 0; // Goal type Gtype = cb.settings.Gtype ? getNo(cb.settings.Gtype) : 0; // goal sub type Ntype = cb.settings.Ntype ? getNo(cb.settings.Ntype) : 0; // Notice settings nTheme = cb.settings.nTheme ? getNo(cb.settings.nTheme) : 0; // Notice color no. Goal_Set= cb.settings.Goal_Set ? getNo(cb.settings.Goal_Set) : 0; // goal set panTheme = cb.settings.panTheme ? getNo(cb.settings.panTheme) : 0; // goal set maxDis = cb.settings.maxDis ? cb.settings.maxDis : 1; // goals to display king_val = cb.settings.king_val ?cb.settings.king_val-1 : 0; // goal set gType = (GoalT == 0) ? "Single Goal" : (GoalT == 1) ? "Repeat Goal" : (GoalT == 2) ? "Repeat Multi-Goal" : "Multi-Goal"; errMSG =''; TTG = 0; R = 0; //room subject var RS =(RoomSubject ? RoomSubject : ""); var ReachedS = (ReachedSubject ? ReachedSubject : ""); //tags settings //symbols list sym=[]; sym[0] = " \uD83E\uDDE1 "; // red heart sym[1] = " \uD83C\uDF39 "; // red rose sym[2] = "\uD83D\uDC96"; // red heart with stars sym[3] = "\uD83D\uDC98" // heart with arrow cb.settings.tags && (tags = cb.settings.tags.trim() ? cb.settings.tags : ''), (!tags || tags < 0) && (tags += ""); var e = mySplit(tags); tags = ""; for (var t = 0; t < e.length; t++) tags += "#" == e[t].substring(0, 1) ? e[t] : "#" + e[t]; for (i = 1; i <= 7; i++) { GT = ((GoalT ==3) || (GoalT == 0) || (GoalT == 1)) ? i : cb.settings['GT'+i] ? cb.settings['GT'+i] : ''; GN = cb.settings['GN'+i] ? cb.settings['GN'+i] : '' ; //goal name if ((GT && GN) || (GN && ((GoalT ==3) || (GoalT ==0)))) { a = goals.length; if (a == 0) {goals.push({gt : GT, gn : GN}); maxGT = ((GoalT == 0) || (GoalT ==3)) ? i : GT; if (GoalT < 3) {break;};} else if (GT > maxGT) {maxGT = GT; goals.push({gt : GT, gn : GN}); } else { cb.sendNotice("Goal Target "+ i +" needs to be greater than "+ cb.settings['GT'+a] +"!", cb.room_slug);} } } //goal settings apG = cb.settings['apG'] ? cb.settings['apG'] : "" ; maxG = goals.length > 0 ? goals.length-1 : -1; GTN = 0; //goal target number TGR = 0; //total goal reached MTGR = 0; // matched total goal reached lst =''; var gl = 0; var ngl = 0; reached = ''; //color settings color_theme = []; color_theme[0] = ["#000000","#FFFFFF"]; // Black and White color_theme[1] = ["#e0ccff","#dd00dd"]; // Pink color_theme[2] = ["#ccccff","#0000ff"]; // Blue color_theme[3] = ["#ffd9cc","#ff531a"]; // Orange color_theme[4] = ["#ccffdd","#00802b"]; // Green color_theme[5] = ["#e6ccff","#9933ff"]; // purple color_theme[6] = ["#ffcccc","#e60000"]; // red panbk =[]; panbk[0]= ["bdebb4b0-457b-4624-b142-b2c3dcedc3ae", "","#5c00e6","#000000"]; panbk[1]= ["0deccdfe-ec0c-45ba-a6e2-560994b9768e", "708322af-eb51-42d0-9104-34661deca3b6","#000080","#001a00"]; theme_logo = cb.settings.theme_logo ? cb.settings.theme_logo : "8a1db540-aed0-4547-8331-c52352fde4b7"; // theme logo cb.settings_choices = [ {name:'t2', label: "------------ Notice & Subject Settings ------------", type:'choice', required: false}, {name: 'RoomSubject', required: false, label: "Room Subject (## = posistion of the goal goal).", type: 'str', minLength: 1, maxLength: 255, required: false, defaultValue: 'Welcome to my room:'}, {name: 'ReachedSubject', label: "Subject when all goals are reached", type: 'str', minLength: 1, maxLength: 255, required: false, defaultValue: 'Thank you all , for helping me reach my goal.'}, { name: "tags", label: "Tags (#) ", type: "str", minLength: 1, maxLength: 120, required: true, defaultValue: "Lovense" }, {name:'Ntype', label: "show in notice when tipped.", type:'choice', choice1:'0 - do not show', choice2:'1 - show all goals', choice3:'2 - only when Goal target is reached', defaultValue:'0 - show all goals'}, {name:'nTheme', label: "Notice color when tipped.", type:'choice', choice1:'0 - Black and white', choice2:'1 - Pink', choice3:'2 - blue', choice4:'3 - Orange', choice5:'4 - Green', choice6:'5 - Purple', choice7:'6 - Red', defaultValue:'0 - show all goals'}, {name:'Gtype', label: "change topic for.", type:'choice', choice1:'0 - do not show', choice2:'1 - all tips', choice3:'2 - all goals', choice4:'3 - only when Goal target is reached', defaultValue:'0 - all tips'}, {name: 'maxDis',required: false, label: "max goals to display in topic(goal target only)", type:'int', minValue:1, maxValue:6, defaultValue: 2}, {name:'Goal_Set', label: "Style for the goal in topic.", type:'choice', choice1:"0 - style 1(goal type - 'goal'[goal(s) amount])" , choice2:"1 - style 2 ('goal'[goal(s) amount])", choice3:"2 - multi style (works better for reached targets)", defaultValue:"0 - style 1(goal type - 'goal'[goal(s) amount])"}, {name:'t1',required: false, label: "-------------------- Goal Settings --------------------", type:'choice'}, {name:'GoalT', label: "What type of goal?", type:'choice', choice1:'0 - single goal(goal 1 only)', choice2:'1 - repeated-single goal(goal 1 only)', choice3:'2 - repeated-multi goal(goal 1 only)', choice4:'3 - multi single goal(goals targets = 1)', choice5:'4 - multi goal(all goals & targets)', defaultValue:'0 - single goal(goal 1 only)'}, {name:'apG', label: "Amount per Goal", type:'int', minValue:1, maxValue:99999, defaultValue: 100}, {name:'GT1', label: "Number of goals needed for Goal target 1", type:'int', minValue:1, maxValue:99999, defaultValue: 1}, {name: 'GN1', label: "Goal target 1 is when goals reach", type: 'str', minLength: 1, maxLength: 255, defaultValue: "topless"}, {name:'GT2',required: false, label: "Number of goals needed for Goal target 2", type:'int', minValue:1, maxValue:99999}, {name: 'GN2',required: false, label: "Goal target 2 is when goals are reach", type: 'str', minLength: 1, maxLength: 255}, {name:'GT3', required: false, label: "Number of goals needed for Goal target 3", type:'int', minValue:1, maxValue:99999}, {name: 'GN3', required: false, label: "Goal target 3 is when goals are reach", type: 'str', minLength: 1, maxLength: 255}, {name:'GT4', required: false, label: "Number of goals needed for Goal target 4", type:'int', minValue:1, maxValue:99999}, {name: 'GN4', required: false, label: "Goal target 4 is when goals are reach", type: 'str', minLength: 1, maxLength: 255}, {name:'GT5', required: false, label: "Number of goals needed for Goal target 5", type:'int', minValue:1, maxValue:99999}, {name: 'GN5', required: false, label: "Goal target 5 is when goals are reach", type: 'str', minLength: 1, maxLength: 255}, {name:'GT6', required: false, label: "Number of goals needed for Goal target 6", type:'int', minValue:1, maxValue:99999}, {name: 'GN6', required: false, label: "Goal target 6 is when goals are reach", type: 'str', minLength: 1, maxLength: 255}, {name:'GT7', required: false, label: "Number of goals needed for Goal target 7", type:'int', minValue:1, maxValue:99999}, {name: 'GN7', required: false, label: "Goal target 7 is when goals are reach", type: 'str', minLength: 1, maxLength: 255}, {name:'t3', label: "----------------- Panel Setting -----------------", type:'choice', required: false}, {name:'panTheme', label: "Panel theme", type:'choice', choice1:'0 - plain', choice2:'1 - nature 1', defaultValue: '0 - plain'}, {name: 'theme_logo', required: false, label: "Theme logo id (leave blank for default)", type: 'str'}, {name:'panCSet', label: "Color schema.", type:'choice', choice1:'0 - Default colors', choice2:'1 - custom colors', defaultValue:'0 - Default colors'}, {name: 'themeC1', required: false, label: "custom color 1 (default = #333333)", type: 'str', minLength: 7, maxLength: 7}, {name: 'themeC2', required: false, label: "custom color 2 (default = #0000cc)", type: 'str', minLength: 7, maxLength: 7}, {name:'king_val',required: false, label: "tokens needed to be king", type:'int', minValue:1, maxValue:99999, defaultValue: 100}, {name: 'lovense', label: "--------------Lovense text settings---------------", type:'choice', required: false,}, {name: 'lovense_options', label: "Lovense options colors(back color/text color)", type: 'str', minLength: 7, maxLength: 15, required: true, defaultValue: '#e0ccff/#8A2BE2'}, {name: 'lovense_active', label: "Lovense colors when tipped(back color/text color)", type: 'str', minLength: 7, maxLength: 15, required: true, defaultValue: '#ffccff/#660066'}, ]; function mySplit(e) { return e.trim().replace(/\s+/g, " ").split(" ") } function getNo(ST) { var str = ST ? ST : ''; var res = str.match(/[0-9][0-9]{0,4}/g)[0]; return res; } ngt = ((GoalT == 1) || (GoalT == 2)) ? goals[0].gt : 0; function smGoal(X) { if (maxG == -1) {return;} X ? X : 0; TTG += X; lst =''; lst2 =''; maxGT = ((GoalT == 1) || (GoalT == 2)) ? goals[0].gt : goals[maxG].gt; gt = ((GoalT == 1) || (GoalT == 2)) ? goals[0].gt : goals[GTN].gt; gn = ((GoalT == 1) || (GoalT == 2)) ? goals[0].gn : goals[GTN].gn; if ((TTG >= apG) && (maxGT > TGR)) { TTG-=apG; TGR++;} else if (maxGT <= TGR) { TTG = apG;} //-- new if ((TGR == maxGT) && ((GoalT == 1) || (GoalT == 2))) { maxGT += ngt; goals[0].gt = maxGT; } //--new end if (TGR > MTGR) { MTGR++; if (TGR == maxGT) {lst = "All goals have been reached!!! "; reached = "yes"; gl= 3; ngl= 3;} else if (MTGR < maxGT) { if (TGR == gt) { gl= 3; ngl= 3; lst = "goal #" +TGR + " reached time for (" + gn + ")"; if ((GoalT != 1) || (GoalT != 2)) {GTN++;}} else { ngl = (gl > 2) ? gl : 2; gl = 2; rst = gt-TGR; lst = "goal #" +TGR + " reached.."+ rst + " goal needed for..(" + gn + ")";} } if (lst) { if (gl == 3) {lst = "************************** \n" + lst + "\n**************************";} if (((gl == 3) && (Ntype == 2)) ||(Ntype == 1)) {cb.sendNotice(lst,'', color_theme[nTheme][0], color_theme[nTheme][1], "bold");} } smGoal(0); return; } req = (Gtype == 1) ? gt-TGR-1: gt-TGR; ned = apG-TTG; if ( ((Gtype != 0) &&( R == 0)) || ((Gtype == 0) && (TT == 0)) ){runTopic();} desG(); //get percentage pro_C(percent number) and Gbar(goal percent bar) if ((TGR == maxGT) &&((GoalT == 0) || (GoalT == 3) || (GoalT == 4)) ) { TGRN = TGR ;} else {TGRN = TGR+1;} cb.drawPanel(); //end } function runTopic() { gts = (((GoalT == 1) || (GoalT == 2)) && (ngt ==1)) ? "" : gt; S = (req > 1) ? "s" : ""; SS = (ned > 1) ? "s" : ""; gsReq = (req == 0) ? "" : ((Goal_Set == 0) || (Goal_Set == 1)) ? req + " Goal"+S+" &" : req; gSet = []; gSet[0] = [gType +": '"+gn+"'["+gsReq+" " + ned +" token"+SS+" left]",gType + ": '"+gn+"'["+req+" Goal"+S+" left]",gType + ": '"+tGoals(0,"/", "@g", "N")]; gSet[1] = ["'"+gn+"'["+gsReq+" " + ned +" token"+SS+" left]","'"+gn+"'["+req+" Goal"+S+" left]",tGoals(1,"|", "@g", "Y")]; gSet[2] = ["'"+gn+"'["+gsReq+" " + ned +" token"+SS+" left]","'"+gn+"'["+req+" Goal"+S+" left]",tGoals(2,"|", "@Goal ", "N")]; tSet = gSet[Goal_Set][Gtype-1]; goal =''; sub = ''; if (Gtype == 2) { if (ngl > 1) { gl = 1; ngl = 1;} else if (TT > 0) {return;} } else if (Gtype == 3) { if (ngl > 2) { gl = 1; ngl = 1;} else if (TT > 0) {return;} } if (reached && R == 0) {R++} else if (R == 0) {goal = tSet;} ck = RS.includes("##"); sub = ((TT == 0) && (Gtype == 0)) ? RS+tags : ((goal) && (ck == true)) ? RS.replace("##", goal) + tags : RS + " "+ goal+tags; if (R == 1) {cb.changeRoomSubject(ReachedS+tags);} else if (sub) {cb.changeRoomSubject(sub);} } // on tip settings cb.onTip(function(tip) { if(tipper[tip.from_user] == null) {tipper[tip.from_user] = tip.amount;} else {tipper[tip.from_user] += tip.amount;} if (tipper[tip.from_user] > KTA) { if (tipper[tip.from_user] > king_val) { KTA = tipper[tip.from_user]; KTU = tip.from_user;} } TT += tip.amount; LTA = tip.amount; LTU = tip.from_user; if (tip.amount > HTA) { HTA = tip.amount; HTU = tip.from_user; } smGoal(tip.amount); }); // for procent bar in goal panel function desG() { Gbar =''; pro = TTG/apG*100; pro = pro.toFixed(0); pro_C = Math.floor((pro)/5)*5; pro_full = Math.floor(pro_C/10); pro_half = Math.ceil(pro_C/10)-pro_full; pro_empty =10-pro_full-pro_half; for (i = 0; i < pro_full; i++) {Gbar += '\u2605\u2004';} for (i = 0; i < pro_half; i++) {Gbar += '\u272F\u2004';} for (i = 0; i < pro_empty; i++) {Gbar += '\u2730\u2004';} } var sNo = 0; // switcher number var panN = 0; panCSet = cb.settings.panCSet ? getNo(cb.settings.panCSet) : 0; // panel set themeC1 = cb.settings.themeC1 ?cb.settings.themeC1 : "#333333"; themeC2 = cb.settings.themeC2 ? cb.settings.themeC2 : "#0000cc"; txt1 = (panCSet == 0) ? panbk[panTheme][2] : themeC1 ; txt2 = (panCSet == 0) ? panbk[panTheme][3] : themeC2; samp ={}; function switcher() { sNo++ sNo %= 3; if (sNo == 0) { panN++ panN %= 3 } cb.drawPanel(); cb.setTimeout(switcher, 4000); } cb.onDrawPanel(function(user) { HTKT = []; HTKT[0] = (KTU == "----") ? [sym[2]+" My King "+sym[2], '', ''] : [sym[2]+" My King "+sym[2], KTU, KTA+"tks"]; HTKT[1] = (HTU == "----") ? [sym[3]+" My Best Lover "+sym[3], '', ''] : [sym[3]+" My Best Lover "+sym[3], HTU, HTA+"tks"]; HTKT[2] = (LTU == "----") ? [sym[0]+" My Last Lover "+sym[0], '', ''] : [sym[0]+" My Last Lover "+sym[0], LTU, LTA+"tks"]; return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': panbk[panTheme][0]}, {'type': 'image', 'fileID': theme_logo, 'top' : 1, 'left' : 1}, { 'type': 'text', 'text': HTKT[panN][0], 'top': 3, 'left': 118, 'width' : 150, 'text-align': 'center', 'font-size': 11, 'font-weight' : 'bold', 'color': txt1, }, { 'type': 'text', 'text': HTKT[panN][1], 'top': 19, 'left': 118, 'width' : 90, 'text-align': 'left', 'font-size': 11, 'font-weight' : 'bold', 'color': txt2, }, { 'type': 'text', 'text': HTKT[panN][2], 'top': 19, 'left': 210, 'width' : 50, 'text-align': 'right', 'font-size': 11, 'font-weight' : 'bold', 'color': txt1, }, { 'type': 'text', 'text': 'Goal '+ TGRN+ ':', 'top': 37, 'left': 6, 'width' : 50 , 'text-align': 'left', 'font-size': 11, 'font-family': 'Arial', 'font-weight' : 'bold', 'color': txt1, }, { 'type': 'text', 'text': TTG +' / ' + apG + ' ['+ ned + ' Remaining]', 'top': 37, 'left': 56, 'width' : 208 , 'text-align': 'center', 'font-size': 11, 'font-family': 'Arial', 'font-weight' : 'bold', 'color': txt2, }, { 'type': 'text', 'text': 'Progress:', 'top': 54, 'left': 6, 'width' : 60 , 'text-align': 'left', 'font-size': 11, 'font-family': 'Arial', 'font-weight' : 'bold', 'color': txt1, }, { 'type': 'text', 'text': Gbar, 'top': 53, 'left': 66, 'width' : 148 , 'text-align': 'center', 'font-size': 11, 'font-family': 'Arial', 'font-weight' : 'bold', 'color': txt2, }, { 'type': 'text', 'text': pro + "%", 'top': 54, 'left': 216, 'width' : 50 , 'text-align': 'center', 'font-size': 11, 'font-family': 'Arial', 'font-weight' : 'bold', 'color': txt1, }, {'type': 'image', 'fileID': panbk[panTheme][1]}, ], };} ); function C_split(s,v) { if (s) { res = s.split("\/") [v]; return res;} else {return;} } cb.onMessage(function (msg) { str = msg.m; if ((str.includes("------")) && (msg.user == cb.room_slug)){ msg.background = C_split(cb.settings.lovense_options, '0'); msg.c = C_split(cb.settings.lovense_options,'1'); msg.f = "Arial Black"; } if ((str.includes("******")) && (msg.user == cb.room_slug)){ msg.background = C_split(cb.settings.lovense_active, '0'); msg.c = C_split(cb.settings.lovense_active, '1'); msg.f = "Arial Black";} if ((str.includes("!addGoal")) && (msg.user == cb.room_slug)){ addGoal(str); } if ((str.includes("!loadTopic")) && (msg.user == cb.room_slug)){ runTopic(); } if ((str.includes("!gList")) && (msg.user == cb.room_slug)){ listGoals(); } return msg; }); function addGoal(ST) { errMSG =""; if (maxG == -1) {return;} if ((GoalT == 1) || (GoalT == 2)) {errMSG = "you can not add goals in repeat mode";} nub = ((GoalT == 0) || (GoalT == 3)) ? maxGT+1 : ST.match(/[1-9][0-9]{0,3}/g)[0] ? ST.match(/[1-9][0-9]{0,3}/g)[0] : maxGT+1; if ((GoalT == 4) && (maxGT >= nub)) {errMSG = "the goal target needs to be greater than" + maxGT;} else { var nub_length = nub.length; var nub_pos = ST.indexOf(nub); n_str = ST.match(/[1-9][0-9]{0,3}/g) ? ST.slice(nub_pos+nub_length+1) : ST.slice(9); } if (errMSG) {return cb.sendNotice(errMSG, cb.room_slug);} else { goals.push({gt : nub, gn : n_str}); maxG ++; maxGT = nub; if (TTG >= apG) { GTN++; TTG-=apG; gl= 3; ngl= 3; R = 0; reached = ""; smGoal(0); } return cb.sendNotice("(@ Goal "+ nub + "= " + n_str + ") has been added to the goals", cb.room_slug); } } function listGoals() { if (goals.length == 0) {return;} gList = ""; SGTN = ((GoalT == 1) || (GoalT == 2)) ? 0 : GTN; var xNo; GX = 0 if (TGR < maxGT) { for (xNo = SGTN; xNo < goals.length; xNo++) { GX++ curr = GX == 1 ? "(current Goal)" : "" ; gList += "\n "+GX+") @Goal "+goals[xNo].gt + ": "+ goals[xNo].gn + curr; } } if (gList) {cb.sendNotice("Your Goals that are available: "+ gList, cb.room_slug);} else {cb.sendNotice("Please add more Goals to continue.", cb.room_slug);} } function tGoals(Da, Dc, Dd, Sw) { tList = ""; SGTN = ((GoalT == 1) || (GoalT == 2)) ? 0 : GTN; NSGTN = goals.length <= SGTN+maxDis ? goals.length : SGTN+maxDis; var xNo; if ((TGR < maxGT) && (Goal_Set == Da) && (GoalT == 4)) { for (xNo = SGTN; xNo < NSGTN; xNo++) { if (Sw == "Y") {tList += goals[xNo].gn + " " +Dd +goals[xNo].gt; } else {tList += Dd +goals[xNo].gt + ": "+ goals[xNo].gn;} if (xNo+1 < NSGTN) {tList += Dc;} } } return tList; } switcher(); smGoal(0); listGoals();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.