Bots Home
|
Create an App
BPM or Metronome
Author:
tvaeera
Description
Source Code
Launch Bot
Current Users
Created by:
Tvaeera
var tip_amt = 0; var separator_char = "| "; var msg; var MAXITEMS=20; var tipmenuprice = []; var tipmenuitem= []; var tipmenuBPM= []; var MAXSEP = 6; var global_BPM; separators = [ {label:'Hearts',shortcut:':heart2'}, {label:'Glitter',shortcut:':pixelglitter'}, {label:'Flowers',shortcut:':tinyflower2'}, {label:'Bow',shortcut:':bluebow'}, {label:'Hearts2',shortcut:':pixelheart'}, {label:'Smiley',shortcut:':smile'}, ] cb.settings_choices = [ {name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3:'Glitter', choice4:'Flowers', choice5:'Bow', choice6:'Hearts2', choice7:'Smiley', label: 'Separator character', defaultValue: 'Hearts2'}, {name: 'menu_style', type: 'choice', choice1: 'single', choice2: 'multi', defaultValue: 'single', label: 'Single or multi line menu style?'}, {name:'bpm_start', type:'int', label:'Start Beats Per Minute Value', defaultValue: '60'}, {name:'bpm_max', type:'int', label:'Maximum Beats Per Minute Value', defaultValue: '300'}, {name:'item1', type:'str', label:'Item 1 (eg 10--flash tits)', defaultValue: '3--FASTER--+1'}, {name:'item2', type:'str', required: false, label:'Item 2', defaultValue: ''}, {name:'item3', type:'str', required: false, label:'Item 3', defaultValue: ''}, {name:'item4', type:'str', required: false, label:'Item 4', defaultValue: ''}, {name:'item5', type:'str', required: false, label:'Item 5', defaultValue: ''}, {name:'item6', type:'str', required: false, label:'Item 6', defaultValue: ''}, {name:'item7', type:'str', required: false, label:'Item 7', defaultValue: ''}, {name:'item8', type:'str', required: false, label:'Item 8', defaultValue: ''}, {name:'item9', type:'str', required: false, label:'Item 9', defaultValue: ''}, {name:'item10', type:'str', required: false, label:'Item 10', defaultValue: ''}, {name:'item11', type:'str', required: false, label:'Item 11', defaultValue: ''}, {name:'item12', type:'str', required: false, label:'Item 12', defaultValue: ''}, {name:'item13', type:'str', required: false, label:'Item 13', defaultValue: ''}, {name:'item14', type:'str', required: false, label:'Item 14', defaultValue: ''}, {name:'item15', type:'str', required: false, label:'Item 15', defaultValue: ''}, {name:'item16', type:'str', required: false, label:'Item 16', defaultValue: ''}, {name:'item17', type:'str', required: false, label:'Item 17', defaultValue: ''}, {name:'item18', type:'str', required: false, label:'Item 18', defaultValue: ''}, {name:'item19', type:'str', required: false, label:'Item 19', defaultValue: ''}, {name:'item20', type:'str', required: false, label:'Item 20', defaultValue: ''}, {name:'noticecolor', type:'str', label:'Notice color (html code default pink #FF00FF)', defaultValue: '#FF00FF'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notice being displayed (minimum 1)'} ]; cb.onTip(function (tip) { tip_amt=parseInt(tip['amount']); for (var i = 1; i <= MAXITEMS; i++) { if (tip_amt == tipmenuprice[i]) { var bpm = tipmenuBPM[i]; var initial_BPM = global_BPM; var limit = ''; if (bpm.charAt(0) === "=") { bpm = bpm.substr(1); global_BPM = parseInt(bpm); } else if (bpm.charAt(0) === "+" || bpm.charAt(0) === "-") { global_BPM = global_BPM + parseInt(bpm); if (global_BPM < cb.settings['bpm_start']) { global_BPM = cb.settings['bpm_start']; limit = 'minimum '; } else if (global_BPM > cb.settings['bpm_max']) { global_BPM = cb.settings['bpm_max']; limit = 'maximum '; } } cb.sendNotice(tip['from_user'] + ' tipped for ' + tipmenuitem[i] + ' [BPM'+ initial_BPM + tipmenuBPM[i] + '] => '+ limit + '[BPM' + global_BPM + ']', '', '', cb.settings['noticecolor'], 'bold'); } } }); cb.onEnter(function(user) { cb.sendNotice('Tip menu is active! Type /menu to see the full menu.', user['user'], '',cb.settings['noticecolor'], ''); }); cb.onMessage(function (msg) { if (msg['m'].indexOf("/") == 0) { if (msg['m'] == '/menu') { msg['X-Spam'] = true; cb.sendNotice(tmm, msg['user'],'',cb.settings['noticecolor'],'bold'); } if (msg['user'] == (cb.room_slug || msg['is_mod'])) { if (msg['m'] == '/menuall') { msg['X-Spam'] = true; cb.sendNotice(tmm,'','',cb.settings['noticecolor'],'bold'); } if (msg['m'] == '/menustyle') { msg['X-Spam'] = true; if (cb.settings.menu_style == 'single') { cb.settings.menu_style = 'multi'; } else { cb.settings.menu_style = 'single'; } cb.sendNotice('Menu style changed to ' + cb.settings.menu_style + ' line menu!', cb.room_slug,'', '',''); cb.sendNotice('Menu style changed to ' + cb.settings.menu_style + ' line menu!', '','', '','', 'red'); get_menu(); } } } }); function chatAd() { cb.sendNotice(tmm,'','',cb.settings['noticecolor'],'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); function get_menu() { tmm = 'BeatsPerMinute Menu: '; if (cb.settings.menu_style == 'multi') { tmm += '\n' + separator_char; } for (i=1;i<=MAXITEMS;i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr= tmp.split('--'); var amt=parseInt(arr[0]); var bpm=arr[2]; if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[1]; tipmenuBPM[i]=bpm; if (i>=2) { if (cb.settings.menu_style == 'multi') { tmm += '\n'; } tmm += separator_char; } tmm += arr[1] + ' (' + amt + ' tokens for [BPM'+bpm+'] )'; } } } } function init() { for (i=0;i<=MAXSEP-1;i++) { if (cb.settings['sepchar'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } global_BPM = cb.settings['bpm_start']; get_menu(); cb.sendNotice(tmm,'','',cb.settings['noticecolor'],'bold'); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.