Create a new Dialog - LeonidMem/DialogsM-Wiki GitHub Wiki

To create a new dialog just use the command /dialog create {name} - it will create a new template (you can use / at the name in any quantity, so it will be placed to the specified folder and will create it if this folder doesn't exist).

Properties of Dialog File

Text [Necessary property]

Must be represented as String. This value will be shown to a player when dialog will be opened.

Conditions

There are 8 types of conditions that must be represented as String (it converts to the list automatically) or List of Strings.

  • beforeDialogs - if the player has any dialog from this list as read, dialog won't be opened to him.
  • afterDialogs - if the player doesn't have at least one dialog from this list this as read, dialog won't be opened to him.
  • beforeQuests - if the player has any quest from this list as read, dialog won't be opened to him.
  • afterQuests - if the player doesn't have at least one quest from this list as completed, dialog won't be opened to him.
  • whenQuests - if the player doesn't have at least one quest from this list as a quest in progress, dialog won't be opened to him.
  • ifTags - if the player doesn't have at least one scoreboard tag (/minecraft:tag) from this list, dialog won't be opened to him.
  • ifNoTags - if the player has any scoreboard tag (/minecraft:tag) from this list, dialog won't be opened to him.
  • ifScoreboard - if the player doesn't match at least one expression from this list, dialog won't be opened to him. Format: objectiveName [math sign] score.

Math signs:

  • > Greater
  • >= Greater or equal
  • < Less
  • <= Less or equal
  • == Equal
  • != Not equal

Actions

There are 7 types of actions that must be represented as String (it converts to the list automatically) or List of Strings.

  • command - run command as a player who opened the dialog. @m will be replaced with the nickname of the player.
  • console - run command as the console. @m will be replaced with the nickname of the player.
  • startQuests - add all quests from the list as a quest in progress to the player.
  • addQuests - add all quests from the list as completed to the player.
  • removeQuests - remove all quests from the list as completed or a quest in progress from the player.
  • addDialogs - add all dialogs from the list as read to the player.
  • removeDialogs - remove all dialogs from the list as read from the player.

Answers

Must be represented as List of Answers. An answer is an object with two properties: display and actions.

Display

Each property must be represented as String.

  • text - text that will be shown as the answer.
  • color - Minecraft colors' names (f.e. green, red) or it may be Hex color (f.e. #FF0000).

Actions

Each property must be represented as String (it converts to the list automatically) or List of Strings (except the last one, it can be represented only by String).

  • command - run command as a player who opened the dialog. @m will be replaced with the nickname of the player.
  • console - run command as the console. @m will be replaced with the nickname of the player.
  • openDialog - open dialog to the player. If dialog can't be opened because of conditions, the answer won't be shown.

Sound

Must be represented as String. This value converts to the Minecraft sound and will be played to a player when the dialog will be opened.

Template:

{
	"text": "Hi!",
	"conditions": {
		"beforeDialogs": [
			"3"
		],
		"afterDialogs": [
			"1"
		],
		"beforeQuests": [
			"3"
		],
		"afterQuests": [
			"1"
		],
		"whenQuests": [
			"2"
		],
		"ifTags": [
			"Tag1"
		],
		"ifNoTags": [
			"Tag2"
		],
		"ifScoreboard": [
			"Name > 10"
		]
	},
	"actions": {
		"command": "say *nothing*",
		"console": "give @m diamond 1",
		"startQuests": "4"
	},
	"answers": [
		{
			"display": {
				"text": "[Hi!]",
				"color": "green"
			},
			"actions": {
				"command": "say Hi!",
				"openDialog": "3"
			}
		},
		{
			"display": {
				"text": "[Bye!]",
				"color": "red"
			},
			"actions": {
				"command": "say Bye!",
				"console": "say I'm server, @m..."
			}
		}
	],
	"sound": "entity.villager.ambient"
}