From a37c3477b8a004e6431f5c5ad3bacc892e80fbba Mon Sep 17 00:00:00 2001 From: David Masad Date: Sat, 6 Feb 2021 07:19:16 -0500 Subject: [PATCH] Updating some tutorial language to reflect new API --- docs/Tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Tutorial.md b/docs/Tutorial.md index c0f3465..f4b2a5e 100644 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -59,7 +59,7 @@ StoryManager.storylets["Conversation"] = { This is the core functionality, so we'll go over it in detail. `StoryManager.storylets` is the object that holds the potential storylets. The key `"Conversation"` is mostly there for readability (and potentially to make it easier to remove defunct storylets, but this API might change in the future). The associated value is the storylet object, with the properties: * `name`: Human-readable name for the storylet; kind of redundant with the key, and mostly there in case we need it at some point * `tags`: List of tags. When looking for possible storylets, we'll be able to restrict only to ones matching a certain tag; for example -* `generate`: This is the most important property: this will be a function that returns a list of potential storylets bound to data. Note that the `generate` function doesn't take any argumments. It does however have access to the full current game state via the `State` variable, and especially `State.variables`. +* `generate`: This is the most important property: this will be a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) that `yield`s potential storylets bound to data. (Don't forget to define the function with an asterisk as `function*`) Note that the `generate` function doesn't take any argumments. It does however have access to the full current game state via the `State` variable, and especially `State.variables`. This function should produce one possible conversation storylet per character. Storylets are yet *another* JavaScript object. The following storylet properties are generally required: * `passage`: The name of the Twine passage associated with this storylet. When a link is created to the storylet, this will be the target passage.