Apps Home
|
My Uploads
|
Create an App
sub2 goal
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 LTGR = "never"; //last_time_goal_reached 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 king_val = cb.settings.king_val ?cb.settings.king_val-1 : 0; // goal set gType = (GoalT == 0) ? "Single Goal" : (GoalT == 1) ? "Repeat Goal" : "Multi-Goal"; 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++) { GN = cb.settings['GN'+i] ? cb.settings['GN'+i] : '' ; //goal name GA = cb.settings['GA'+i] ? cb.settings['GA'+i] : '' ; //goal amount if (GN && GA) { a = goals.length; if ( (((GoalT == 0) || (GoalT == 1)) && (a == 0)) || (GoalT == 2)) { goals.push({gn : GN, ga : GA}); } } } //goal settings maxG = goals.length > 0 ? goals.length : 0; 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]= ["19e37409-4159-473a-9bda-d8a510e37bf3", "","#5c00e6","#000000"]; panbk[1]= ["bdb7f85b-053d-4276-a75c-f884a0733689", "5f300e3b-97a7-4c2a-a199-f47931f412ba","#000080","#001a00"]; theme_logo = cb.settings.theme_logo ? cb.settings.theme_logo : "4b2adba5-f90e-46a2-af79-3c1d800062e6"; // 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 - yes show', 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', defaultValue:'0 - all tips'}, {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])", 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 goal(goal 1 only)', choice3:'2 - multi goal(all goals)', defaultValue:'0 - single goal(goal 1 only)'}, {name:'GA1', label: "Amount for Goal 1", type:'int', minValue:1, maxValue:99999, defaultValue: 100}, {name: 'GN1', label: "Goal 1 is", type: 'str', minLength: 1, maxLength: 255, defaultValue: "topless"}, {name:'GA2',required: false, label: "Amount for Goal 2", type:'int', minValue:1, maxValue:99999}, {name: 'GN2',required: false, label: "Goal 2 is", type: 'str', minLength: 1, maxLength: 255}, {name:'GA3',required: false, label: "Amount for Goal 3", type:'int', minValue:1, maxValue:99999}, {name: 'GN3',required: false, label: "Goal 3 is", type: 'str', minLength: 1, maxLength: 255}, {name:'GA4',required: false, label: "Amount for Goal 4", type:'int', minValue:1, maxValue:99999}, {name: 'GN4',required: false, label: "Goal 4 is", type: 'str', minLength: 1, maxLength: 255}, {name:'GA5',required: false, label: "Amount for Goal 5", type:'int', minValue:1, maxValue:99999}, {name: 'GN5',required: false, label: "Goal 5 is", type: 'str', minLength: 1, maxLength: 255}, {name:'GA6',required: false, label: "Amount for Goal 6", type:'int', minValue:1, maxValue:99999}, {name: 'GN6',required: false, label: "Goal 6 is", type: 'str', minLength: 1, maxLength: 255}, {name:'GA7',required: false, label: "Amount for Goal 7", type:'int', minValue:1, maxValue:99999}, {name: 'GN7',required: false, label: "Goal 7 is", 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; } function smGoal(X) { if (maxG == 0) {return;} X ? X : 0; TTG += X; lst =''; lst2 =''; apG = (GoalT == 1) ? goals[0].ga : goals[GTN].ga; gn = (GoalT == 1) ? goals[0].gn : goals[GTN].gn; if ((TTG >= apG) && (maxG > TGR)) { TTG-=apG; TGR++;} else if (maxG <= TGR) { TTG = apG;} if ((maxG <= TGR) && (GoalT == 1)){ maxG++ ;} if (TGR > MTGR) { MTGR++; if (TGR == maxG) {lst = LTU + " reached the last goal ,its Time for: " + gn; reached = "yes"; gl= 3; ngl= 3;} else if (MTGR < maxG) { gl= 3; ngl= 3; lst = LTU + " Reached goal #" +TGR + ", its time for: " + gn; if (GoalT != 1) {GTN++;} } 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");} } return smGoal(0); } ned = apG-TTG; if ((Gtype != 0) &&( R == 0) ){runTopic();} desG(); //get percentage pro_C(percent number) and Gbar(goal percent bar) if ((TGR == maxG) &&((GoalT == 0) || (GoalT == 2)) ) { TGRN = TGR ;} else {TGRN = TGR+1;} cb.drawPanel(); //end } function runTopic() { SS = (ned > 1) ? "s" : ""; gSet = []; gSet[0] = [gType +": '"+gn+"'[" + ned +" token"+SS+" left]",gType + ": '"+gn+" @ Goal"]; gSet[1] = ["'"+gn+"'[" + ned +" token"+SS+" left]","'"+gn+"'@ Goal"]; allR = gSet[Goal_Set][Gtype-1]; tSet = gSet[Goal_Set][Gtype-1]; goal =''; sub = ''; if (Gtype == 2) { if (ngl > 2) { gl = 1; ngl = 1;} else if (TT > 0) {return;} } if (reached && R == 0) { goal = allR; R++} else if (R == 0) {goal = tSet;} ck = RS.includes("##"); sub = ((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); } else if (str.includes("!gList")){ msg['X-Spam'] = true; listGoals(msg.user); } else if ((str.includes("!loadTopic")) && (msg.user == cb.room_slug)){ msg['X-Spam'] = true; runTopic(); } return msg; }); function addGoal(ST) { errMSG =""; if (maxG == 0) {return;} if (GoalT == 1) {errMSG = "you can not add goals in repeat mode";} nub =ST.match(/[1-9][0-9]{0,3}/g)? ST.match(/[1-9][0-9]{0,3}/g)[0] : null; if (nub == null) {errMSG = "Goal amount is needed!";} 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({gn : n_str, ga : nub}); maxG ++; if (TTG >= apG) { GTN++; TTG-=apG; gl= 3; ngl= 3; R = 0; reached = ""; smGoal(0);} return cb.sendNotice("('" + n_str +"'[ "+ nub + " Tokens needed]) has been added to the goals", cb.room_slug); } } function listGoals(U) { if (goals.length == 0) {return;} gList = ""; SGTN = (GoalT == 1) ? 0 : GTN; var xNo; GX = 0 if (TGR < maxG) { for (xNo = SGTN; xNo < goals.length; xNo++) { GX++ curr = xNo == SGTN ? "(current Goal)" : "" ; gList += "\n Goal "+(xNo+1) + ") "+ goals[xNo].ga + " Tokens for: "+ goals[xNo].gn + curr; } } if (gList) {cb.sendNotice("Your goals that are available: "+ gList, U);} else {cb.sendNotice("Please add more goals to continue.", U);} } switcher(); smGoal(0);
© Copyright Chaturbate 2011- 2025. All Rights Reserved.