Bots Home
|
Create an App
Test hmcsmaplesyrup 1
Author:
hmcsmaplesyrup
Description
Source Code
Launch Bot
Current Users
Created by:
Hmcsmaplesyrup
/** * Title: Floridawetdreams Slots * Author: Floridawetdreams * Edited by: hmcsmaplesyrup * Edited for: Leialux_ */ /* * Setup vars */ var botVersion = "by"; var botMsgBg = '#FFFF00'; /* * handle messages from users */ cb.onMessage(function(message) { var gender = message['gender']; var genderStr = ""; }); //end onMessage function announceBot() { statusMsg = '*** This Bot ' + botVersion + ' Floridawetdreams***'; return statusMsg; } cb.chatNotice(announceBot(),'', botMsgBg,'','bold'); cb.settings_choices = [ {name: 'tokens', type: 'int', label: 'Cost per spin (in tokens)', defaultValue: 25}, {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: 10}, {name: 'jackpot_minimum', type:'int', label:'Minimum number tokens before jackpot', defaultValue:1000}, {name: 'prize_1', type: 'str', label: 'Jackpot prize (3 leias)', defaultValue:'cum'}, {name: 'prize_2', type: 'str', label: '2nd place prize (3 deathstars)'}, {name: 'prize_3', type: 'str', label: '3rd place prize (3 c3p0s)'}, {name: 'prize_4', type: 'str', label: '4th place prize (3 yodas)'}, {name: 'prize_5', type: 'str', label: '5th place prize (any object and 2 chewbaccas)'}, {name: 'prize_6', type: 'str', label: '6th place prize (any combination of stormtrooper/leia)'}, {name: 'prize_7', type: 'str', label: '7th place prize (any combination and 1 chewbacca)'} ]; var langTokens = (cb.settings.tokens > 1) ? 'tokens' : 'token'; var lastPlayer = '--'; var lastPrizeWon = '--'; var spinCounter = 0; var tipCounter = 0; var prizesWon = Array(); var leia = ':LL_leia'; var yoda = ':LL_yoda'; var deathstar = ':LL_deathstar'; var c3p0 = ':LL_c3p0'; var chewbacca = ':LL_chewbacca'; var stormtrooper = ':LL_stormtrooper'; var slotPieces = Array(leia, yoda, deathstar, c3p0, chewbacca, stormtrooper); 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']); }, 2000*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 += 'Type "/p" to see the 7 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 == leia) && (spinCounter%2 != 0)) { return chewbacca; } return piece; } function getRow() { var row = getSlotPiece() + ' ' + getSlotPiece() + ' ' + getSlotPiece(); var leiaMatches = row.match(/leia/g); if(leiaMatches != null) { var numberOfLeias = leiaMatches.length; } if((numberOfLeias == 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 leiaMatches = row2.match(/leia/g); if(leiaMatches != null) { var numberOfLeias = leiaMatches.length; } var yodaMatches = row2.match(/yoda/g); if(yodaMatches != null) { var numberOfYodas = yodaMatches.length; } var c3p0Matches = row2.match(/c3p0/g); if (c3p0Matches != null) { var numberOfC3p0s = c3p0Matches.length; } var stormtrooperMatches = row2.match(/stormtrooper/g); if (stormtrooperMatches != null) { var numberOfStormtroopers = stormtrooperMatches.length; } var deathstarMatches = row2.match(/deathstar/g); if (deathstarMatches != null) { var numberOfDeathstars = deathstarMatches.length; } var chewbaccaMatches = row2.match(/chewbacca/g); if (chewbaccaMatches != null) { var numberOfChewbaccas = chewbaccaMatches.length; } var notices = row1 + "\n"; notices += row2 + " <-- pay line \n"; notices += row3; cb.sendNotice(notices); if (numberOfLeias == 3) { prize = cb.settings.prize_1; } else if (numberOfDeathstars == 3) { prize = cb.settings.prize_2; } else if (numberOfC3p0s == 3) { prize = cb.settings.prize_3; } else if (numberOfYodas == 3) { prize = cb.settings.prize_4; } else if ((numberOfChewbaccas == 2) || (numberOfChewbaccas == 3)) { prize = cb.settings.prize_5; } else if ((numberOfStormtroopers == 1 && numberOfLeias == 2) || (numberOfStormtroopers == 2 && numberOfLeias == 1)) { prize = cb.settings.prize_6; } else if (numberOfChewbaccas == 1) { prize = cb.settings.prize_7; } 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 Leia (jackpot) = ' + cb.settings.prize_1 + '\n'; notices += '2nd) 3 Deathstar = ' + cb.settings.prize_2 + '\n'; notices += '3rd) 3 C3P0 = ' + cb.settings.prize_3 + '\n'; notices += '4th) 3 Yoda = ' + cb.settings.prize_4 + '\n'; notices += '5th) Any character + 2 Chewbacca = ' + cb.settings.prize_5 + '\n'; notices += '6th) Any combination of Stormtrooper / Leia = ' + cb.settings.prize_6 + '\n'; notices += '7th) Any combination + 1 Chewbacca = ' + cb.settings.prize_7; 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 advertise() { var notices = "Play Slots\n"; notices += 'Tip ' + cb.settings.tokens + ' ' + langTokens + ' to Spin the Wheel.\n'; notices += 'Type "/p" to see the 7 possible prizes.\n'; notices += 'Type "/w" to see a list of the last 20 winners.'; cb.sendNotice(notices, '', '', '#FF6600', 'bold'); cb.setTimeout(advertise, cb.settings.notice_wait_time * 60000); } function init() { advertise(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.