Apps Home
|
Create an App
My Room My Rules
Author:
nickdma
Description
Source Code
Launch App
Current Users
Created by:
Nickdma
/* Use the settings to: Set a room topic Send the user a welcome message when they join the room replacing ${user} with their name Send the user a list of rules Send the user instructions on how your room works Set a message sent to the room when the "/cumshot" command is used, ${user} is the name of the user called out with /cumshot username How the watchlist works When watchlist is set to either users or all, viewers may use the command "/watchme msg" to add themselves to a list of cams to be watched with a message. When watchlist is set to mods, only the broadcaster and moderators may manage the watchlist, adding users with "/watchlist" The broadcaster and mods can use "/list" to view the list of users, along with any message they added. */ cb.settings_choices = [ {name: 'topic', type: 'str', minLength: 1, maxLength: 255, label: "Set room subject:", defaultValue:"Cum for me!"}, {name: 'welcome_message', type: 'str', minLength: 1, maxLength: 255, defaultValue: "Welcome to my room ${user}!", label: "Set a welcome message:"}, {name: 'rules', type: 'str', minLength: 1, maxLength: 255, label: "Rules:", required: false, defaultValue:"No PMs, no privates, no demands, no passworded/blocked rooms.|If I'm broadcasting open, so can you."}, {name: 'watchlist', type:'choice',defaultValue: 'users', label: "Who can use the watchlist", choice1:'off', choice2: 'users', choice3:'mods', choice4: 'all' }, {name: 'instructions', type: 'str', minLength: 1, maxLength: 255, label: "Instructions:", required: false, defaultValue:"If you want me to watch your cam, type /watchme with a short message|I pick a random name from the list to watch."}, {name: 'cum_message', type: 'str', minLength: 1, maxLength: 255, label: "Message send to the room when using /cum:", required: false, defaultValue:"${user} came for me!"}, ]; var watchlist = new Array(); var cummers = 0; var lastCumshot = ''; var cam1 = ''; var cam2 = ''; var green = "#006600"; var red = "#e60000"; var blue = "#0033cc"; var purple = "#754AA8"; var white = "#FFFFFF"; var userhelp = " User commands are:\n /watchme message - users can add/remove themselves to the watchlist with a message, all users can use this"; var help = " /subject message - change the room's subject to message\n /add,a username message - adds username to the watchlist with an optional message.\n /remove,r username message - Removes the user from the watchlist, message says why\n /next,n - pick a random cam from the watchlist and displays their name/message\n /list,l,w - list all the cams and their messages\n /cam1[2],c1,c2,1,2 name - set the panel's watching status to the given name and remove them from the watchlist\n /cum,c,cs name - increment the cumshot counter and add the last cummer's name, broadcasting to the room who came"; function showlist(status,user) { // status values: // watched = user has been watch, but didn't cum // removed = user was removed // leftroom = user left the room // came = user came // waiting = user is waiting var list = new Array(); for (var i=0;i<watchlist.length;i++){ if (watchlist[i].status == status || status == "all") list.push(watchlist[i]); } var notice = status+" list:"; if (list.length > 0) { for (var i=0;i<list.length;i++){ if (status == "all") { notice = notice + "\n" + list[i].username + " ["+list[i].status+"] (by:"+list[i].statusby+") "+list[i].msg; } else { notice = notice + "\n" + list[i].username + " (by:"+list[i].statusby+") "+list[i].msg; } } } else { notice = status+" list is empty."; } cb.sendNotice(notice, user,"",blue); } function setstatus(user,by,status,message) { var exists = false; if (message === undefined) message = ""; for (var i=0;i<watchlist.length;i++){ if (watchlist[i].username == user) { exists = true; if (watchlist[i].status == "came") break; // no removing users from the came list if (message.length > 0) { watchlist[i].msg = message; } else { watchlist[i].msg = ""; } watchlist[i].status = status; watchlist[i].statusby = by; if (status == "removed") { if (message.length > 0) message = ", reason: "+message; cb.sendNotice(by+" removed "+user+" from the watchlist"+message,"",red,white,"","red"); cb.sendNotice(by+" removed "+user+" from the watchlist"+message,cb.room_slug,red,white); } } if (exists) break; } if (!exists) { var newuser = new Object(); newuser.username=user; newuser.status = status; newuser.statusby = by; if (message.length > 0) { newuser.msg = message; } else { newuser.msg = ""; } watchlist.push(newuser); if (message.length > 0) message = ": "+message; cb.sendNotice(by+" added "+user+" to the watchlist"+message,"",red,white,"","red"); cb.sendNotice(by+" added "+user+" to the watchlist"+message,cb.room_slug,red,white); } cb.drawPanel(); } function getstatus(user) { var status = ""; var exists = false; for (var i=0;i<watchlist.length;i++){ if (watchlist[i].username == user) { status = watchlist[i].status; } if (exists) break; } return status; } function rules(user) { var rules = cb.settings.rules.replace(/\|/g,"\n") if (rules.length > 0) cb.sendNotice("Rules:\n"+rules,user,"",purple,"bold"); } function instructions(user) { var instructions = cb.settings.instructions.replace(/\|/g,"\n") if (instructions.length > 0) cb.sendNotice("Instructions:\n"+instructions,user,"",blue,"bold"); } cb.onLeave(function(user) { var status = getstatus(user.user); if (status == "waiting") { setstatus(user.user,user.user,"leftroom"); } }); cb.onEnter(function(user) { var userName = user['user']; var welcome = cb.settings.welcome_message.replace(/\$\{user\}/, userName); welcome = welcome.replace(/\|/g,"\n"); if (welcome.length > 0 ) cb.sendNotice(welcome,userName,"",green,"bold"); rules(userName); instructions(userName); var status = getstatus(user.user); if (status == "leftroom") { setstatus(user.user,user.user,"waiting"); } }); cb.onMessage(function(msg) { //"use strict"; var msgText = msg['m']; if (msg['m'].indexOf("<img") >= 0) { msg['X-Spam'] == true; return; } if (msgText[0] == '/' || msgText[0] == '\\'){ msg['X-Spam'] = true; var command = ""; var arg = ""; var parsedMsg = msgText.match(/\/(\w+)($| (.*))/); if (parsedMsg) { command = parsedMsg[1]; arg = parsedMsg[3] || ""; } else { return; } switch (command) { // user adding themselves to the watchlist case "watchme": if (cb.settings.watchlist == 'all' || cb.settings.watchlist == 'users') { var exists = false; for (var i=0;i<watchlist.length;i++){ if (watchlist[i].username == arg) { exists = true; if (arg.length > 0) { watchlist[i].msg = arg; cb.sendNotice("Your watchlist message was updated to: "+arg, msg.user,"",blue); } else { setstatus(msg.user,msg.user,"removed","removed themself"); cb.sendNotice("You have been removed from the watchers list", msg.user,"",blue); } break; } if (exists) break; } if (!exists && arg.length > 0) { setstatus(msg.user,msg.user,"waiting",arg); cb.sendNotice("You have been added to the watchlist.\nMake sure your cam is not password protected or otherwise blocked and be ready to cum!", msg.user,"",blue); } } break; case "help": case "h": if (cb.settings.watchlist == 'all' || cb.settings.watchlist == 'users') { cb.sendNotice(userhelp, msg.user,"", blue, ""); } break; } // only broadcaster and mods can use these commands if(msg.user == cb.room_slug || msg.is_mod) { switch (command) { // Add a user to the watchlist case "add": case "a": if (cb.settings.watchlist != 'off') { var args = arg.split(' '); var name = args.shift(); arg = args.join(' '); setstatus(name,msg.user,"waiting",arg); } break; // Remove a user from the watchlist case "remove": case "r": if (cb.settings.watchlist != 'off') { var args = arg.split(' '); var name = args.shift(); arg = args.join(' '); setstatus(name,msg.user,"removed",arg); } break; case "help": case "h": cb.sendNotice("Commands\n"+help, msg.user, "", blue); break; case "list": case "l": case "w": showlist("waiting",msg.user); break; case "la": case "status": showlist("all",msg.user); break; case "removed": case "lr": showlist("removed",msg.user); break; case "left": case "ll": showlist("leftroom",msg.user); break; case "watched": case "lw": showlist("watched",msg.user); break; case "came": case "lc": showlist("came",msg.user); break; case "cam1": case "c1": case "1": var exists = false; if (arg.length > 0) { setstatus(arg,msg.user,"watched"); cb.sendNotice(cb.room_slug + " is watching your cam.",arg,"",red); cb.sendNotice(cb.room_slug + " is watching "+arg,"",red,white,"","red"); cam1 = 'Watching ' + arg; } else { cam1 = ''; } cb.drawPanel(); break; case "cam2": case "c2": case "2": var exists = false; if (arg.length > 0) { setstatus(arg,msg.user,"watched"); cb.sendNotice(cb.room_slug + " is watching your cam.",arg,"",red); cb.sendNotice(cb.room_slug + " is watching "+arg,"",red,white,"","red"); cam2 = 'Watching ' + arg; } else { cam2 = ''; } cb.drawPanel(); break; case "cumshot": case "cum": case "cs": case "c": var exists = false; if (arg.length > 0) { var note = cb.settings.cum_message.replace(/\$\{user\}/g, arg); cb.sendNotice(note,"","",blue,"bold"); cummers++; lastCumshot = " (last: "+arg+")"; setstatus(arg,msg.user,"came"); } cb.drawPanel(); break; case "next": case "n": var list = new Array(); for (var i=0;i<watchlist.length;i++){ if (watchlist[i].status == "waiting") list.push(watchlist[i]); } if (list.length > 0) { var i = Math.floor(Math.random() * list.length); var u = watchlist[i]; cb.sendNotice("Next up: "+u.username+": "+u.msg,msg.user,"",blue); cb.sendNotice(u.username+" removed from the watchlist",msg.user,"",blue); setstatus(u.username,msg.user,"watched"); } else { cb.sendNotice("The watchlist is empty.",msg.user,"",red,"bold"); } break; case "subject": var newTopic = arg; cb.changeRoomSubject(newTopic); break; case "hidecam": cb.limitCam_start("My cam hidden right now", arg.split(' ')); break; case "addviewer": cb.limitCam_addUsers(arg.split(' ')); break; case "showcam": cb.limitCam_stop(); break; case "viewers": var usersWithAccess = cb.limitCam_allUsersWithAccess(); cb.sendNotice("The following users have access to view the cam: ", msg.user, "" , "", "bold"); cb.sendNotice(usersWithAccess.toString(), msg.user, "#bbc8c8", "","bold"); break; case "rules": rules(arg); break; case "instructions": instructions(arg); break; } } } var gender = msg['gender']; var genderStr = ""; switch (gender) { case 'm': genderStr = ':genderM'; break; case 'f': genderStr = ':genderF'; break; case 's': genderStr = ':genderS'; break; case 'c': genderStr = ':genderC'; break; default: genderStr = '[?]'; break; } msg['m'] = genderStr + ' ' + msg['m']; return msg; }); cb.changeRoomSubject(cb.settings.topic); cb.onDrawPanel(function(user) { var fapstring = ''; var waiting = 0; if (cb.settings.watchlist != 'off') { for (var i=0;i<watchlist.length;i++){ if (watchlist[i].status == "waiting") waiting++; } fapstring = waiting+" waiting, "; } return { 'template': '3_rows_11_21_31', 'row1_value': fapstring+cummers+" have cum"+lastCumshot, 'row2_value': cam1, 'row3_value': cam2, }; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.