How to embed text from a passage that is from another section?

PrototypeC3V3
12 May 2019, 23:34

Hi, I see in the wiki you can embed text from another passage with {curly brackets}, but I was wondering if there's a way to fetch a particular passage from another section?

Here's an example (that doesn't work) to give you an idea of what I was trying to do:

[[section1]]:
Here is some text from the next section: {section2}

Here is some text from a passage in this section: {passage}

[passage]:
This is a passage in section1.

[[section2]]:
section2 main text

[passage]:
This is a passage in section2.

The reason I want this is for a codex system where a player can click a keyword that might come around regularly (like the name of a place, for example) and that will display its codex entry, without me having to create a passage with the same text in every section where that word might appear.

Thanks in advance, and happy writing!


Richard Headkid
13 May 2019, 00:24

Hello.

That example works for me. (I just tested it in the Squiffy Scratchpad and in the Linux version.)


PrototypeC3V3
13 May 2019, 00:38

That's because I haven't found a way to fetch the text from "section 2", "passage".

When I do I'd like the second line of the output to read "This is a passage in section2." instead of "section2 main text"


Richard Headkid
13 May 2019, 03:21

Hrmm...

It doesn't look like we can pull from passages from outside of the current section.

You can embed text from another section, or from a passage in the current section, by surrounding its name with curly brackets.

http://docs.textadventures.co.uk/squiffy/embed.html


BUT...

This seems like it might work, if you're just wanting to declare string variables:

[[section1]]:
@set text1=This is the text from text1.
@set text2=This is the text from text2.
Here is some text from the next section: {section2}

Here is text1: {text1}

[passage]:
This is a passage in section1.

[[section2]]

[[section2]]:
section2 main text


Here is text2: {text2}

PrototypeC3V3
13 May 2019, 05:24

Yes, that should work, I'll just set all codex entries as variables at the start of the game.
Thanks a lot!