Bots Home
|
Create an App
SM2
Author:
like69xxx
Description
Source Code
Launch Bot
Current Users
Created by:
Like69xxx
/** * Bot: Slot Machine Bot V.2.0.1 * Version: 2.0.1 * Original Bot: zingknaat * Author: like69x * Date: 02.14.18 * New objects: :sm2_cb, :sm2_crown, :sm2_nora, :sm2_seven, sm2_lingerie, sm2_lush, :sm2_rainbow, sm2_whip, :sm2_condom, :sm2_cherry */ cb.settings_choices = [ {name: 'tokens', type: 'int', label: 'Cost per spin (in tokens)', defaultValue: 4}, {name: 'notice_wait_time', type: 'choice', label: 'Notification Time (in minutes)', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 10, choice7: 15, choice8: 20, choice9: 25, choice10: 30, choice11: 45, choice12: 60, defaultValue: 3}, {name: 'jackpot_minimum', type:'int', label:'Minimum number tokens before jackpot', defaultValue:5000}, {name: 'prize_1', type: 'str', label: 'Jackpot prize (3 cb_logos)', defaultValue:'cum'}, {name: 'prize_2', type: 'str', label: '2nd place prize (3 crowns)'}, {name: 'prize_3', type: 'str', label: '3rd place prize (3 lush)'}, {name: 'prize_4', type: 'str', label: '4th place prize (3 sevens)'}, {name: 'prize_5', type: 'str', label: '5th place prize (3 noras)'}, {name: 'prize_6', type: 'str', label: '6th place prize (3 rainbows)'}, {name: 'prize_7', type: 'str', label: '7th place prize (3 whips)'}, {name: 'prize_8', type: 'str', label: '8th place prize (any object and 2 cherries)'}, {name: 'prize_9', type: 'str', label: '9th place prize (any combination of condom/cb-logo)'}, {name: 'prize_10', type: 'str', label: '10th place prize (any combination and 1 cherry)'} ]; var langTokens = (cb.settings.tokens > 1) ? 'tokens' : 'token'; var lastPlayer = '--'; var lastPrizeWon = '--'; var spinCounter = 0; var tipCounter = 0; var prizesWon = Array(); var cb_logo = ' :sm2_cb '; var crown = ' :sm2_crown '; var lush = ' :sm2_lush '; var seven = ' :sm2_seven '; var nora = ' :sm2_nora '; var rainbow = ' :sm2_rainbow '; var whip = ' :sm2_whip '; var condom = ' :sm_condom '; var cherry = ' :sm2_cherry '; var slotPieces = Array(cb_logo, crown, lush, seven, nora, rainbow, whip, condom, cherry); cb.onTip(function (tip) { tipCounter += parseInt(tip['amount']); if (parseInt(tip['amount']) >= cb.settings.tokens) { var numberOfSpins = Math.floor(parseInt(tip['amount'])/cb.settings.tokens); for(var i=1;i<=numberOfSpins;i++) { cb.setTimeout(function() { spin(tip['from_user']); }, 400*i); } } }); cb.onEnter(function (user) { var notices = "Welcome to my room, " + user['user'] + ". We are playing the slot machine.\n"; notices += 'Tip ' + cb.settings.tokens + ' ' + langTokens + ' to spin the reels.\n'; notices += 'Only the highest prize wins, if there is more than one prize.\n'; notices += 'Type "/p" to see the 10 possible prizes.\n'; notices += 'Type "/w" to see a list of the last 20 winners.'; cb.sendNotice(notices, user['user'], '', '#FF6600', 'bold'); }); cb.onMessage(function(msg) { if(msg['m'].match(/\/w/i)) { msg['X-Spam'] = true; showPrizesWon(msg['user']); } else if(msg['m'].match(/\/p/i)) { msg['X-Spam'] = true; showPrizes(msg['user']); } return msg; }); function getSlotPiece() { var piece = slotPieces[Math.floor(Math.random() * slotPieces.length)]; if((piece == cb_logo) && (spinCounter%2 != 0)) { return cherry; } return piece; } function getRow() { var row = getSlotPiece() + ' ' + getSlotPiece() + ' ' + getSlotPiece(); var cb_logoMatches = row.match(/cb_logo/g); if(cb_logoMatches != null) { var numberOfCb_logos = cb_logoMatches.length; } if((numberOfCb_logos == 3) && (cb.settings.jackpot_minimum > tipCounter)) { getRow(); } return row; } function spin(username) { spinCounter++; var prize = '--'; var row1 = getRow(); var row2 = getRow(); var row3 = getRow(); var cb_logoMatches = row2.match(/cb_logo/g); if(cb_logoMatches != null) { var numberOfCb_logos = cb_logoMatches.length; } var crownMatches = row2.match(/crown/g); if(crownMatches != null) { var numberOfCrowns = crownMatches.length; } var lushMatches = row2.match(/lush/g); if (lushMatches != null) { var numberOfLushs = lushMatches.length; } var sevenMatches = row2.match(/seven/g); if(sevenMatches != null) { var numberOfSevens = sevenMatches.length; } var noraMatches = row2.match(/nora/g); if(noraMatches != null) { var numberOfNoras = noraMatches.length; } var rainbowMatches = row2.match(/rainbow/g); if (rainbowMatches != null) { var numberOfRainbows = rainbowMatches.length; } var whipMatches = row2.match(/whip/g); if (whipMatches != null) { var numberOfWhips = whipMatches.length; } var condomMatches = row2.match(/condom/g); if (condomMatches != null) { var numberOfCondoms = condomMatches.length; } var cherryMatches = row2.match(/cherry/g); if (cherryMatches != null) { var numberOfCherries = cherryMatches.length; } var notices = row1 + "\n"; notices += row2 + " <-- pay line \n"; notices += row3; cb.sendNotice(notices); if (numberOfCb_logos == 3) { prize = cb.settings.prize_1; } else if (numberOfCrowns == 3) { prize = cb.settings.prize_2; } else if (numberOfLushs == 3) { prize = cb.settings.prize_3; } else if (numberOfSevens == 3) { prize = cb.settings.prize_4; } else if (numberOfNoras == 3) { prize = cb.settings.prize_5; } else if (numberOfRainbows == 3) { prize = cb.settings.prize_6; } else if (numberOfWhips == 3) { prize = cb.settings.prize_7; } else if ((numberOfCherries == 2) || (numberOfCherries == 3)) { prize = cb.settings.prize_8; } else if ((numberOfCondoms == 1 && numberOfCb_logos == 2) || (numberOfCondoms == 2 && numberOfCb_logos == 1)) { prize = cb.settings.prize_9; } else if (numberOfCherries == 1) { prize = cb.settings.prize_10; } lastPlayer = username; if(prize != '--') { lastPlayer = username; lastPrizeWon = prize; prizesWon.push(prize + ' - ' + username); cb.sendNotice(username + ' won a prize! Prize: ' + prize, '', '#99FF99', '', 'bold'); } else { cb.sendNotice(username + ' did not win anything. :cry', '', '', '#996633', 'bold'); } return prize; } function showPrizes(username) { var notices = '**** Possible Prizes ****\n'; notices += '1st) 3 cb_logos (jackpot) = ' + cb.settings.prize_1 + '\n'; notices += '2nd) 3 crowns = ' + cb.settings.prize_2 + '\n'; notices += '3rd) 3 lush = ' + cb.settings.prize_3 + '\n'; notices += '4th) 3 sevens = ' + cb.settings.prize_4 + '\n'; notices += '5th) 3 noras = ' + cb.settings.prize_5 + '\n'; notices += '6th) 3 rainbow = ' + cb.settings.prize_6 + '\n'; notices += '7th) 3 whips = ' + cb.settings.prize_7 + '\n'; notices += '8th) Any piece + 2 cherries = ' + cb.settings.prize_8 + '\n'; notices += '9th) Any combination of condom/cb_logo = ' + cb.settings.prize_9 + '\n'; notices += '10th) Any combination + 1 cherry = ' + cb.settings.prize_10; cb.sendNotice(notices, username, '#D1F0FF', '', 'bold'); } function showPrizesWon(username) { prizesWon.reverse(); if(prizesWon.length == 0) { cb.sendNotice('No one has won anything yet. Play the slot machine to win a prize!', username, '', '#CC0000', 'bold'); } else { prizesWon.slice(0,20); var notices = "**** Last 20 Winners ****"; var prizeNum = 1; var totalWon = prizesWon.length; if(prizesWon.length >= 20) totalWon = 20; for(var i=0; i<totalWon;i++) { notices += "\n" + prizeNum + ") " + prizesWon[i]; prizeNum++; } cb.sendNotice(notices, username, '#EBFFEB', '', 'bold'); } } function SM2advertise() { var notices = "Slot Machine V.2.0.1 by like69x\n"; notices += 'Tip ' + cb.settings.tokens + ' ' + langTokens + ' to spin the reels.\n'; notices += 'Only the highest prize wins, if there is more than one prize.\n'; notices += 'Type "/p" to see the 10 possible prizes.\n'; notices += 'Type "/w" to see a list of the last 20 winners.'; cb.sendNotice(notices, '', '', '#FF6600', 'bold'); cb.setTimeout(SM2advertise, cb.settings.notice_wait_time * 60000); } function SM2init() { SM2advertise(); } SM2init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.