Step
A step is an order number plus the actions that run while it is active.
Steps are plain data. Nothing happens when you build one; the runtime is what enters it, and that is why a tutorial can be declared far from where it runs.
Step.new(1, {
Dialog.new({ Lines = { "Welcome!" } }),
FocusUI.to(shopButton, { Advance = true }),
})
Every action in a step starts at the same moment and none of them blocks the others. In the example above the dialog appears while the shop button is already highlighted. The step ends when one of the actions asks it to, which here is the click on the button.
Types
Action
interface Action {Kind: string--
Which action this is, for debugging
}What the action constructors return, and all a step ever holds.
Actions of a step all start together. None of them blocks the others; the step ends when an action asks the context to advance.
You rarely build one by hand. Custom.new is the supported way to write your own, because it gets you the same context and the same cleanup as the built-in actions.
Functions
new
constructorDeclares one step of a tutorial.
Order numbers decide the sequence, not the position in the list you pass to Tutorial.build. They do not need to be contiguous, and leaving gaps is the cheap way to keep room for steps you expect to add later:
Tutorial.build({
Step.new(30, { PointWorld.to(fountainPart) }),
Step.new(10, { Dialog.new({ Lines = { "Welcome!" } }) }),
Step.new(20, { FocusUI.to(shopButton, { Advance = true }) }),
})
That runs 10, then 20, then 30, and inserting a step between the first two later costs nothing.
A step with no actions is valid. It shows nothing and waits, which is occasionally what you want while the server decides where to send the player next.
Errors
| Type | Description |
|---|---|
| "TutorialKit step order must be a positive integer" | order was zero, negative or fractional |