Updating tutorial
This commit is contained in:
@ -57,8 +57,6 @@ You prep your ship to jump.
|
|||||||
<<getStoryletLinks>>
|
<<getStoryletLinks>>
|
||||||
```
|
```
|
||||||
|
|
||||||
(This example uses the `<<ShowStoryletLinks>>` widget from `storymanager-widgets.tw`)
|
|
||||||
|
|
||||||
You can see this complete example in the `examples\` folder ([twee](https://github.com/dmasad/StoryletManager/blob/main/examples/tutorial.tw) or [playable HTML](https://dmasad.github.io/StoryletManager/examples/simple_space_example.html)).
|
You can see this complete example in the `examples\` folder ([twee](https://github.com/dmasad/StoryletManager/blob/main/examples/tutorial.tw) or [playable HTML](https://dmasad.github.io/StoryletManager/examples/simple_space_example.html)).
|
||||||
|
|
||||||
There's also a [more detailed tutorial](https://github.com/dmasad/StoryletManager/blob/main/docs/Tutorial.md)
|
There's also a [more detailed tutorial](https://github.com/dmasad/StoryletManager/blob/main/docs/Tutorial.md)
|
||||||
@ -84,7 +82,7 @@ I have a few Twine hobby projects in various stage of completion, and I found my
|
|||||||
- [ ] Storylet with any binding
|
- [ ] Storylet with any binding
|
||||||
- [X] Storylet tagging and filtering (i.e. pull from only a subset of storylets)
|
- [X] Storylet tagging and filtering (i.e. pull from only a subset of storylets)
|
||||||
- [X] Widget for displaying storylet links
|
- [X] Widget for displaying storylet links
|
||||||
- [ ] Make the widget into a macro
|
- [X] Make the widget into a macro
|
||||||
- [ ] Weighted random choice
|
- [ ] Weighted random choice
|
||||||
- [X] Explore replacing storylet generators returning arrays with the `yield` keyword? **Pro:** produces cleaner code; **Con:** requires users to understand `yield` and remember to use the function * notation.
|
- [X] Explore replacing storylet generators returning arrays with the `yield` keyword? **Pro:** produces cleaner code; **Con:** requires users to understand `yield` and remember to use the function * notation.
|
||||||
- [ ] Add storylet code to passages (as comments, a-la Tiny-QBN?)
|
- [ ] Add storylet code to passages (as comments, a-la Tiny-QBN?)
|
||||||
|
@ -112,8 +112,7 @@ State.variables.characters = [
|
|||||||
StoryManager.storylets["Conversation"] = {
|
StoryManager.storylets["Conversation"] = {
|
||||||
name: "Conversation",
|
name: "Conversation",
|
||||||
tags: [],
|
tags: [],
|
||||||
generate: function() {
|
generate: function*() {
|
||||||
let storylets = [];
|
|
||||||
for (let i in State.variables.characters) {
|
for (let i in State.variables.characters) {
|
||||||
let character = State.variables.characters[i];
|
let character = State.variables.characters[i];
|
||||||
let storylet = {
|
let storylet = {
|
||||||
@ -123,9 +122,8 @@ StoryManager.storylets["Conversation"] = {
|
|||||||
character: character
|
character: character
|
||||||
|
|
||||||
}
|
}
|
||||||
storylets.push(storylet);
|
yield storylet;
|
||||||
}
|
}
|
||||||
return storylets;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -216,8 +214,25 @@ StoryManager.storylets["Buttonholed"] = {
|
|||||||
// ...etc
|
// ...etc
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Now we need to have the `getStoryletLinks` macro only look for storylets with matching tags. To specify a tag, add it in quotation marks after the number of storylets to get, like this:
|
||||||
|
|
||||||
We also need to update our world model to account for this mechanic: we need to track the protagonist's knowledge, and update the characters to account for their favorite topics and level of knowledge.
|
```
|
||||||
|
:: Start
|
||||||
|
You stand at the edge of the grand ballroom in the Duchess's palace.<br>
|
||||||
|
<<getStoryletLinks 3 "circulating">>
|
||||||
|
```
|
||||||
|
|
||||||
|
We'll also update the `Conversation` passage to look for `"during conversation"` storylets:
|
||||||
|
|
||||||
|
```
|
||||||
|
:: Conversation
|
||||||
|
<<set $talkingTo = $currentStorylet.character>>
|
||||||
|
You talk with $talkingTo.name. <br>
|
||||||
|
<<getStoryletLinks 3 "during conversation">>
|
||||||
|
[[Keep circulating | Start]]
|
||||||
|
```
|
||||||
|
|
||||||
|
Now we need to create the conversation-topic storylet generator. First we need to track the protagonist's knowledge, and update the characters to account for their favorite topics and level of knowledge.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
State.variables.playerKnowledge = {poetry: 0, industry: 0, astronomy: 0};
|
State.variables.playerKnowledge = {poetry: 0, industry: 0, astronomy: 0};
|
||||||
|
Reference in New Issue
Block a user