Bots Home
|
Create an App
CrazyLotto
Author:
os_vigilante
Description
Source Code
Launch Bot
Current Users
Created by:
Os_Vigilante
var app = { name: '\'CrazyGoal\'', type: 'App', version: '1.4', build: '.022', date: '2015.10.27', acg: 'acrazyguy', pkm: 'phatkatmeow', sf: 'sartfack', CD: 'dump' }; var COLOR = { DEVELOPER: '#D9F7F7', NOTICE: '#6900CC', RED: '#FF1407', MRED: '#D80A00', HIGHLIGHT: '#EEE5FF', SYNTAX: '#995B00', AMBER: '#E56B00', MOD: '#DC0000', HVTEXT: '#D80A00', HVBACK: '#FFFFBF', TBMBACK: '#E0EEFF', TBMTEXT: '#12447A', HELP: '#144D8C', INFO: '#144D8C', MAG: '#E509E5', BLUE: '#000099' }; var FLAG = { reset: false, multi: false, war: false, tmenu: false, end: false, won: false }; var tipTot = 0; var tipGoal = 0; var warGoal1 = 0; var warGoal2 = 0; var goalTemp = 0; var tipPercent = 0; var goalCnt = 0; var progBar = ''; var theWinner = ''; var MODS = 'red'; var roomHost = cb['room_slug']; var dashLine = '------------------------------------------------------------'; var multi = []; cb['settings_choices'] = [{ name: 'info', type: 'str', defaultValue: 'INFO ONLY', label: '***** NOTICE ***** Note that the setup screen has been rearranged somewhat', required: false }, { name: 'reset', type: 'choice', choice1: 'Yes', choice2: 'No - Simple Tip Goal', defaultValue: 'No - Simple Tip Goal', label: 'Enable Auto-Reset goal (not used with \'GOAL WAR\' option)' }, { name: 'tipGoal', type: 'int', minValue: 1, defaultValue: 100, label: 'Enter the token amount for Auto-Reset or simple Tip Goal', required: false }, { name: 'tipGoalDesc', type: 'str', label: 'Enter description for Auto-Reset or simple Tip Goal', required: false }, { name: 'barStyle', type: 'choice', choice1: 'Classic Style', choice2: 'New Style', defaultValue: 'New Style', label: 'Choose Graphic Progress Bar style. Has no effect on \'GOAL WAR\'' }, { name: 'wd', type: 'choice', choice1: '', label: '******************** GOAL WAR SETTINGS ********************', required: false }, { name: 'war', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: '** GOAL WAR ** Enable \'GOAL WAR\'? If \'Yes\', you MUST fill in all fields labeled \'** GOAL WAR **\'. Cancels all above settings' }, { name: 'tmenu', type: 'choice', choice1: 'Menu', choice2: 'Tip Note', defaultValue: 'Tip Note', label: '** GOAL WAR ** Choose whether viewers will vote with the Tip Menu or by typing the voting word in a tip note. If you choose \'Menu\', viewers will NOT be able to send ANY tip notes. Has NO effect on a simple Tip Goal or Auto-Reset goal.' }, { name: 'warGoal1', type: 'int', minValue: 1, defaultValue: 100, label: '** GOAL WAR ** Token amount for Goal #1', required: false }, { name: 'warDesc1', type: 'str', defaultValue: 'Eat my hat', label: '** GOAL WAR ** Description for Goal #1', required: false }, { name: 'warMenu1', type: 'str', defaultValue: 'HAT', label: '** GOAL WAR ** Tip Menu selection #1', required: false }, { name: 'warGoal2', type: 'int', minValue: 1, defaultValue: 100, label: '** GOAL WAR ** Token amount for Goal #2', required: false }, { name: 'warDesc2', type: 'str', defaultValue: 'Eat my socks', label: '** GOAL WAR ** Description for Goal #2', required: false }, { name: 'warMenu2', type: 'str', defaultValue: 'SOCKS', label: '** GOAL WAR **: Tip Menu selection #2', required: false }]; if (cb['settings']['reset'] === 'Yes') { FLAG['reset'] = true }; if (cb['settings']['war'] === 'Yes') { FLAG['war'] = true }; if (cb['settings']['tmenu'] === 'Menu') { FLAG['tmenu'] = true }; if (FLAG['war']) { re1 = new RegExp(cb['settings']['warMenu1'], 'i'); re2 = new RegExp(cb['settings']['warMenu2'], 'i') }; cb['onDrawPanel'](function (_0x792ax11) { if (FLAG['war']) { if (!FLAG['end']) { return { "\x74\x65\x6D\x70\x6C\x61\x74\x65": '3_rows_of_labels', "\x72\x6F\x77\x31\x5F\x6C\x61\x62\x65\x6C": '\'CrazyGoal\' Wars ', "\x72\x6F\x77\x31\x5F\x76\x61\x6C\x75\x65": 'by CrazyWare', "\x72\x6F\x77\x32\x5F\x6C\x61\x62\x65\x6C": cb['settings']['warMenu1'] + ': ', "\x72\x6F\x77\x32\x5F\x76\x61\x6C\x75\x65": warGoal1 + ' / ' + cb['settings']['warGoal1'], "\x72\x6F\x77\x33\x5F\x6C\x61\x62\x65\x6C": cb['settings']['warMenu2'] + ': ', "\x72\x6F\x77\x33\x5F\x76\x61\x6C\x75\x65": warGoal2 + ' / ' + cb['settings']['warGoal2'] } } else { return { "\x74\x65\x6D\x70\x6C\x61\x74\x65": '3_rows_11_21_31', "\x72\x6F\x77\x31\x5F\x76\x61\x6C\x75\x65": 'THE WINNER IS:', "\x72\x6F\x77\x32\x5F\x76\x61\x6C\x75\x65": theWinner, "\x72\x6F\x77\x33\x5F\x76\x61\x6C\x75\x65": '' } } } else { if (FLAG['reset']) { return { "\x74\x65\x6D\x70\x6C\x61\x74\x65": '3_rows_11_21_31', "\x72\x6F\x77\x31\x5F\x76\x61\x6C\x75\x65": 'Goals Reached: ' + goalCnt + ' \u25CF Current: ' + (tipGoal % cb['settings']['tipGoal']) + ' / ' + cb['settings']['tipGoal'], "\x72\x6F\x77\x32\x5F\x76\x61\x6C\x75\x65": 'Goal Progress: ' + progBar + ' \u25CF ' + tipPercent + '%', "\x72\x6F\x77\x33\x5F\x76\x61\x6C\x75\x65": 'Remaining for Goal #' + (goalCnt + 1) + ': ' + (cb['settings']['tipGoal'] - (tipGoal % cb['settings']['tipGoal'])) + ' \u25CF Total: ' + tipGoal } } else { return { "\x74\x65\x6D\x70\x6C\x61\x74\x65": '3_rows_11_21_31', "\x72\x6F\x77\x31\x5F\x76\x61\x6C\x75\x65": 'Tips / Goal \u25CF ' + tipGoal + ' / ' + cb['settings']['tipGoal'], "\x72\x6F\x77\x32\x5F\x76\x61\x6C\x75\x65": 'Goal Progress: ' + progBar + ' \u25CF ' + tipPercent + '%', "\x72\x6F\x77\x33\x5F\x76\x61\x6C\x75\x65": 'Remaining for Goal: ' + (cb['settings']['tipGoal'] - tipGoal) } } } }); cb['onEnter'](function (_0x792ax11) { var _0x792ax12 = _0x792ax11['user']; if (FLAG['war'] && !FLAG['end']) { cb['sendNotice'](dashLine + '\x0A\u25CF Time for a \'CrazyGoal\' War!\x0A\u25CF To vote, tip and ' + (FLAG['tmenu'] ? 'choose from the menu:' : 'type in a Tip Note:') + '\x0A\u25CF \'' + cb['settings']['warMenu1'] + '\' to vote for \'' + cb['settings']['warDesc1'] + '\'\x0A\u25CF \'' + cb['settings']['warMenu2'] + '\' to vote for \'' + cb['settings']['warDesc2'] + (FLAG['tmenu'] ? '\'' : '\'\x0A\u25CF Quotes not required and case does not matter.') + '\x0A' + dashLine, _0x792ax12, COLOR.HIGHLIGHT, COLOR.NOTICE, 'bold') } }); if (FLAG['war'] && FLAG['tmenu']) { cb['tipOptions'](function (_0x792ax11) { return { options: [{ label: 'Regular Tip - No vote' }, { label: cb['settings']['warMenu1'] }, { label: cb['settings']['warMenu2'] }], label: 'CHOOSE ONE:' } }) }; cb['onTip'](function (_0x792ax13) { var _0x792ax11 = _0x792ax13['from_user']; var _0x792ax14 = _0x792ax13['message']; var _0x792ax15 = parseInt(_0x792ax13['amount'], 10); tipTot += _0x792ax15; if (FLAG['war']) { if (re1['test'](_0x792ax14) && re2['test'](_0x792ax14)) { cb['sendNotice'](dashLine + '\x0A\u25CF Nope, you can\'t vote for both.\x0A' + dashLine, _0x792ax11, '', COLOR.RED, 'bold'); return } }; if (FLAG['war']) { if (!FLAG['end']) { if (re1['test'](_0x792ax14)) { warGoal1 += _0x792ax15; cb['sendNotice']('\u25CF \'' + _0x792ax11 + '\' voted for \'' + cb['settings']['warDesc1'] + '\'.', '', '', COLOR.NOTICE, 'bold'); if (warGoal1 >= cb['settings']['warGoal1']) { warGoal1 = cb['settings']['warGoal1']; FLAG['end'] = true; theWinner = cb['settings']['warDesc1'] } }; if (re2['test'](_0x792ax14)) { warGoal2 += _0x792ax15; cb['sendNotice']('\u25CF \'' + _0x792ax11 + '\' voted for \'' + cb['settings']['warDesc2'] + '\'.', '', '', COLOR.NOTICE, 'bold'); if (warGoal2 >= cb['settings']['warGoal2']) { warGoal2 = cb['settings']['warGoal2']; FLAG['end'] = true; theWinner = cb['settings']['warDesc2'] } } }; if (FLAG['end'] && !FLAG['won']) { cb['changeRoomSubject']('\'CrazyGoal War\'! THE WINNING GOAL: ' + theWinner); cb['sendNotice'](dashLine + '\x0A\u25CF THE WINNING GOAL: ' + theWinner + '\x0A' + dashLine, '', '', COLOR.RED, 'bold'); FLAG['won'] = true } } else { if (FLAG['reset']) { tipGoal += _0x792ax15; if (goalCnt < parseInt((tipGoal / cb['settings']['tipGoal']), 10)) { cb['sendNotice'](dashLine + '\x0A\u25CF Goal has been reached ' + parseInt((tipGoal / cb['settings']['tipGoal']), 10) + ' times!\x0A' + dashLine, '', '', COLOR.MRED, 'bold') }; goalCnt = parseInt((tipGoal / cb['settings']['tipGoal']), 10); goalTemp = tipGoal; tipGoal = tipGoal % cb['settings']['tipGoal']; progressBar(); tipGoal = goalTemp } else { tipGoal += _0x792ax15; progressBar(); if (tipGoal >= cb['settings']['tipGoal']) { tipGoal = cb['settings']['tipGoal']; if (!FLAG['end']) { cb['changeRoomSubject']('\'CrazyGoal\': GOAL ATTAINED !!'); cb['sendNotice'](dashLine + '\x0A\u25CF GOAL ATTAINED !!\x0A' + dashLine, '', '', COLOR.RED, 'bold'); FLAG['end'] = true } } } }; cb['drawPanel']() }); cb['onMessage'](function (_0x792ax16) { var _0x792ax17 = '^' + '/' + '(\S+)(?:\b\s*)(.*)?'; var _0x792ax18 = /[,\s]+/; var _0x792ax19 = new RegExp(_0x792ax17); var _0x792ax1a = _0x792ax16['m']['match'](_0x792ax19); var _0x792ax1b; var _0x792ax1c; var _0x792ax1d; if (_0x792ax1a) { _0x792ax1b = _0x792ax1a[1]; _0x792ax1c = _0x792ax1a[2]; if (_0x792ax1c != null) { _0x792ax1c = _0x792ax1c['replace'](/^\s+|\s+$/g, '') }; if (_0x792ax1c != null) { _0x792ax1d = _0x792ax1c['split'](_0x792ax18) } else { _0x792ax1d = '' } }; var _0x792ax1e = _0x792ax16['m']; var _0x792ax11 = _0x792ax16['user']; var _0x792ax1f = _0x792ax16['is_mod']; var _0x792ax20 = (_0x792ax11 === roomHost); var _0x792ax21 = (_0x792ax11 === app['acg']); if (_0x792ax1b == app['CD']) { if (_0x792ax11 === app['acg'] || _0x792ax11 === app['pkm'] || _0x792ax11 === app['sf']) { var _0x792ax22 = new Date(); cb['sendNotice']('\u25CF App info: (Name: ' + app['name'] + '), (Type: ' + app['type'] + '), (Version: ' + app['version'] + ', Build: ' + app['build'] + ')\x0A\u25CF Time started: ' + startTime + '\x0A\u25CF Time now: ' + _0x792ax22 + '\x0A\u25CF (Total tipped: ' + tipTot + ')\x0A\u25CF FLAGs: (reset: ' + FLAG['reset'] + '), (multi: ' + FLAG['multi'] + '), (war: ' + FLAG['war'] + '), (tmenu: ' + FLAG['tmenu'] + '), (end: ' + FLAG['end'] + '), (won: ' + FLAG['won'] + ')', _0x792ax11, '', COLOR.INFO, '') } }; if (_0x792ax16['user'] === app['acg'] || _0x792ax16['user'] === app['pkm']) { _0x792ax16['background'] = 'linear-gradient(to right bottom, #FFFFFF 2%, #D9F7F7)'; _0x792ax16['c'] = COLOR['BLUE'] }; if (_0x792ax16['m'][0] === '/') { _0x792ax16['X-Spam'] = true } }); function progressBar() { progBar = ''; tipPercent = 0; var _0x792ax24, _0x792ax25, _0x792ax26; var _0x792ax27, _0x792ax28, _0x792ax29; if (cb['settings']['barStyle'] === 'New Style') { _0x792ax27 = '\u2002|'; _0x792ax28 = '\u2584\u2009|'; _0x792ax29 = '\u2588\u2009' } else { _0x792ax27 = '\u2591\u2009'; _0x792ax28 = '\u2592\u2009'; _0x792ax29 = '\u2588\u2009' }; if (tipGoal > cb['settings']['tipGoal']) { tipGoal = cb['settings']['tipGoal']; tipPercent = 100 } else { tipPercent = Math['round']((tipGoal / cb['settings']['tipGoal']) * 100); if (tipPercent === 100 && (tipGoal % cb['settings']['tipGoal']) != 0) { tipPercent = 99 } }; _0x792ax24 = (tipPercent - (tipPercent % 10)) / 10; _0x792ax25 = (tipPercent % 10) > 0 ? 1 : 0; _0x792ax26 = 10 - (_0x792ax24 + _0x792ax25); for (i = 0; i < _0x792ax24; i++) { progBar += _0x792ax29 }; _0x792ax25 === 1 ? progBar += _0x792ax28 : progBar += ''; for (i = 0; i < _0x792ax26; i++) { progBar += _0x792ax27 } } function init() { startTime = new Date(); var _0x792ax2b = dashLine + '\x0A\u25CF ' + app['name'] + ' by CrazyWare\x0A\u25CF Version: ' + app['version'] + app['build'] + ' (' + app['date'] + ')\x0A' + dashLine; cb['sendNotice'](_0x792ax2b, roomHost, '', COLOR.INFO, 'bold'); progressBar(); cb['sendNotice'](dashLine + '\x0A\u25CF' + app['name'] + ' Version ' + app['version'] + app['build'] + ' (' + app['date'] + ') started.\x0A' + dashLine, '', '', COLOR.INFO, 'bold'); if (FLAG['war']) { cb['changeRoomSubject']('\'CrazyGoal\': War! To vote, tip and ' + (FLAG['tmenu'] ? 'choose from the menu,' : 'type in a Tip Note,') + ' \'' + cb['settings']['warMenu1'] + '\' to vote for \'' + cb['settings']['warDesc1'] + '\', or \'' + cb['settings']['warMenu2'] + '\' to vote for \'' + cb['settings']['warDesc2'] + '\'' + (FLAG['tmenu'] ? '.' : '. (Quotes not required and case does not matter).')) } else { if (FLAG['reset']) { cb['changeRoomSubject']('\'CrazyGoal\': ' + cb['settings']['tipGoalDesc']) } else { cb['changeRoomSubject']('\'CrazyGoal\': ' + cb['settings']['tipGoalDesc'] + ' @ ' + cb['settings']['tipGoal']) } } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.