Going to Section via Javascript

arandomusername
Hi folks!

I just discovered Squiffy a few days ago and I really love it! I think the concept of having your whole code in one place instead of in a thousand little boxes (like in Twine) is very clever and it suits my mode of writing very well, so kudos to the inventor.

The only thing that kind of puzzled me is the really brief explanation in the docs on Javascript. I know how to code in JS, I just wish I knew how to use it inside Squiffy. Aside from setting/getting variables I haven't been able to do anything useful yet.

So here comes my first question: is there any way to jump to a section using Javascript? (Like some kind of "goto" command?)

I would actually need this for my current game because I'm planning to implement a little interface that goes beyond just clicking links.

Thanks!

TM123
Please choose: {rotate size:small:medium:large}
and then [[clickhere]]

[[clickhere]]:
squiffy.story.go(get("size"));

[[small]]:
Small selection.

[[medium]]:
Medium Selection.

[[large]]:
Large Selection.

arandomusername
Awesome, thank you!

Does Squiffy also store the name of the current section? Can you store the name of the current section in a string or another variable for later use, then later send the player to that section via squiffy.story.go(saved_paragraph_string)?

Thanks!

This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums