Apps Home
|
Create an App
iltestg
Author:
ilguest
Description
Source Code
Launch App
Current Users
Created by:
Ilguest
/* 1 token - 5 seconds addition time */ cb.settings_choices = [ { name:'tipperThanks', type:'choice', label: "Tippers thanks", choice1:'Yes', choice2:'Do not thank', defaultValue:'Yes' }, { name:'importData', type: 'str', label: "Import Data", minLength: 1, maxLength: 5000, required: false }, { name:'kingTip', type: 'int', label: "King Tip", minLength: 1, maxLength: 5, defaultValue:'25' }, { name:'timeLeft', type: 'int', label: "Show time", minLength: 1, maxLength: 5, defaultValue:'120' }, { name:'goal1', type: 'int', label: "Goal 1", minLength: 1, maxLength: 5, required: false }, { name:'goal1_name', type: 'str', label: "Goal 1 Name", minLength: 1, maxLength: 300, required: false }, { name:'goal2', type: 'int', label: "Goal 2", minLength: 1, maxLength: 5, required: false }, { name:'goal2_name', type: 'str', label: "Goal 2 Name", minLength: 1, maxLength: 300, required: false }, { name:'goal3', type: 'int', label: "Goal 3", minLength: 1, maxLength: 5, required: false }, { name:'goal3_name', type: 'str', label: "Goal 3 Name", minLength: 1, maxLength: 300, required: false }, { name:'goal4', type: 'int', label: "Goal 4", minLength: 1, maxLength: 5, required: false }, { name:'goal4_name', type: 'str', label: "Goal 4 Name", minLength: 1, maxLength: 300, required: false }, { name:'goal5', type: 'int', label: "Goal 5", minLength: 1, maxLength: 5, required: false }, { name:'goal5_name', type: 'str', label: "Goal 5 Name", minLength: 1, maxLength: 300, required: false } ]; defaults = { username: 'ildole', tipperThanks: (cb.settings.tipperThanks == "Yes"), tipperThanks_weight: 'bolder', tipPM: true, tipPM_text: 'Thank you one more time!', tipPM_bg: '#ffee00', tipPM_fg: '#2a2a2a', tipPM_weight: 'normal', crown: 'crowngif282', vote: 'vtc', info_bg: '#2a2a2a', info_fg: '#f2f2f2' }; s = defaults; /* IMPORT-EXPORT MAIN DATA All main variables in the array */ d = { "tippers" : {}, "king" : "", "amount" : 0, "kingTip" : cb.settings.kingTip, "timeLeft" : cb.settings.timeLeft*60*1000 }; /* SAVED DATA IMPORT Import data in JSON string */ try { d = JSON.parse(cb.settings['importData']); } catch(e) { cb.sendNotice("We don't have an import data. Script started from zero.", cb.room_slug, s.info_bg, s.info_fg, 'bolder'); } poll = false; poll_name = ''; polls = { vtc:{} }; /* TIMED-OUT NITICES All information messages with countdowns */ cb.setTimeout(function(){ if (d.king != ''){ message = "The King of this room is "+d.king+". Tip "+d.kingTip+" tokens to become new King!"; cb.sendNotice(message, null, s.tipPM_bg, s.tipPM_fg, s.tipPM_weight); } }, 600000); cb.setTimeout(function(){ d.timeLeft = d.timeLeft - 1000; cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row3_label': 'Time left:', 'row3_value': d.timeLeft }; }); }, 1000); /* TIP PROCESSOR Controls all tips in the room */ cb.onTip(function (tip) { var sender = tip['from_user'], message = '', amount = tip['amount']; d.timeLeft = d.timeLeft + (amount * 5); if (sender in d.tippers){ d.tippers[sender]["tips"] = d.tippers[sender]["tips"] + amount; } else { d.tippers[sender] = {"tips":amount}; } // KING TIP if (d.tippers[sender]["tips"] > d.kingTip){ d.kingTip = d.tippers[sender]["tips"] + 1; if (sender != d.king){ d.king = sender; cb.sendNotice("Guys, we have a new King! Please say hello to "+d.king+"!", null, '#ffc43a', '#2a2a2a', 'bolder'); } else { cb.sendNotice("King tip increased to "+d.tippers[sender]["tips"]+" tokens!", null, '#ffc43a', '#2a2a2a', 'bolder'); } } // TIPPER THANKS if (s.tipperThanks){ var ta = tip['amount'], bg = '#3B6800'; if (ta <= 10){ message = 'Thank you, [tipper], for your tip! :kissy'; } else if (ta > 10 && ta <= 25){ message = ':giftsmol [tipper], thank you very much for your tip! :giftsmol'; bg = '#008560'; } else if (ta > 25 && ta <= 50){ message = ':coinSmall [tipper], many thanks for your tip! :coinSmall'; bg = '#008520'; } else if (ta > 50 && ta <= 100){ message = ':moneybags What a great tip! Many thanks to you, [tipper]! :moneybags'; bg = '#004785'; } else if (ta > 100){ message = ':crownsilver Dear [tipper]! You are one of the best tippers! Thank you very much for your tip! :crownsilver'; bg = '#856900'; } message = message.replace('[tipper]', sender); cb.sendNotice(message, null, bg, '#FFFFFF', s.tipperThanks_weight); } if (s.tipPM && !(sender in d.tippers)){ cb.setTimeout(function(){ message = s.tipPM_text; cb.sendNotice(message, sender, s.tipPM_bg, s.tipPM_fg, s.tipPM_weight); }, 2000); } if (poll){ vote_process(tip['message'],tip['amount']); } }); /* ON-THE-FLY COMMANDS Command-line like system for the app */ cld = { // Command line defaults bg: '#1A1E2E', fg: '#f8f8f8', weight: 'normal' }; cb.onMessage(function (msg) { if (msg['m'].lastIndexOf('**', 0) === 0) { if (msg['user'] == cb.room_slug){ msg['X-Spam'] = true; var command = msg['m'].replace("**", "").trim(), commandParts = command.split(':'), message = "Unknown command!"; switch (commandParts[0]){ case 'defaults': s[commandParts[1]] = commandParts[2]; message = 'settings updated'; break; case 'poll': if (commandParts[1] == 'start'){ vote_start(commandParts[2]); message = 'starting the vote'; } else if (commandParts[1] == 'stop'){ vote_stop(); message = 'stopping the vote'; } break; case 'export': message = JSON.stringify(d); break; } cb.sendNotice(message, cb.room_slug, cld.bg, cld.fg, cld.weight); } } else if (msg['m'].lastIndexOf('/', 0) === 0) { msg['X-Spam'] = true; command = msg['m'].split(' ')[0]; data = msg['m'].replace(command, "").trim(); command = command.replace('/', ""); switch (command){ case 'pm': cb.sendNotice("PRIVATE MESSAGE", cb.room_slug, s.info_bg, s.info_fg); cb.sendNotice("FROM: "+msg['user'], cb.room_slug, s.info_bg, s.info_fg); cb.sendNotice(data, cb.room_slug, s.info_bg, s.info_fg); break; } } else { msg = bot(msg); } return msg; }); /* VOTE PROCESSOR Controls vote system for tippers */ function vote_start(type){ var start = false; var message = ''; switch (type){ case 'vtc': data = {options:[{label: 'Breasts'}, {label: 'Ass'}, {label: 'Stomach'}, {label: 'Mouth'}], label:"Where to cum? Please vote:"}; start = true; message = 'We have started a new poll! Now you can vote for the PLACE TO CUM by sending us your tips!'; poll_name = 'vtc'; break; } if (start){ poll = true; cb.tipOptions(function(user) { return data; }); if (message !== ''){ cb.sendNotice(message, null, '#85240a', '#f8f8f8'); } } } function vote_stop(){ poll = false; cb.tipOptions(function(user) { return; }); } function vote_process(message,amount){ var cPoll = polls[poll_name]; if (cPoll[message] !== undefined){ cPoll[message] = parseInt(cPoll[message]) + amount; } else { cPoll[message] = amount; } var tokens = 0; var option = ''; for (i = 0; i < cPoll.length; i++) { if (cPoll[i] > tokens){ //option } } } /* MESSAGE BOT Checks messages, hides spam and answers if needed */ function bot(msg){ var message = msg['m']; if (message.includes('pm')){ msg['X-Spam'] = true; cb.sendNotice("If you want to start a private conversation, write /pm and then your message. We'll answer you if needed.", msg['user'], '#cd3f00', '#f8f8f8'); cb.sendNotice(msg['user']+" tried to ask for pm.", cb.room_slug, s.info_bg, '#FFFFFF'); } } /* ON ENTER ACTIONS Greeting to new users */ cb.onEnter(function(user) { if (user['user'] in d.tippers){ cb.sendNotice("Welcome again, "+user['user']+"! We are glad you came back!", user['user'], '#4aff00', '#2a2a2a'); } else { if (user['has_tokens']){ cb.sendNotice("Hello, "+user['user']+"! Welcome to our room! Please note that only tippers will be added to the closed show viewers list.", user['user'], '#ffee00', '#2a2a2a'); } } });
© Copyright Chaturbate 2011- 2025. All Rights Reserved.