The chat menu system allow you to quickly create a menus that the player can navigate around using Minecraft chat.
- run drustcraft.chat_gui.title def:<title-string>
- run drustcraft.chat_paginate def:<title>|<pageno>|<itemlist>|<cmd-list>|<cmd-info>|[show-numbers]
To create a chat menu, run the task:
- run drustcraft.chat_menu.create def:<your_task>|<your_id>
This will in turn, setup the chat menu system and run the task defined in
<your_id> in definition
Your task should then perform whatever tasks it needs to do, adding menu items to the chat menu using the
drustcraft.chat_menu.add task and finally running
If your code is finished with the chat menu, it can be closed early by calling the task
Your chat menu is going to need items to display to the player in order for them to perform tasks. This can be done by calling the
drustcraft.chat_menu.add task with a single definition of either an text element or a map with options.
To add a simple text item, that is not selectable, you can call
drustcraft.chat_menu.add with a definiton of the text.
- run drustcraft.chat_menu.add 'def:My simple menu item text'
To add a player selectable item, pass a map with the following keys to
The title to display to the player
The task to call if the user selects this menu item
The data to pass to task in definition 
[Optional] The key the user is to press to select this item. If this is not specified the next available number is used
- run drustcraft.chat_menu.add 'def:<map[title/My menu item|task/mytask|id/myid]>'
When the player selects a menu item, the corresponding
task is called with the corresponding
id passed as definition . These tasks can then create sub chat menus by simply calling
If the task does not call
drustcraft.chat_menu.back the chat menu system will be closed.
Adding a menu header is recommended as it helps the user differentiate what was the previous chat data and what is the current menu.
- run drustcraft.chat_menu.header 'def:My fancy header'
A header is required to be set for each menu as they are not carried across to any submenus.
Your script can also ask questions to the player in order to set values, then return to the chat menu system, by running the task
drustcraft.chat_menu.ask and passing a list definition that contains:
The question to ask the player
The task to call when the player answers the question
The id to pass to the task
The passed task is called when the player presses enter in the chat windo with the following definitions:
The id passed to
The text the player entered
The task can then either response to the player using the Denizens
narrate command, or create a new sub chat menu followed by
drustcraft.chat_menu.render to continue with the previous chat menu.
If you have a menu item that is to run a few tasks but does not require to ask the player a question, nor display a new sub menu, it can jump back to the previous menu by calling the
Once you are ready to display the menu, call the
This will generate your chat menu, create any required pagenation and handle all user input.
start_menu:type: taskscript:- run drustcraft.chat_menus.create def:my_menu|startmy_menu:type: taskscript:- choose <||start>:- case start:- drustcraft.chat_menu.header 'def:This is my header'- drustcraft.chat_menu.add 'def:<map[title/Option 1|id/option1|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 2|id/option2|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 3|id/option3|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 4|id/option4|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 5|id/option5|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 6|id/option6|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 7|id/option7|task/my_menu]>'- drustcraft.chat_menu.add 'def:<map[title/Option 8|id/option8|task/my_menu]>'- drustcraft.chat_menu.render- case option1:- drustcraft.chat_menu.addN