Files
storybook/docs/book/lsp/keywords/choose.toml

62 lines
1.6 KiB
TOML
Raw Normal View History

# LSP Documentation for 'choose' keyword
[keyword]
name = "choose"
category = "behavior_tree"
short_description = "Selector node that tries children in order until one succeeds"
web_url = "https://r3t-studios.github.io/storybook/reference/behavior-trees.html#choose"
[syntax]
format = "choose [label] { children... }"
example = """
choose panic_response {
then time_panic { ... }
then obstacle_panic { ... }
then default_panic { ... }
}
"""
[hover]
markdown = """
**`choose` - Selector Node**
Tries each child behavior in order until one succeeds.
**Behavior:**
- Evaluates children left-to-right
- Returns **success** on first successful child
- Skips remaining children after first success
- Returns **failure** only if all children fail
**Named nodes (optional):**
```storybook
choose state_dependent_action {
then appear { ... }
then confuse_alice { ... }
then fade_away { ... }
}
```
Labels make intent clear and aid debugging!
**Use cases:**
- Decision-making between alternatives
- Fallback chains (try A, if fails try B)
- Priority ordering (prefer A, accept B)
[Learn more ](https://r3t-studios.github.io/storybook/reference/behavior-trees.html#choose)
"""
[completion]
snippet = "choose ${1:label} {\n\t$0\n}"
description = "Selector node (tries children until one succeeds)"
sort_text = "01-choose"
[context]
valid_in = ["behavior_block", "choose_block", "then_block", "decorator_block"]
invalid_in = ["character_block", "life_arc_block", "schedule_block"]
[related]
keywords = ["then", "if", "when"]
concepts = ["behavior_trees", "named_nodes", "selectors"]