Updating documentation

This commit is contained in:
David Masad
2021-02-20 21:33:51 -05:00
parent e1e8932207
commit fa6b69dec5
2 changed files with 5 additions and 7 deletions

View File

@ -6,7 +6,7 @@ You can use it in the Twine interactive editor, but at the moment it's probably
## How to use it
Add `storymanager.js` (and optionally `storymanager-widgets.tw`) to your Twine project. In JavaScript, add some story data if needed, and then add a storylet with a name, some tags (optionally), and a `generate` generator function* that `yield`s one or more instantiated storylet objects, like this:
Add `storymanager.js` to your Twine project. In JavaScript, add some story data if needed, and then add a storylet with a name, some tags (optionally), and a `generate` generator function* that `yield`s one or more instantiated storylet objects, like this:
```javascript
@ -54,8 +54,7 @@ And finally, you need to have a passage where you query for available storylets
:: Jump
You prep your ship to jump.
<<set _possibleStorylets = window.SM.getStorylets()>>
<<ShowStoryletLinks _possibleStorylets>>
<<getStoryletLinks>>
```
(This example uses the `<<ShowStoryletLinks>>` widget from `storymanager-widgets.tw`)

View File

@ -85,7 +85,7 @@ You stand at the edge of the grand ballroom in the Duchess's palace.<br>
<</for>>
```
This creates one link per available storylet. Each link will have the storylet description as its text, link to the storylet's passage, and when selected will story the storylet's data in the `$currentStorylet` variable, so that the storylet passage itself can access it. This pattern is (expected to be) common enough that there's a widget for it: `<<ShowStoryletLinks>>`. (**TODO:** Make this a macro). We may also not want to show *all* the available storylets. When there are just three guests it isn't so bad, but if the party has five, or ten, or more NPCs, giving the player the entire list will get overwhelming fast. We can randomly choose a subset, to emulate how people randomly circulate during the party. Instead, maybe we want to choose only some number of storylets to display. We can do this by passing a number to `getStorylets`indicating the maximum number of storylets to get. Storylets are selected in order of priority, so that the list is filled with higher-priority storylets first.
This creates one link per available storylet. Each link will have the storylet description as its text, link to the storylet's passage, and when selected will story the storylet's data in the `$currentStorylet` variable, so that the storylet passage itself can access it. This pattern is (expected to be) common enough that there's a macro for it: `<<getStoryletLinks>>`. We may also not want to show *all* the available storylets. When there are just three guests it isn't so bad, but if the party has five, or ten, or more NPCs, giving the player the entire list will get overwhelming fast. We can randomly choose a subset, to emulate how people randomly circulate during the party. Instead, maybe we want to choose only some number of storylets to display. We can do this by passing a number to `getStoryletLinks`indicating the maximum number of storylets to get. Storylets are selected in order of priority, so that the list is filled with higher-priority storylets first.
#### Putting it all together
@ -131,8 +131,7 @@ StoryManager.storylets["Conversation"] = {
:: Start
You stand at the edge of the grand ballroom in the Duchess's palace.<br>
<<set _possibleStories = window.SM.getStorylets(3)>>
<<ShowStoryletLinks _possibleStories>>
<<getStoryletLinks 3>>
:: Conversation
@ -143,7 +142,7 @@ You make polite conversation with $talkingTo.name. <br>
To compile this with Tweego, run:
```
> tweego storymanager.js storymanager-widgets.tw examples\tutorial.tw -o tutorial.html
> tweego storymanager.js examples\tutorial.tw -o tutorial.html
```
## Adding interruptions