Bots Home
|
My Uploads
|
Create an App
ml bot test
Author:
loulouw
Description
Source Code
Launch Bot
Current Users
Created by:
Loulouw
App Images
// vars var total_tipped = 0 var last_tip_username = null; var next_tip_amount = 1; var before_tip_amount = next_tip_amount - 1 var tip_level = 1 var prize = null; var goal_reached = false; // var version = 10 // Limit goal description as we add some text cb.settings_choices = [ { label: "label 1", name: "final_goal_description", type: "str", minLength: 1, maxLength: 190, defaultValue: "Hey goal" }, { label: "label 2", name: "final_goal_tip", type: "int", minValue: 1, maxValue: 100, defaultValue: 50 }, { label: "label 3", name: "order", type: "choice", choice1: "ascending", choice2: "descending", defaultValue: "ascending" }, { label: "Display goal by tip or levels", name: "goal_level", type: "choice", choice1: "levels", choice2: "tip", defaultValue: "levels" }, { label: "Will you prize when tip board change ?:", name: "tip_prize", type: "choice", choice1: "no", choice2: "yes", defaultValue: "no" }, { label: "If yes, prize is (keep empty for no prize):", name: "tip_prize_description", type: "choice", choice1: "spanky", choice2: "spanks", defaultValue: "spanky" }, {name: 'min_start_tokens', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 100, label: 'Cost to Join Before Show Starts'}, {name: 'min_join_tokens', type: 'int', minValue: 0, maxValue: 1000, defaultValue: 100, label: 'Cost to Join During Show. Set to 0 to Disable Joining During Show.'}, {name: 'screen_message', type: 'str', minLength: 1, maxLength: 256, defaultValue: 'Hidden Club Show in progress! \n Tip 132 tks to join fun!', label: 'Cam Message'} ]; cb.onTip( function (tip) { var diff = tip['amount']; total_tipped += tip['amount'] while ((diff > 0) && (!checkGoalReached())) { diff -= next_tip_amount; if (diff >= 0) { // We set the last tipper only if the tip was counted // (not optimal to do it as many times as the tip counted though) last_tip_username = tip['from_user']; setNextTipNeeded(); if (cb.settings.tip_prize == 'yes') { output(checkPrize()+' from '+last_tip_username+'\'s tip ('+tip['amount']+'). (tip level:'+tip_level+') (next tip amount:'+((next_tip_amount/10)+0.0).toFixed(1)+'). Tipped from all users : '+total_tipped+' tokens. ($ '+(total_tipped*0.05).toFixed(2)+' for model.)'); } if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { if(!cb.limitCam_isRunning() && parseInt(tip['amount']) >= cb.settings.min_start_tokens) { output('Added '+ tip['from_user'] + ' to secret show!'); cb.limitCam_addUsers([tip['from_user']]); } if(cb.limitCam_isRunning() && parseInt(tip['amount']) >= cb.settings.min_join_tokens && cb.settings.min_join_tokens > 0) { output('Added '+ tip['from_user'] + ' to secret show!'); cb.limitCam_addUsers([tip['from_user']]); } } } else { cb.chatNotice(' ? less than '+next_tip_amount)} } update_subject(); cb.drawPanel(); } ); cb.onDrawPanel( function (user) { if (checkGoalReached()) { return { 'template': '3_rows_11_21_31', 'row1_value': 'Goal reached!', 'row2_value': '', 'row3_value': 'Thanks to all tippers' }; } else if (isAscendingOrder()) { //checkPrize() if (cb.settings.tip_prize == 'yes') { return { 'template': '3_rows_of_labels', 'row1_label': 'Tip in ascending order', 'row1_value': 'From 1 to ' + cb.settings.final_goal_tip+' '+checkPrize(), 'row2_label': 'Next Tip Needed', 'row2_value': next_tip_amount+' for '+next_tip_amount+' '+cb.settings.tip_prize_description, 'row3_label': 'Last Tip From:', 'row3_value': format_username(last_tip_username) }; } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Next Tip Needed', 'row1_value': next_tip_amount, 'row2_label': 'Last Tip From:', 'row2_value': format_username(last_tip_username), 'row3_label': 'Ascending:', 'row3_value': 'From 1 to ' + cb.settings.final_goal_tip+' '+checkPrize() }; } } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Next Tip Needed:', 'row1_value': next_tip_amount, 'row2_label': 'Last Tip From:', 'row2_value': format_username(last_tip_username), 'row3_label': 'Descending:', 'row3_value': 'From ' + cb.settings.final_goal_tip + ' to 0' }; } } ); // helper functions function update_subject() { if (goal_reached) { return; } var new_subject = ""; if (checkGoalReached()) { new_subject = cb.settings.final_goal_description + " [Goal reached! Thanks to all tippers.]"; goal_reached = true; } else if (isAscendingOrder()) { new_subject = cb.settings.final_goal_description +" [Tip in ascending order from 1 to " + cb.settings.final_goal_tip + ". Next tip needed: " + next_tip_amount + "]"; } else { new_subject = cb.settings.final_goal_description + " [Tip in descending order from " + cb.settings.final_goal_tip + " to 0. Next tip needed: " + next_tip_amount + "]"; } cb.changeRoomSubject(new_subject); } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function isAscendingOrder() { return (cb.settings.order == 'ascending'); } function setNextTipNeeded() { if (isAscendingOrder()) { next_tip_amount++; while (tip_level < ((next_tip_amount/10)+0.0).toFixed(1) ) { //cb.chatNotice('Level '+(tip_level/10).toFixed(0))+' completed ! \n '+last_tip_username+' choose a flash ' cb.chatNotice('----------------------------- \n Level '+tip_level+' completed ! ('+((next_tip_amount/10)+0.0).toFixed(1)+' next tip amount /10)\n ----------------------------- ') tip_level++ } } else { next_tip_amount--; } } function checkGoalReached() { if (isAscendingOrder()) { return (next_tip_amount > cb.settings.final_goal_tip); } else { return (next_tip_amount <= 0); } } function checkPrize() { /*if (tip_level == next_tip_amount) { before_tip_amount = next_tip_amount - 1 prize = 'choose a flash' return prize }*/ user_total_spanks = 0 before_tip_amount = next_tip_amount - 1 user_total_spanks += before_tip_amount return before_tip_amount+' spanks total: '+user_total_spanks+' spanks.' } function init() { if (isAscendingOrder()) { next_tip_amount = 1; } else { next_tip_amount = cb.settings.final_goal_tip; } update_subject(); } init(); cb.onMessage(function (msg) { var message = msg['m']; var user = msg['user']; var username = ""; if (cb.room_slug === user && message == '/start' && !cb.limitCam_isRunning()) { output(cb.room_slug + ' has started the Hidden Club show!'); //cb.limitCam_start(cb.settings.screen_message); cb.limitCam_start('Club Show in progress! \n Tip 132 tks to join'); } if (cb.room_slug === user && message == '/stop' && cb.limitCam_isRunning()) { output(cb.room_slug + ' has stopped the show!'); cb.limitCam_stop(); } if (cb.room_slug === user && message.substring(0, 7) == '/remove' && cb.limitCam_allUsersWithAccess().length > 0 && cb.limitCam_isRunning()) { username = message.substring(8, message.length); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_removeUsers([username]); output(cb.room_slug + ' has removed ' + username + ' from the show!'); } } if (cb.room_slug === user && message.substring(0, 6) == '/check') { username = message.substring(7, message.length); if (cb.limitCam_userHasAccess(username)) { output(username + " is in the show!"); } else { output(username + " is not in the show!"); } } if (cb.room_slug === user && message === '/list') { var userlist = cb.limitCam_allUsersWithAccess(); if (userlist.length > 0) { output("" + userlist.length + (userlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(userlist, ", ")); } else { output("No users in show."); } } if (message[0] == '/') { msg['X-Spam'] = true; } return msg; }); function output(message) { cb.chatNotice(message, cb.room_slug); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.