Apps Home
|
Create an App
Magical Unicorn Dice 1
Author:
iamhd
Description
Source Code
Launch App
Current Users
Created by:
Iamhd
// Magical Unicorn Kingdom Dice game by Mangochaynes // July 2014 // Based on RedaDice by Redadare. the original header is below // RedaDice game by Redadare // December 2013 var lastRoller = '--'; var lastArticle = '--'; init(); function init() { cb.changeRoomSubject('Magical Unicorn Kingdom Dice game running! Roll the dice (' + cb.settings.tokens + ' per roll). Each result = 1 piece of clothing or action. If this is still on I take it off, if it is already off I put it back on again. If it is a body part instead of clothing, the unicorn overlords will turn it on or off.'); } cb.onEnter(function (user) { cb.chatNotice('hey ' + user['user'] + '!', user['user'], '', '#E31E24', 'bold'); cb.chatNotice('welcome to my magical unicorn room! Tip ' + cb.settings.tokens + ' to roll the Unicorn dice.', user['user'], '', '#E31E24', 'bold'); cb.chatNotice('each result = 1 piece of clothing or an action. If this is still on the unicorns tell me to take it off, if it is already off the unicorns tell me to put it back on again!', user['user'], '', '#E31E24', 'bold'); cb.chatNotice('tip to keep the game going or the unicorns will probably tell her to take a break', user['user'], '', '#E31E24', 'bold'); }); cb.settings_choices = [ { name: 'tokens', type: 'int', minValue: 1, maxValue: 200, label: 'Cost per Roll (in tokens)', defaultValue: 25 }, { name: 'article1', type: 'str', label: 'Clothing article or action if 1 is rolled?' }, { name: 'article2', type: 'str', label: 'Clothing article or action if 2 is rolled?' }, { name: 'article3', type: 'str', label: 'Clothing article or action if 3 is rolled?' }, { name: 'article4', type: 'str', label: 'Clothing article or action if 4 is rolled?' }, { name: 'article5', type: 'str', label: 'Clothing article or action if 5 is rolled?' }, { name: 'article6', type: 'str', label: 'Clothing article or action if 6 is rolled?' } ]; cb.onTip(function (tip) { if (parseInt(tip['amount']) >= cb.settings.tokens) { var rolls = Math.floor(parseInt(tip['amount']) / cb.settings.tokens); for (var r = 0; r < rolls; r++) { var dieRoll = Math.floor((Math.random() * 6) + 1); if (dieRoll == 1) prize = cb.settings.article1; if (dieRoll == 2) prize = cb.settings.article2; if (dieRoll == 3) prize = cb.settings.article3; if (dieRoll == 4) prize = cb.settings.article4; if (dieRoll == 5) prize = cb.settings.article5; if (dieRoll == 6) prize = cb.settings.article6; lastRoller = tip['from_user']; lastArticle = prize; cb.chatNotice(tip['from_user'] + ' has rolled a Magical Unicorn Kingdom Dice' + dieRoll + ' = ' + prize, '', '', '#E31E24', 'bold'); } cb.drawPanel(); } }); cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Last roll by:', 'row1_value': lastRoller, 'row2_label': 'Result:', 'row2_value': lastArticle, 'row3_value': 'Tip or unicorns are appalled' }; });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.