Apps Home
|
Create an App
joes crazy ticket 2
Author:
hardworkertntest2
Description
Source Code
Launch App
Current Users
Created by:
Hardworkertntest2
// Title: Joes Crazy Ticket // Author: hardworkertn // Version: 1.0 (11/12/2021) cb.settings_choices = [ {name: 'min_start_tokens', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 49, label: "Ticket Show Price"}, {name: 'hide_message', label: 'Cam Message', type: 'str', minLength: 1, maxLength: 256, defaultValue: 'Joes Crazy Ticket Show! Tip at least ' + cb.settings.min_start_tokens + ' tokens to join in on the fun!' }, {name: 'guests', type: 'str', defaultValue: 'Guests', label: "Guest Names"}, ]; // ****************************************** // GLOBAL VARIABLES // ****************************************** var userlist = ["hardworkertn"]; x_totaltickets=0; var total_tickets = 0; random=Math.random()*100; var timerMinutes = 0; var timerdesc=''; var timermessage='' var total_tokens=0; var guest_tip=0; //timer variables var $ = JSON.parse(JSON.stringify(cb.settings)); var say = (message, user, color, wt) => cb.sendNotice(newLines(message), user, '', color || $.color || '#DC0000', wt || $.weight || 'bold'); var newLines = (input) => '|\u2007 ' + input.replace(/\n/g, '\n|\u2007 '); var isAllowed = (msg) => commanders.includes(msg.user) || (msg.is_mod && cb.settings.allow_mods === 'Yes'); var commanders = $.commanders ? $.commanders.split(/\s*,\s*/).filter((obj) => obj.length) : []; commanders.push(cb.room_slug); var newrandom=getRandomInt(1,cb.settings.min_start_tokens); //main code cb.onDrawPanel(function(user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Tickets Sold / Tokens:', 'row1_value': '' + total_tickets+'/'+total_tokens, 'row2_label': '' + cb.settings.guests +' Tips:', 'row2_value': '' +guest_tip, 'row3_value': '' + cb.settings.min_start_tokens +' tokens for show, other amounts go to guests', }; }); cb.onStart(user => { //msg['background'] = '#9F9'; roomsubject = 'Joe & Friend: 49 Tokens, Fan Club Free!'; cb.changeRoomSubject(roomsubject); cb.chatNotice( '------------------------------------------------------------'); cb.chatNotice( ':hardworkerlogo'); cb.chatNotice(' JOES CRAZY TICKET APP!'); cb.chatNotice( '------------------------------------------------------------'); //msg['background'] = ''; }); cb.onTip(function(tip) { // if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { if(parseInt(tip['amount']) != cb.settings.min_start_tokens) { output_guest(tip.from_user+' tipped ' +tip['amount'] + ' tokens towards the guest! Any amount other than the show price goes to the guest.'); guest_tip=guest_tip+tip['amount']; cb.drawPanel(); } if((parseInt(tip['amount']) >= cb.settings.min_start_tokens) && !cbjs.arrayContains(cb.limitCam_allUsersWithAccess())) { //output('Added '+ tip['from_user'] + ' to secret show!'); total_tokens=total_tokens+tip['amount']; checkTicket(tip.from_user); if (checkflag == false){ output_user(tip['from_user'], 'You have been added to the crazy ticket list! You are now added to see all hidden portions of the show. Please allow the cam time to connect once the show goes hidden which is generally 5-20 seconds. In the event that you are unable to see, refresh your screen or go out of the room and back in.'); //joe added this line to add them early cb.limitCam_addUsers(tip.from_user); } total_tickets = userlist.length; cb.drawPanel(); //if (cb.limitCam_isRunning()){ // //output("app is running for loop"); // cb.limitCam_addUsers(tip.from_user); //} //handleTip(tip.amount, tip.from_user); checkTicket(tip.from_user); if (checkflag == false){ handleArray(tip.from_user); } //output('Current Users: ' + userlist); } if(parseInt(tip['amount']) < cb.settings.min_start_tokens) { //output_user(tip['from_user'], 'You must tip ' + cb.settings.min_start_tokens + ' or more to watch the show!'); //lotteryTicket(tip.from_user,tip.amount); } // } }); // functions function handleTip(amount,user){ } function lotteryTicket(username,amount){ //output('random:'+random); //output('user: '+username); //output('amount: '+amount); //var newrandom=getRandomInt(1,cb.settings.min_start_tokens); //output('new random: ' + newrandom); checkTicket(username); //output(checkflag); if (amount == newrandom) { if (checkflag == false){ userlist.push(username); output_user(username,"***** LOTTERY WINNER *****"); output_user(username,"With your generous tip you partcipdated in the ticket lottery."); output_user(username,"Congratulations - You won a free ticket! Free tickets are a one time deal. Please do not beg the room or mods for free tickets."); output_user(username, 'You have been added to the crazy ticket list!'); output(":WINNER Congratulations to " + username + " for winning a free ticket in the Ticket Lottery! Tip less than " + cb.settings.min_start_tokens + " tokens to play"); newrandom=getRandomInt(1,cb.settings.min_start_tokens); processUser(username); } } else{ if (checkflag == false){ output_user(username,"With your generous tip you partcipated in the ticket lottery. Sorry, you did not win a free ticket. Please try again."); } } } function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; } function handleArray(user){ // output('adding user: ' + user); userlist.push(user); // output('Current Users: ' + userlist); } function arrayRemove(value) { // output('incominguser list:' + userlist); return userlist.filter(function(ele){ return ele != value; }); // output('returned user list: ' + userlist); } function checkTicket(username){ checkflag = userlist.includes(username); //output(username + 'has a check flag: ' + checkflag); return checkflag; } function checkMessage(username,message){ if (message.includes("refund")==true){ output_user(username,"Refunds are not allowed. Tips are not a gaurantee of sexual activity."); } if (message.includes("fag")==true){ output_user(username,"Fag is generally a derogatory term in the United States."); } if (message.includes("replay")==true){ output_user(username,"Please read the room rules. Rules are to keep the chat positive and horny."); } if (message.includes("rerun")==true){ output_user(username,"Please read the room rules. Rules are to keep the chat positive and horny."); } if (message.includes("snap")==true){ output_user(username,"Please do not share your snap in my chat. I will ban you."); } if (message.includes("snap")==true){ output_user(username,"Please do not advertise in my chat."); } } function addtoList(user){ var username = user['user']; checkTicket(username); //make sure we add them to the list. if (checkflag == false){ userlist.push(username); //output(userlist); } processUser(user) } function processUser(user){ var username = user['user']; var isFan = user['in_fanclub']; var is_Mod = user['is_mod']; checkflag = checkTicket(username); //check mod status and fan club again //mods and fan club are always added if (checkflag == false && isFan == true){ userlist.push(username); checkflag=true; cb.limitCam_addUsers(username); } //check mod status and fan club again if (checkflag == false && is_Mod == true){ userlist.push(username); checkflag=true; cb.limitCam_addUsers(username); } //if cam is running lets add them if (checkflag == true && cb.limitCam_isRunning()){ cb.limitCam_addUsers(username); //userlist.push(username); //output(userlist); } } function UserEnter(username,isFan,is_Mod){ if (is_Mod == true){ output(":ModPower Moderator " + username + " has entered the room"); } //funny alerts if (username == 'hornydaddybear6987'){ output_mod('auto message: hornydaddybear6987 is here ignore his stupidy.'); } } cb.onEnter(function(user) { // cb.chatNotice('Welcome ' + user['user'] + '!'); var username = user['user']; var isFan = user['in_fanclub']; var is_Mod = user['is_mod']; UserEnter(username,isFan,is_Mod); processUser(user); }); cb.onMessage(function (msg) { var message = msg['m']; var user = msg['user']; var username = msg['user']; // vars for ease of use var u = msg['user']; var m = msg['m']; var isMod = msg['is_mod']; var isFan = msg['in_fanclub']; var isModel = (u == cb.room_slug); var hasTokens = msg['has_tokens']; var hasTipped = msg['tipped_recently']; var isGrey = !(hasTokens || isMod || isModel || isFan); var modsAllowed = true; var exempt = (isModel || isMod); //are they valid to change things? admin=false; if (cb.room_slug == user){ admin=true; } if (isMod == true){ admin=true; } //output('admin status: ' + admin); checkMessage(username,message) if (message == '/reprocess'){ processUser(username); output_user(username," Your crazy ticket has been reprocessed"); } if (admin == true && message == '/start') { output('The show has started. To continue please tip.' + cb.settings.min_start_tokens); //var userlist = cb.limitCam_allUsersWithAccess() cb.limitCam_start("Crazy Ticket Show: Tip " + cb.settings.min_start_tokens + " tokens"); // now add the users from the array to the show. //now lets add people who are on the list //output('List Current Users: ' + userlist); let arraylength = userlist.length; output("Total ticket holders in the show: " +arraylength); //cb.limitCam_removeAllUsers(); //for (let i = 0; i < arraylength; i++) { // username=userlist[i] // cb.limitCam_addUsers([username]); // //output("added from array: " + username); //} output("All paid ticket holders have been added."); output_room("The crazy ticket show has started. The cam takes a few moments to connect. If your cam does not connect, you can refresh your browser (F5) or you can exit the room and come back in."); //timerdesc=''; //timermessage=''; //cb.drawPanel(); } if (admin == true && message == '/backup') { output(cb.room_slug + ' has started the show!'); //var userlist = cb.limitCam_allUsersWithAccess() cb.limitCam_start("Crazy Ticket Show: Tip " + cb.settings.min_start_tokens + " tokens. Wait a few seconds to automatically connect. If purchased refresh/re-enter room."); // now add the users from the array to the show. //now lets add people who are on the list //output('List Current Users: ' + userlist); let arraylength = userlist.length; output("Total ticket holders in the show: " +arraylength); cb.limitCam_removeAllUsers(); for (let i = 0; i < arraylength; i++) { username=userlist[i] cb.limitCam_addUsers([username]); //output("added from array: " + username); } output("All paid ticket holders have been added."); output_room("The crazy ticket show has started. The cam takes a few moments to connect. If your cam does not connect, you can refresh your browser (F5) or you can exit the room and come back in."); timerdesc=''; timermessage=''; cb.drawPanel(); } // if (cb.room_slug === user && message == '/stop' && cb.limitCam_isRunning()) { if (admin == true && message == '/stop') { output(cb.room_slug + ' has stopped the show!'); cb.limitCam_stop(); cb.limitCam_removeAllUsers(); new_subject="Crazy Ticket show has ended. Cam is now in public view."; cb.changeRoomSubject(new_subject); timerdesc=''; timermessage=''; cb.drawPanel(); } if (admin == true && message == '/newshow') { output(cb.room_slug + ' has stopped the show!'); cb.limitCam_stop(); new_subject="Crazy Ticket Intermission: Your previous ticket will carry over."; cb.changeRoomSubject(new_subject); timerdesc=''; timermessage=''; cb.drawPanel(); } if (admin == true && message.substring(0, 6) == '/check') { username = message.substring(7, message.length); checkflag = userlist.includes(username); output(username + 'has a ticket: ' + checkflag); // if (cb.limitCam_userHasAccess(username)) { // output_mod(username + " is in the show!"); // } // else { // output_mod(username + " is not in the show!"); // } } //if (cb.room_slug === user && message.substring(0, 7) == '/remove' && cb.limitCam_allUsersWithAccess().length > 0) { if (admin == true && message.substring(0, 7) == '/remove') { username = message.substring(8, message.length); output_mod(username + ' has removed from the show!'); userlist = arrayRemove(username); // output('var userlist result: ' + userlist); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_removeUsers([username]); } } if (admin == true && message.substring(0, 4) == '/add') { // output('message: ' + message); username = message.substring(5, message.length); //output('username: ' + username); //handleArray(username); //output('adding user: ' + username); checkTicket(username); if (checkflag == false){ userlist.push(username); } //output('Current Users: ' + userlist); cb.limitCam_addUsers(username); output_mod(username+' has been added to the crazy ticket show by: ' + user); output_user(username, ' you have been added to the crazy ticket show.'); total_tickets=total_tickets+1; cb.drawPanel(); } if (admin == true && message === '/addmax') { addMax(); output_mod(cb.room_slug + '-- the max users were added'); } if (cb.room_slug === user && message === '/camlist') { var usercamlist = cb.limitCam_allUsersWithAccess(); if (usercamlist.length > 0) { output_mod("" + usercamlist.length + (usercamlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(usercamlist, ", ")); } else { output_mod("No users in show."); } } if (admin == true && message === '/list') { let totaltickets = userlist.length; output_mod('Total in List: ' + totaltickets); //output_mod('List Current Users: ' + userlist); let arraylength = userlist.length; showlist=''; for (let i = 0; i < arraylength; i++) { username=userlist[i] showlist=showlist+username+", "; //output("added from array: " + username); } output_mod(cb.room_slug,"List Current Users: " + showlist); } if (admin == true && message == '/reload') { let arraylength = userlist.length; for (let i = 0; i < arraylength; i++) { username=userlist[i] cb.limitCam_addUsers([username]); //output("added from array: " + username); } output_mod("The users on the list have been reprocessed."); } if (admin == true && message == '/recalc') { let arraylength = userlist.length; total_tickets=arraylength cb.drawPanel(); } if (admin == true && message.substring(0, 8) == '/subject') { new_subject = message.substring(9, message.length); cb.changeRoomSubject(new_subject); output('Room subject changed to: ' + new_subject); } if (admin == true && message.substring(0, 7) == '/notice') { new_message = message.substring(8, message.length); output_room(new_message); } if (admin == true && message == '/showend') { new_message = 'Attention: The crazy ticket show is ending soon. Purchasing a ticket is not recommended. Please check back soon for more great shows and be sure to click the Follow button!'; output_room(new_message); new_subject = "Ticket show ending soon"; cb.changeRoomSubject(new_subject); } if (admin == true && message.substring(0, 4) == '/mod') { new_message = username+': '+message.substring(5, message.length); output_mod(new_message); } if (message[0] == '/') { msg['X-Spam'] = true; } //if they bought a ticket, lets give them an icon checkTicket(username); var prefix=''; if (checkflag == true){ prefix=' :crazyticketshow '; } if (isFan == true){ prefix=' :fanclubsquare '; } if (isMod == true){ prefix=' :icon_mod '; } if (cb.room_slug == username){ prefix=' :star_olivia_dellvine '; } msg.m = prefix + msg.m; return msg; }); function output(message) { cb.chatNotice(message); } function output_room(message){ to_user=''; background='#0000FF'; foreground='#FFFFFF'; weight='bolder'; to_group=''; cb.sendNotice(message, to_user, background, foreground, weight, to_group) } function output_guest(message){ to_user=''; background='#00FF00'; foreground='#FFFFFF'; weight='bolder'; to_group=''; cb.sendNotice(message, to_user, background, foreground, weight, to_group) } function output_mod(message){ to_user=''; background='#ff0000'; foreground='#000000'; weight='bolder'; to_group='red'; cb.sendNotice(message, to_user, background, foreground, weight, to_group) to_user='hardworkertntest'; background='#ff0000'; foreground='#FFFFFF'; weight='bolder'; to_group=''; cb.sendNotice(message, to_user, background, foreground, weight, to_group) to_user='hardworkertn'; background='#ff0000'; foreground='#FFFFFF'; weight='bolder'; to_group=''; cb.sendNotice(message, to_user, background, foreground, weight, to_group) } function output_user(username,message){ to_user=username; background='#FFFF00'; foreground='#000000'; weight='bolder'; to_group=''; cb.sendNotice(message, to_user, background, foreground, weight, to_group) } function addMax(){ userlist.push('jackhard20'); userlist.push('pokeme777'); userlist.push('texancigar'); userlist.push('dontbeshy63'); userlist.push('hotinatlanta1'); userlist.push('manlover1960'); userlist.push('mr_bo_dangles'); userlist.push('markmajors'); userlist.push('beeatrical'); userlist.push('benle20024'); userlist.push('kyredneckjb'); userlist.push('hungdieselredneck'); userlist.push('ta79dcfm'); userlist.push('lordoffrogs'); userlist.push('graybear4m'); userlist.push('tspatterson419'); userlist.push('graybear6m'); userlist.push('bortasbir'); userlist.push('cb_kyle'); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.