Denizen Script Commands

Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.

Showing 1 out of 184 commands...
Syntaxchoose [<option>] [<cases>]
Short DescriptionChooses an option from the list of cases.
Full DescriptionChooses an option from the list of cases.
Intended to replace a long chain of simplistic if/else if or complicated script path selection systems.
Simply input the selected option, and the system will automatically jump to the most relevant case input.
Cases are given as a sub-set of commands inside the current command (see Usage for samples).

Optionally, specify "default" in place of a case to give a result when all other cases fail to match.

Cases must be static text. They may not contain tags. For multi-tag comparison, consider the IF command.
Any one case line can have multiple values in it - each possible value should be its own argument (separated by spaces).
Related TagsNone
Usage Example
# Use to choose the only case.
- choose 1:
  - case 1:
    - debug LOG "Success!"
Usage Example
# Use to choose the default case.
- choose 2:
  - case 1:
    - debug log "Failure!"
  - default:
    - debug log "Success!"
Usage Example
# Use for dynamically choosing a case.
- choose <[entity_type]>:
  - case zombie:
    - narrate "You slayed an undead zombie!"
  - case skeleton:
    - narrate "You knocked the bones out of a skeleton!"
  - case creeper:
    - narrate "You didn't give that creeper a chance to explode!"
  - case pig cow chicken:
    - narrate "You killed an innocent farm animal!"
  - default:
    - narrate "You killed a <[entity_type].to_titlecase>!"