8ball

  • community
  • minigames
  • by limon
  • Takaro development
  • all
Version
View export JSON

Allows players to use a Magic 8-Ball command to receive random fortune-telling responses to their questions.

Key Functionality:

  • 8-Ball Command: Players can use a designated command (default: 8ball) to ask the Magic 8-Ball a question.
  • Random Responses: The module provides a list of configurable responses. When the command is used, the module selects a random response from this list and displays it to the player.
  • Configurable Output: The module allows server administrators to choose whether the 8-Ball's response is sent as a global server message or as a private message (PM) to the player.
  • Customizable Responses: The list of 8-Ball responses can be fully customized, allowing server administrators to tailor the module to their server's theme or language.
  • Permission Control: Usage of the 8-Ball command can be restricted using a configurable permission.

How to Use:

  1. Configuration:
    • sendMessage: Choose whether the 8-Ball's response is sent as a serverMessage (to all players) or a playerPM (private message to the player who used the command).
    • responses: Edit the array of strings to customize the 8-Ball's possible answers. Ensure there is at least one response.
  2. Permissions: Assign the MAGIC_8BALL_USE permission to the player groups or individuals who should be able to use the 8ball command.
  3. In-Game Usage: Players use the /8ball command (or the configured trigger) followed by their question. The 8-Ball's response will be displayed according to the sendMessage configuration.

Important Considerations:

  • Ensure there is at least one response in the responses configuration to avoid errors.
  • Customize the responses to fit your server's style and language.
  • Use the permission system to control who can use the command.

Configuration 2

Settings you fill in when installing the module on a server.

SettingTypeDefaultDescription
sendMessage sendMessage string "serverMessage" Decide on sending it to the server globally or to the individual player
responses responses array ["It is certain","Without a doubt","You may rely on it","Most likely","Yes","No","Signs point to yes","Reply hazy, try again","Ask again later","Better not tell you now","Cannot predict now","Don't count on it","My sources say no","Very doubtful","Outlook not so good"] Here you can edit the responses of the 8ball command.
Raw config schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": [],
  "additionalProperties": false,
  "properties": {
    "sendMessage": {
      "title": "sendMessage",
      "description": "Decide on sending it to the server globally or to the individual player",
      "default": "serverMessage",
      "type": "string",
      "enum": [
        "serverMessage",
        "playerPM"
      ]
    },
    "responses": {
      "title": "responses",
      "description": "Here you can edit the responses of the 8ball command. \n",
      "default": [
        "It is certain",
        "Without a doubt",
        "You may rely on it",
        "Most likely",
        "Yes",
        "No",
        "Signs point to yes",
        "Reply hazy, try again",
        "Ask again later",
        "Better not tell you now",
        "Cannot predict now",
        "Don't count on it",
        "My sources say no",
        "Very doubtful",
        "Outlook not so good"
      ],
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "maxItems": 1000
    }
  }
}
Raw UI schema
{}

Commands 1

Chat commands players trigger in game.

  • my-command

    No help text available

    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        // Check permission first
        if (!checkPermission(data.pog, 'MAGIC_8BALL_USE')) {
            throw new TakaroUserError('You do not have permission to use the magic 8-ball!');
        }
    
        const { sendMessage, responses } = data.module.userConfig;
    
        // Get random response
        const response = responses[Math.floor(Math.random() * responses.length)];
        const messageText = `🎱 ${data.player.name} asked the magic 8-ball: ${response}`;
    
        // Send message based on config
        if (sendMessage === 'serverMessage') {
            await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
                message: messageText
            });
        } else if (sendMessage === 'playerPM') {
            await data.player.pm(messageText);
        }
    }
    
    await main();

Permissions 1

Roles you can grant to decide who may use what.

  • MAGIC_8BALL_USE

    This permissions allows your players to use the Magic 8Ball