0 votes
by (350 points)
I've looked through the other questions and none of them had in-depth questions OR answers that would actually help me, so. Here goes.

I do not know what a storyinit is or how to use it, so if you're not going to link me to a tutorial, please assume it will be useless to me and don't assume I'm using one and casually mention that I need to put stuff in it. That's happened before and I don't think I ever got an explanation on what the hell it is or how it works or even a link to the info. And I looked and all I could find was a one-sentence description of what a storyinit is and that was NOT helpful.

I'm tired and cranky so I apologize in advance if I come off as snappish.

I want to create a couple variables that I can set to 0 and then have climb by 1 point every time a choice is made that would correspond to that skill.

Like if I were doing Magical knowledge using the $arcane as shorthand for it-- I would want to be able to attach a += 1 thing to the link that leads to that person gaining or showing arcane knowledge skills.

I also need to know how to check it in case it went wrong, so the command to show the scores would be appreciated if you could show me. Like, the command that'll show in the play game so I can be sure I did it right.

Um, oh and a way to use values to determine what link a person can click like-- instead of just hitting continue, the value of each of their skills would determine what 'continue' link will show up and therefore what scene plays next.

I just really need to be pointed to resources and given some pointers, cause I haven't been able to find anything-- even if it's an answer on here I couldn't find-- the only ones I could find were incredibly vague and mentioned storyinit but didn't explain it.

I am a noob, please treat me as such. I'd appreciate it if you'd use words I can understand and not a bunch of jargon, too. I would really REALLY appreciate it.

1 Answer

+1 vote
by (154k points)

StoryInit is a special Passage and its content is processed between the time the Story is first opened and the contents on the first Passage is displayed, you generally initialise (assign default values to) your story variables in. To added a StoryInit passage to your project, simply add a new Passage and name it StoryInit

1. Initialise your story variables in your project's StoryInit passage using the <<set>> macro.

<<set $arcane to 0>>


2. Increment the $arcane when a link is selected within a Passage.
There are a number of ways you can do this, one of the easiest is to use a Link with Setter which will both update the variable and send the Reader to the indicated Target Passage.

[[Read the book of arcane knowledge|Read Magic Book][$arcane += 1]]


3. Displaying the current value of a variable within a Passage
You can uses either one of the <<print>> related macros or Naked Variable markup to do this.

Arcane: <<print $arcane>>

Arcane: $arcane


4. Using the value of a variable to conditionally do something in a Passage.
You can use one of the Control Macros to do this, for instance the <<if>> macro.

<<if $arcane is 5>>You are a powerful wizard.
<<elseif $arcane gte 3>>You are more than half way through your wizard training.
<<elseif $arcane gte 1>>You have barely started your wizard training.
<<else>>You need to start training before you can be a wizard.
<</if>>

 

by (350 points)
Oh my god, THANK YOU.
by (350 points)
edited by
NVM, figured it out, it works, thanks so much.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...