Apps Home
|
Create an App
roulette test
Author:
j763272
Description
Source Code
Launch App
Current Users
Created by:
J763272
// Roulette numbers and colors const rouletteNumbers = [ { number: 0, color: 'green' }, { number: 32, color: 'red' }, { number: 15, color: 'red' }, { number: 19, color: 'red' }, { number: 21, color: 'red' }, { number: 4, color: 'black' }, { number: 6, color: 'black' }, { number: 13, color: 'black' }, { number: 21, color: 'black' }, { number: 2, color: 'black' }, { number: 25, color: 'red' }, { number: 17, color: 'red' }, { number: 34, color: 'red' }, { number: 6, color: 'red' }, { number: 1, color: 'red' }, { number: 20, color: 'black' }, { number: 14, color: 'black' }, { number: 31, color: 'black' }, { number: 9, color: 'black' }, { number: 27, color: 'red' }, { number: 18, color: 'red' }, { number: 29, color: 'black' }, { number: 12, color: 'black' }, { number: 28, color: 'red' }, { number: 35, color: 'red' }, { number: 3, color: 'red' }, { number: 26, color: 'black' }, ]; // Function to spin the roulette function spinRoulette() { const randomIndex = Math.floor(Math.random() * rouletteNumbers.length); const winningNumber = rouletteNumbers[randomIndex]; // Send the winning number to the chat cb.sendNotice(`The winning number is ${winningNumber.number} and it is ${winningNumber.color}!`); } // Notify when the app starts cb.onStart(function(user) { cb.sendNotice(`${user['user']} started the roulette app!`); }); // Listen for a message command to spin the roulette cb.onMessage(function(message) { if (message.m === '/spin') { spinRoulette(); message['X-Spam'] = true; // Hide the message from chat } return message; // Return the original message object }); // Draw the panel with instructions for users cb.onDrawPanel(function() { return { 'template': '3_rows_12_21_31', // Use a predefined template 'row1_label': 'Instructions:', 'row1_value': 'Type "/spin" to play!', 'row2_value': 'Good luck!', 'row3_value': '' }; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.