Submenus

Overview

As of v2.0.0, ScrollingMenuSign allows menu hierarchies to be built, and all displayed in a single view, using the special SUBMENU command. This is best explained by example:

/sms create central &1Central
/sms add central "Set Time" "SUBMENU timeofday"
/sms add central "Warps" "SUBMENU warps"
/sms add central "Game Mode" "SUBMENU gamemode"

/sms create timeofday "&1Time of Day"
/sms add timeofday "Morning" "/@time morning"
/sms add timeofday "Noon" "/@time noon"
...

/sms create warps "Warps"
/sms menu warps defcmd "/warp <LABEL>"
/sms add warps "Home"
/sms add warps "Mines"
...

/sms create gamemode "Game Mode"
/sms add gamemode "Survival" "/gm 0"
/sms add gamemode "Creative" "/gm 1"

Now sync the central menu onto any view type (sign, map, ...) Whenever an item in that menu is clicked, the view will switch to displaying the appropriate submenu - you have a menu hierarchy!

When you're in a submenu, the menu title will be prefixed with a configurable string, by default "->" (see submenus.title_prefix in the Configuration. Also, a special "Back" menu entry will be added to go back to showing the previous menu, by default "<- BACK" (see submenus.back_item.label and submenus.back_item.material in the Configuration).

Any of the submenus above (timeofday, warps, gamemode) can of course also be used as top-level menus in any view.

Popup Menus

An alternative way of displaying submenus is with the POPUP command, which allows a specific view to be popped up. The view type must be one of inventory or spout.

Example:

/sms create weather &1Weather
/sms add weather "Sunny" "/weather sunny" -icon glowstone
/sms add weather "Rainy" "/weather rainy" -icon water
/sms sync weather -inv
# assuming the view "weather-1" was created...
/sms add central Weather "POPUP weather-1"

Now, when the "Weather" menu item is clicked, an inventory view will open with two icons for changing the weather.

Note: earlier versions of SMS allow views to be popped up with /sms view <view-name> -popup, but the POPUP command is preferable since it's more concise, slightly more efficient, and most importantly no special permissions (scrollingmenusign.commands.view) need to be granted to players.

Notes

  • The SUBMENU and POPUP commands are only recognised in commands run from menu items. You can't use them from chat or from the console.

Comments

Posts Quoted:
Reply
Clear All Quotes