Script Command Suggestions (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.17

Syntax

[the] [command] (suggestions|tab completions) (of|for) %objects%

Description

Usable in a script command's "suggestions" entry. Allows modifying the suggestions displayed while a command is being typed.

Examples

command /menu <text> <text>:
	suggestions:
		if arg-1 is not set:
			set arg-1's suggestions to "Appetizers", "Entrees", and "Desserts"
		else if arg-1 is "Appetizers":
			set arg-2's suggestions to "Salads", "Breads", and "Fried Delights"
		else if arg-1 is "Entrees":
			set arg-2's suggestions to "Pastas", "Handhelds", and "Pizzas"
		else if arg-1 is "Desserts":
			set arg-2's suggestions to "Cakes", "Ice Creams", and "Pies"
	trigger:
		send "Yum!"
command /home:
	subcommand set <name: text>:
		trigger:
			set {homes::%player%::%{_name}%} to the player's location
	subcommand <name: text>:
		suggestions:
			loop {homes::%player%::*}:
				add formatted "<ttp:'Location: %loop-value%'>%loop-index%" to the suggestions for the text argument
		trigger:
			teleport the player to {homes::%player%::%{_name}%}

View source