Bots Home
|
Create an App
xyz123qwerty
Author:
13isnotadozen
Description
Source Code
Launch Bot
Current Users
Created by:
13isnotadozen
cb.chatNotice('97Kate-numbers bot 1.01 20190506 has started', ' ', '#ffff00', '#0000ff', 'bolder'); var guessedNumbers = []; var winner = false; var amount; var strdash = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; var nl = '\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501'; var slugtimer = 2.5; var msg_prize; function setSettings(){ cb.settings_choices = [ { name:'minNumber', type:'int', minValue: 1, default: 10, label: "Lowest number to guess" }, { name:'maxNumber', type:'int', minValue: 10, maxValue: 150, default: 50, label: "Highest number to guess" }, { name:'guessNumber', type:'int', minValue: 1, default: 37, maxValue: 150, label: "Lucky Number" }, { name:'prize', type:'str', label: "Prize to win" }, { name:'roomSubject', type:'str', label: "Add your Game Subject", defaultValue : "Lucky Numberboard" }, { name:'numberboard', type:'int', minValue: 1, maxValue: 15, default: 5, label: "Show the numberboard every ? minutes" }, ]; } cb.onTip(function (tip) { var minNumber = cb.settings.minNumber; var maxNumber = cb.settings.maxNumber; var found = false; if (winner != true) { if (tip.amount == cb.settings.guessNumber) { cb.chatNotice(strdash + " \n :winner-bobo "+"\n :yesss111 \n" + strdash +"\n" + tip.from_user + " wins : " + cb.settings.prize + "\n" + strdash, " " , "#a2a2ee","","bold"); // new_subject=" Lucky Number FOUND ! "; // cb.changeRoomSubject(new_subject); winner = true; } else { if (guessedNumbers.indexOf(tip.amount) < 0 && tip.amount <= maxNumber && tip.amount >= minNumber){ cb.chatNotice(strdash + "\n :dunno4 :dunnoz :sorry5 \n Not the Lucky number ............... keep trying !!!!!!! " + "\n" + strdash, " " , "#a2a2ee", "", "bold"); guessedNumbers.push(tip.amount); guessedNumbers.sort(function(a,b){ return a-b; }); updateBoard(); } } } else { return; } } ); function update_subject(minNumber, maxNumber, prize, roomSubject) { var new_subject = roomSubject + "\n Prize: " + prize ; // cb.changeRoomSubject(new_subject); } function msg_gamesubject(minNumber, maxNumber, prize) { var new_gs = "Lucky Number from " + minNumber + " to " + maxNumber ; msg_prize = new_gs; msg_send(null); } function msg_send(user){ if (user) { cb.sendNotice(msg_prize, user,'#a2a2ee','','bold') } else { cb.sendNotice(msg_prize,'','#a2a2ee','','bold') } } function drawBoard(user) { if (user) { cb.sendNotice(board, user, '#a2a2ee','','bold' ) } else { cb.sendNotice(board,'','#a2a2ee','','bold') } } function pad(number, length) { var str = '' + number; while (str.length < length) { str = '0' + str } return str } function updateBoard() { var out = "Number Board\n"; out += "Prize : " + cb.settings.prize + "\n" ; out += nl + '\n'; var mod = 10; var col = 1; if (cb.settings.maxNumber - cb.settings.minNumber > 100) mod = 15; for (var i = cb.settings.minNumber; i <= cb.settings.maxNumber; i++) { out += ' '; if (guessedNumbers.indexOf(i) < 0 ) { out += pad(i,2) } else { out += 'xx' } out += ' '; if (col == mod) { out += '\n'; col = 1 } else { col++ } } if (out.substring(out.length - 1) != '\n') out += '\n'; out += nl; board = out } function notify(message, u, bg, c, w) { if (bg == null) { bg = '#FFF'; } if (c == null) { c = '#000'; } if (w == null) { w = 'bold'; // leave at '' for normal } if (u == 'onlyMods') { cb.sendNotice(message,'',bg,c,w,'red'); } else if (u == 'roomHost') { cb.sendNotice(message,roomHost,bg,c,w); } else if (u == 'modsAndHost') { cb.sendNotice(message,'',bg,c,w,'red'); cb.sendNotice(message,roomHost,bg,c,w); } else if (u == null) { cb.sendNotice(message,'',bg,c,w); } else { cb.sendNotice(message,u,bg,c,w); } } cb.onMessage(function (msg) { var msgString = msg['m'].trim(); var isCommand = msgString.charAt(0).match(/(\/|!)/gi); if (isCommand) { // Lucky Number Board if (msg['m'].match(/(^|\s)(!|\/)b\b/i)) { if (msg['user'] == cb.room_slug || msg['is_mod']) { cb.sendNotice('To send the board to the entire room, use //b or !!b', msg['user'], '#FFCCCC', '#BB2222', 'bold') } if (msg['user'] == cb.room_slug || msg['is_mod'] || msg['has_tokens']) { msg['m'] = msg['m'] + " (lucky number: board sent to " + msg['user'] + ")"; drawBoard(msg['user']) } else { msg['m'] = msg['m'] + " (lucky number: please buy tokens to play!)"; msg['X-Spam'] = true } } if (msg['m'].match(/(^|\s)(!!|\/\/)b\b/i)) { if (msg['user'] == cb.room_slug || msg['is_mod']) { msg['m'] = msg['m'] + " (lucky number: board sent to all)"; drawBoard(null) } } // Send lucky name title and Prize if (msg['m'].match(/(^|\s)(!|\/)p\b/i)) { if (msg['user'] == cb.room_slug || msg['is_mod']) { cb.sendNotice('To send the prize list to the entire room, use //p or !!p', msg['user'], '#FFCCCC', '#BB2222', 'bold') } if (msg['user'] == cb.room_slug || msg['is_mod'] || msg['has_tokens']) { msg['m'] = msg['m'] + " (lucky number: prize list sent to " + msg['user'] + ")"; msg_send(msg['user']) } else { msg['m'] = msg['m'] + " (lucky number: please buy tokens to play!)"; msg['X-Spam'] = true } } if (msg['m'].match(/(^|\s)(!!|\/\/)p\b/i)) { if (msg['user'] == cb.room_slug || msg['is_mod']) { msg['m'] = msg['m'] + " (lucky number: prize list sent to all)"; msg_send(null); } } // Send Version if (msg['m'].match(/(^|\s)(!|\/)version\b/i)) { cb.sendNotice(VERSION, msg['user']) } return msg } }); function advert_game() { if (! winner) { msg_gamesubject(cb.settings.minNumber, cb.settings.maxNumber, cb.settings.prize); cb.setTimeout(advert_game, (slugtimer * 60000)); } } function advert_board() { if (! winner) { updateBoard(); drawBoard(null); cb.setTimeout(advert_board, (cb.settings.numberboard * 60000)); } } function init() { setSettings(); if (cb.settings.minNumber <= cb.settings.maxNumber && cb.settings.guessNumber >= cb.settings.minNumber && cb.settings.guessNumber <= cb.settings.maxNumber) { // update_subject(cb.settings.minNumber, cb.settings.maxNumber, cb.settings.prize, cb.settings.roomSubject); msg_gamesubject(cb.settings.minNumber, cb.settings.maxNumber, cb.settings.prize); updateBoard(); drawBoard(null); cb.setTimeout(advert_board, (cb.settings.numberboard * 60000)); cb.setTimeout(advert_game, (slugtimer * 60000)); } else { cb.sendNotice('ERROR: \nLowest number can\'t be bigger than Highest number,\nLucky Number must be between Lowest and Highest number,\nrestart the app and change the settings', cb.room_slug) } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.