Apps Home
|
Create an App
Lust For Lola - DICE Game
Author:
floridawetdreams
Description
Source Code
Launch App
Current Users
Created by:
Floridawetdreams
/* * Title: Floridawetdreams- Gender Bot * Author: floridawetdreams * Description: Simple Chat Bot that adds Gender Emotes to messages */ /* * Setup vars */ var botVersion = "69"; var botMsgBg = '#EDAAAA'; /* function announceBot() { statusMsg = '*** Gender Bot ' + ' by Floridawetdreams ***'; return statusMsg; } cb.chatNotice(announceBot(),'', botMsgBg,'','bold'); */ cb.settings_choices = [ {name: 'tokens', type: 'int', minValue: 1, maxValue: 100, label: 'Cost per Roll (in tokens)', defaultValue: 33}, {name:'remove_winning_prize', type:'choice', label:'Remove prize from list after each roll?', choice1:'Yes', choice2:'No', defaultValue:'No'}, {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: 'prize_2', type: 'str', label: 'If the outcome is 2, what will you do?'}, {name: 'prize_3', type: 'str', label: 'If the outcome is 3, what will you do?'}, {name: 'prize_4', type: 'str', label: 'If the outcome is 4, what will you do?'}, {name: 'prize_5', type: 'str', label: 'If the outcome is 5, what will you do?'}, {name: 'prize_6', type: 'str', label: 'If the outcome is 6, what will you do?'}, {name: 'prize_7', type: 'str', label: 'If the outcome is 7, what will you do?'}, {name: 'prize_8', type: 'str', label: 'If the outcome is 8, what will you do?'}, {name: 'prize_9', type: 'str', label: 'If the outcome is 9, what will you do?'}, {name: 'prize_10', type: 'str', label: 'If the outcome is 10, what will you do?'}, {name: 'prize_11', type: 'str', label: 'If the outcome is 11, what will you do?'}, {name: 'prize_12', type: 'str', label: 'If the outcome is 12, what will you do?'}, {name: 'prize_13', type: 'str', label: 'If the outcome is 13 (very rare), what will you do?'}, {name: 'force13', type: 'int', minValue: 0, maxValue: 300, label: 'Force a 13 every x rolls (Set to 0 for none)', defaultValue: 80}, {name:'allow0', type:'choice', label:'Allow a zero (Thank You but I cant PM Tiger)', choice1:'Yes', choice2:'No', defaultValue:'Yes'} ]; var langTokens = (cb.settings.tokens > 1) ? 'tokens' : 'token'; var dice = Array(0, 1, 2, 3, 4, 5, 6); var lastRoller = '--'; var lastPrizeWon = '--'; var rollCounter = 0; var tipCounter = 0; var winners = []; var prizes = []; cb.onTip(function (tip) { tipCounter += parseInt(tip['amount']); if (parseInt(tip['amount']) >= cb.settings.tokens) { var numberOfRolls = Math.floor(parseInt(tip['amount'])/cb.settings.tokens); for(var i=0;i<numberOfRolls;i++) { cb.setTimeout(function() { roll(tip['from_user']); lastRoller = tip['from_user']; }, 1000); } } }); cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Last prize won:', 'row1_value': lastPrizeWon, 'row2_label': 'Last player:', 'row2_value': lastRoller, 'row3_value': tipCounter + ' ' + langTokens + ' received / rolled ' + rollCounter + ' time(s)' }; }); cb.onEnter(function (user) { var notices = ""; notices += "Welcome, " + user['user'] + "! We are playing Roll The Dice. \n"; notices += "Each roll reveals a prize. There are 12 possible prizes. \n"; notices += "Tip " + cb.settings.tokens + " " + langTokens + " to roll the dice. \n"; notices += "Type /p to see the list of 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 roll(username) { rollCounter++; var notices = ""; var dice1 = dice[Math.floor(Math.random() * dice.length)]; var dice2 = dice[Math.floor(Math.random() * dice.length)]; if (rollCounter%10 == 0) { if((dice1 == 1) && (dice2 != 1)) { dice1 = 7; } if((dice2 == 1) && (dice1 != 1)) { dice2 = 7; } } var total = dice1 + dice2; if (cb.settings['allow0'] == 'No' && total==0) { total=2; dice1=1; dice2=1; } if (cb.settings['force13']>0) { if (rollCounter%cb.settings['force13']==0) { total=13; dice1=6; dice2=7; } } if (total > 1) { var prize = cb.settings['prize_' + total]; } else { var prize = 'A Thank You!'; } var rareText=''; if(total==13) rareText = " (VERY RARE)"; var prizeIndex = prizes.indexOf(prize+rareText); if (prizeIndex >= 0) { if (cb.settings.remove_winning_prize == 'Yes') { prizes.splice(prizeIndex,1); } } else { prize = 'A Thank You!'; } notices += ":diceresult" + dice1 + " :diceresult" + dice2 + "\n"; notices += "The outcome is " + total + "! \n"; notices += username + "'s prize: " + prize; cb.sendNotice(notices, '', '#CCFFCC', '#000000', 'bold'); lastPrizeWon = prize; winners.push(username + ' won: ' + prize); cb.drawPanel(); } function setPrizes() { var rareText = ''; for(var i=2;i<=13;i++) { if(i==13) rareText = " (VERY RARE)"; prizes.push(cb.settings['prize_' + i] + rareText); } } function showPrizes(username) { var notices = ""; var rareText = ''; notices += "***** POSSIBLE PRIZES *****"; if (prizes.length) { for(var i=2;i<=13;i++){ if(i==13) rareText = " (VERY RARE)"; if (prizes.indexOf(cb.settings['prize_' + i] + rareText) >= 0) { notices += "\nDice outcome is " + i + ": " + cb.settings['prize_' + i] + rareText; } } } else { notices += "No prizes left. Please tell the broadcaster to restart the game."; } cb.sendNotice(notices, username, '#F0FAFF'); } function showPrizesWon(username) { winners.reverse(); var notices = "***** LAST 20 WINNERS *****"; if(winners.length == 0) { cb.sendNotice('No one has won anything yet. Roll the dice to win a prize!', username, '', '', 'bold'); } else { var last20Winners = winners.slice(0,20); var prizeNum = 1; for(var i=0; i<last20Winners.length;i++) { notices += "\n" + prizeNum + ") " + last20Winners[i]; prizeNum++; } cb.sendNotice(notices, username, '#CCFF99', '', 'bold'); } } function advertise() { var notices = ""; notices += "Roll My Dice - You Feeling Lucky \n"; notices += "Each roll reveals a prize. There are 12 possible prizes. \n"; notices += "Tip " + cb.settings.tokens + " " + langTokens + " to winning My Dice Game!!! \n"; notices += "Type /p to see the list of 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() { setPrizes(); advertise(); cb.changeRoomSubject('Roll My Dice to reveal a prize!'); } init();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.