Bad usage examples
dsetzer opened this issue · comments
Just want to have this clarified, this second snippet in the screenshot has no relation to the first snippet..
Is it trying to say this:
// Register a task: BehaviorTree.register('testtask', myTask) // Or register a sequence or priority: BehaviorTree.register('test sequence', mySequence)Which you now can simply refer to in your nodes, like:
import { Selector } from 'behaviortree' const mySelector = new Selector({ nodes: ['testtask', 'test sequence'] })
Or am I misunderstanding something?
Heyho @dsetzer.
You are right, that the examples are weirdly disjunct and don't really have a relation to each other, although I that the text might implicate it. You assumption is totally correct 👍, and I should update the examples accordingly.
The code examples are really great, the only other place that threw me off was in the example repo
Took me a moment to figure out how the Task defined at the top played into there because it's only referenced by a 'bark' right in between two inline definitions, it's very easy to miss if you're first reading up on this and aren't aware that Tasks can be registered and reused.
Anyway, thanks for confirming that!
Thanks for mentioning those shortcomings in the documents/examples. I'll optimize them for clarity then.