Heh. Yeah, I would have explained more then, but I had an appointment to make first thing this morning. Glad you got it. Let me know if you need help with anything more complicated. There are any number of ways you can go with this stuff, but hopefully that gets you started with the basics.
For anyone else who might need some explanation:
The “initial values” passage has a “startup” tag and sets the initial values of your stats. Possibly not necessary in some cases, but it’s usually nice to have them all in one place.
The “Hub” passage displays the current value of the stat and has two links: one to increase it and one to decrease it so you can see the effects.This is just for demonstration purposes. Note that unlike in a spreadsheet, Twine pages don’t update automatically when you update a variable, so these links don’t just update the variable, they also go to another page (in this case the same page again) to force a redraw.
Then the important part of the Hub passage is really two commands, but I put them both on the same line. First you use (open-storylets:)
to get the available storylets. This can take a “where” clause if you want to select only certain kinds of things. If you had a more complicated selection you might want to separate this command out and store it’s results in a variable, but here I just put it straight into the display loop.
Then you have to display the results somehow. This is kind of a clunky way to do it, since it puts a dash after each one instead of between it each two, but it’s simple for demo purposes. (for: each _p, ...listOfThings)[do this thing]
This processes each item in the list (the ...
“spreads” out the list, sending all its items to the (for:)
command). It goes through each one in turn, storing it in the temporary variable _p
and then doing the thing in square brackets. In this case our list of things is (open-storylets:)
and our “do this thing” is linking to the passage by name and putting spaces and a dash after it.
And then the individual storylets passage start with a (storylet: when ...)
call giving their requirements (when is this storylet available?) followed by the contents that should be displayed when we visit it (as usual for any passage). In this case I made three that have overlapping requirements so you can see them come and go as you change the stat.