Skip to main content

Command Actions

Command Actions define what happens when a player interacts with a panel component. For example clicking a button, submitting a dialog, or opening a floodgate panel. These actions are broken down into three parts that work together: requirements, commands, and fail.

Command Actions are used anywhere a component can execute commands, including:

  • Inventory Panels (using actions, left-click, right-click, middle-click, shift-left-click, shift-right-click.)
  • Dialog Panels (actions)
  • Floodgate Panels (actions)

Command Actions Structure

Depending on the type of panel or component, Command Actions may be placed under a named click type or directly under an actions: key. Using actions in an Inventory Panel instead of a specific click type will execute the commands with any click type.

Example for Inventory Panels

left-click:
requirements:
- '[vault] 100'
commands:
- '[msg] You paid 100 to open this!'
fail:
- '[msg] You don’t have enough money!'

Example for Dialog/Floodgate Panels

actions:
requirements:
- '[vault] 500'
commands:
- '[open] premium_panel'
fail:
- '[msg] You need 500 to access this.'

Breakdown

SectionDescription
requirementsA list of Requirement Tags that must all be met to continue.
commandsA list of Command Tags to run if requirements succeed (or if there are no requirements).
failA list of Command Tags to run only if requirements are not met.

Behavior Rules

  • If requirements are not defined, the commands list will be run with no checks.
  • If requirements are defined and fail, only the fail list will run.
  • All three parts are optional, but it's most common to include at least commands.