Skip to content
desht edited this page Jun 14, 2011 · 8 revisions

Command Macros

Macros allow multiple commands to be run from a single menu item.

To define a macro

/sms macro add mymacro1 \Hello!
/sms macro add mymacro1 \And now goodbye!

This creates a macro "mymacro1" with two entries - one to make the player say "Hello!" and one to make the player say "And now goodbye!".

Note the leading backslash (\) - this is needed for text that should be spoken by the player when the CommandSigns plugin is being used to process commands.

To list existing macros

/sms macro list
2 lines (page 1/1)
---------------------------
1 macros
1) mymacro1
---------------------------

To show a macro

/sms macro list mymacro1
3 lines (page 1/1)
---------------------------
2 commands
1) Hello!
2) And now goodbye!
---------------------------

To remove a command from a macro

/sms macro remove mymacro1 2
Removed command from macro 'mymacro1'.

To remove an entire macro

/sms macro remove mymacro1
Removed macro 'mymacro1'.

To use a macro

You need to prefix the macro name with a '%' sign.

/sms add mymenu1 Macro test|%mymacro1|Tested macro!

Macros can even call each other:

/sms macro add mymacro2 /time day
/sms macro add mymacro1 %mymacro2

The plugin will, however, detect recursive loops and stop their execution, posting a warning.

Editing commands.yml

All macros are stored in commands.yml, which can be edited directly if you choose. However, be sure to do a "/sms reload" immediately after any changes to ensure they don't get overwritten when the plugin next does a save.

A useful example

Maybe you want to allow some players to switch the game time to day or night via a sign. But you also want everyone on the server to know who's doing the switching.

/sms macro add daytime \I'm making it daytime now!
/sms macro add daytime /@time day

/sms add mymenu Daytime|%daytime

Now, when a player executes that menu item, they'll tell the entire server that they've done it.

Clone this wiki locally