Apps Home
|
Create an App
Rumata goal
Author:
rumataestor3
Description
Source Code
Launch App
Current Users
Created by:
Rumataestor3
// vars var total_tipped = 0; var high_tip_username = null; var high_tip_amount = 0; var last_tip_username = null; var last_tip_amount = 0; var subject_is_set_with_0 = false; var vote = false; var opt_1 = 0; var opt_2 = 0; // цвета var danger = '#cc0000'; var warning = '#ff8800'; var success = '#007e33'; var info = '#0099cc'; var defcolor = '#2bbbad'; var primary = '#4285f4'; var secondary = '#aa66cc'; var white = '#ffffff'; var black = '#000000'; cb.settings_choices = [ {name: 'tokens', type: 'int', required: true, minValue: 1, label: 'Tokens for goal', defaultValue: 1000}, {name: 'goal_description', type: 'str', minLength: 1, maxLength: 255, label: 'Goal description', defaultValue: 'Cumshow'}, {name: 'tags', type: 'str', minLength: 1, maxLength: 255, label: 'Tags (only 5 can be used)', defaultValue: '#18 #new #cum #bigcock #young #lovense'}, {name: 'divider', type:'choice', required: false, label:'Polls settings', choice1:'', defaultValue:''}, {name: 'vote_description', type: 'str', minLength: 1, maxLength: 255, label: 'Poll description', defaultValue: 'Where should I cum?'}, {name: 'opt1_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 1', defaultValue: 'on my hand'}, {name: 'opt1_tokens', type: 'int', required: true, minValue: 1, label: 'Option 1 tokens', defaultValue: 10}, {name: 'opt2_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 2', defaultValue: 'on my abs'}, {name: 'opt2_tokens', type: 'int', required: true, minValue: 1, label: 'Option 2 tokens', defaultValue: 11}, ]; // handlers cb.onTip(function(tip) { // Это голосование if (tip['amount'] == cb.settings.opt1_tokens && vote === true) { opt_1 += 1; cb.sendNotice(tip['from_user'] + ' has voted for ' + cb.settings.opt1_label,'','',warning,''); } if (tip['amount'] == cb.settings.opt2_tokens && vote === true) { opt_2 += 1; cb.sendNotice(tip['from_user'] + ' has voted for ' + cb.settings.opt2_label,'','',warning,''); } vote_result(opt_1,opt_2); total_tipped += tip['amount'] if (total_tipped > cb.settings.tokens) { total_tipped = cb.settings.tokens; } update_subject(); last_tip_amount = tip['amount'] last_tip_username = tip['from_user'] if (tip['amount'] > high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } cb.drawPanel(); }); // команды cb.onMessage(function (msg) { // если модератор или бродкастер if (msg['is_mod'] == true || msg['user'] == cb.room_slug) { // включить опрос if (msg['m'] == '/pollon') { msg['X-Spam'] = true; vote = true; msg['m'] = ''; cb.sendNotice('You have enabled a Poll',msg['user'],'',warning,''); cb.sendNotice('A poll on the topic "' + cb.settings.vote_description +'" has started\nTip ' + cb.settings.opt1_tokens +' tokens for the "' + cb.settings.opt1_label +'"\nTip ' + cb.settings.opt2_tokens +' tokens for the "' + cb.settings.opt2_label +'"\nWhat do you like best? Please vote!','','',warning,''); } // выключить опрос if (msg['m'] == '/polloff') { msg['X-Spam'] = true; vote = false; msg['m'] = ''; cb.sendNotice('You have disabled a Poll',msg['user'],'',warning,''); } if (msg['m'] == '/help') { msg['X-Spam'] = true; msg['m'] = ''; cb.sendNotice('/help - Show this text (only for broadcaster and moderator)',msg['user'],'',warning,''); cb.sendNotice('/winfo - Shows statistics: the number of games played, the number of tokens earned on the game, the Rare Prize mode is enabled or disabled.',msg['user'],'',warning,''); cb.sendNotice('/rareon - Enables Rare Prize mode. Rare Prize is participating in the game and can roll randomly.',msg['user'],'',warning,''); cb.sendNotice('/rareoff - Disables the Rare Prize mode. A Rare Prize will never roll.',msg['user'],'',warning,''); } return msg; } else { if (msg['m'] == '/help') { msg['X-Spam'] = true; cb.sendNotice('It\'s a simple game. There are 12 prizes, including one Super Prize. Today my super prize is a . You send ' + cb.settings.tokens + ' tokens. The bot randomly selects one from the list of prizes and shows it in the chat. Please play, I hope you\'re lucky!',msg['user'],'',info,''); } return msg; } }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Goal is ' + cb.settings.goal_description, 'row1_value': tips_remaining() + ' tokens left', 'row2_label': 'Highest Tip:', 'row2_value': format_username(high_tip_username) + ' (' + high_tip_amount + ')', 'row3_label': 'Latest Tip Received:', 'row3_value': format_username(last_tip_username) + ' (' + last_tip_amount + ')' }; }); /* оригинальный вариант панели cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Tip Received / Goal :', 'row1_value': '' + total_tipped + ' / ' + cb.settings.tokens, 'row2_label': 'Highest Tip:', 'row2_value': format_username(high_tip_username) + ' (' + high_tip_amount + ')', 'row3_label': 'Latest Tip Received:', 'row3_value': format_username(last_tip_username) + ' (' + last_tip_amount + ')' }; }); */ // helper functions function update_subject() { if (tips_remaining() == 0) { if (subject_is_set_with_0) { return; } subject_is_set_with_0 = true; } else { subject_is_set_with_0 = false; } var new_subject = cb.settings.goal_description + ' (' + tips_remaining() + ' tokens left)'; cb.log("Changing subject to: " + new_subject + ' ' + cb.settings.tags); cb.changeRoomSubject(new_subject + ' ' + cb.settings.tags); } function tips_remaining() { var r = cb.settings.tokens - total_tipped; if (r < 0) { return 0; } else { return r; } } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function vote_result(val_1, val_2) { if (vote === true) { cb.sendNotice('"' + cb.settings.vote_description + '" Voting results:\n' + cb.settings.opt1_label + ' - ' + val_1 + ' votes\n' + cb.settings.opt2_label + ' - ' + val_2 + ' votes','','',warning,''); } } function init() { update_subject(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.