Variable Commands

Variable Commands

67 Downloads

This is a server-side Fabric mod that adds variables to commands. You can set a value to a variable and reference it in any command.

To set a value to a variable: /var set <variable name> <value>

The value is always stored as text (a string), as commands are inherently text-based, but converted to a number as needed.

To reference a variable in a command, write $<variable>. e.g., /gamemode $my_mode

Variables can also be used in the 'if' execute subcommand e.g., /execute if var my_num = 5 run kill

You can also operate on variables: e.g., /var operation my_num + 13

FABRIC API REQUIRED