Apps Home
|
Create an App
Acsending Sequences for Ali
Author:
jogoe
Description
Source Code
Launch App
Current Users
Created by:
Jogoe
// vars var all_finished = false; var diff_next_sequence = 0; var next_tip_amount = 1; var current_goal = "nogoal"; // presettings cb.settings_choices = [ { name: 'goal1', type: 'str', minLength: 1, maxLength: 190 }, { name: 'goal2', type: 'str', minLength: 1, maxLength: 190 }, { name: 'goal3', type: 'str', minLength: 1, maxLength: 190 }, { name: 'goal4', type: 'str', minLength: 1, maxLength: 190 }, { name: 'goal5', type: 'str', minLength: 1, maxLength: 190 }, { name: 'goal_value', type: 'int', minValue: 1, maxValue: 100, default: 50 }, { name: 'sequence_count', type: 'int', minValue: 1, maxValue: 100, default: 10 } ]; var sequences_needed = cb.settings.sequence_count; current_goal = cb.settings.goal1; cb.changeRoomSubject("Tip app by jogoe"); // tip cb.onTip( function (tip) { var diff = tip['amount']; while ((diff > 0) && (!checkGoalReached())) { //diff = diff + diff_next_sequence; //diff_next_sequence = 0; diff -= next_tip_amount; if (diff >= 0) { cb.drawPanel(); setNextTipNeeded(); } //else //{ // diff_next_sequence = Math.abs(diff); // diff = 0; //} } update_subject(); cb.drawPanel(); } ); // drawpanel cb.onDrawPanel( function (user) { if (all_finished) { return { 'template': '3_rows_11_21_31', 'row1_value': 'YES BOYS, WE GOT IT', 'row2_value': '', 'row3_value': 'THANKS EVERYONE' }; } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Next Tip Needed:', 'row1_value': next_tip_amount, 'row2_label': 'Sequences left for goal:', 'row2_value': sequences_needed, 'row3_label': 'Ascending:', 'row3_value': 'From 1 to ' + cb.settings.goal_value }; } } ); // helper functions function update_subject() { if (all_finished) { cb.changeRoomSubject("We are done boys!! Thanks to all tippers!") return; } cb.drawPanel(); var new_subject = ""; if (checkGoalReached()) { sequences_needed = sequences_needed - 1; next_tip_amount = 1; if(sequences_needed == 0) { changeGoal(); } new_subject = current_goal + " [Tip in ascending order from 1 to " + cb.settings.goal_value + ". Next tip needed: " + next_tip_amount + "]"; } else { new_subject = current_goal + " [Tip in ascending order from 1 to " + cb.settings.goal_value + ". Next tip needed: " + next_tip_amount + "]"; } cb.changeRoomSubject(new_subject); } function setNextTipNeeded() { next_tip_amount++; } function changeGoal() { sequences_needed = cb.settings.sequence_count; if (current_goal == cb.settings.goal1) { current_goal = cb.settings.goal2; } else if (current_goal == cb.settings.goal2) { current_goal = cb.settings.goal3; } else if (current_goal == cb.settings.goal3) { current_goal = cb.settings.goal4; } else if (current_goal == cb.settings.goal4) { current_goal = cb.settings.goal5; } else { all_finished = true; } update_subject(); } function checkGoalReached() { return (next_tip_amount > cb.settings.goal_value); } function init() { next_tip_amount = 1; update_subject(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.