Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

"display" question

edited March 2017 in Help! with 2.0

I work with Twine 2.1.1 and sugarcube 2.14

To make some passage lighter, I made a "display passage".

The purpose of this "display passage" is to show some image depending of a rand.
Here is the code :
<<if $Woman>><<if $WS2==1>>[img[Pics/NPC/Random/NW1.jpg]]<<set $Woman to false>><<elseif $WS2==2>>[img[Pics/NPC/Random/NW2.jpg]]<<set $Woman to false>><<elseif $WS2==3>>[img[Pics/NPC/Random/NW3.jpg]]<<set $Woman to false>><</if>><<else>>[img[Pics/Town/Streets/Main Street.jpg]]<</if>>

<<if $Schoolgirl>><<if $SG2==1>>[img[Pics/NPC/Random/NSG1.jpg][$Schoolgirl to false]]<<elseif $SG2==2>>[img[Pics/NPC/Random/NSG2.jpg][$Schoolgirl to false]]<<elseif $SG2==3>>[img[Pics/NPC/Random/NSG3.jpg][$Schoolgirl to false]]<</if>><<else>>[img[Pics/Town/Streets/School street.jpg]]<</if>>

The fact is that "$Woman" is in a different passage than "Schoolgirl". So if I call the "display passage", I see two pics.

So my question is : Is there a way to call only a part of a "display passage"?
I look in the sugarcube documentation, and I don't find it.



  • The only way to output only part of a passage's content is to use a conditional statement (like an <<if>> macro) to control which part of that content is outputted, which is what you are already doing with the checking of the $Woman and $Schoolgirl variables.
    Alianna wrote: »
    The fact is that "$Woman" is in a different passage than "Schoolgirl"
    If you know the name(s) of the passage(s) that you want the Woman related images to appear in then you could use that to determine which set of images to choose from. You can use the passage() function to determine the name of the current passage being shown.

    note: I don't know the names of your passages so I has to make them up, I also don't have access to your images so the example outputs text instead.

    1. Woman passage:
    <<display "Display Image">>

    2. Schoolgirl passage:
    <<display "Display Image">>

    3. Display Image passage:
    <<if passage() is "Woman">>
    	<<if $Woman>>One of the woman images<<else>>Main Street<</if>>
    	<<if $Schoolgirl>>One of the schoolgirl images<<else>>School Street<</if>>
  • edited March 2017
    Hi, thanks

    I was looking in the wrong section of sugarcube ...

Sign In or Register to comment.