0 votes
by (130 points)
retagged by
This is less about taking a different passage, but I have the options in my story to call 5 different characters. How do I remove the option to call someone if they choose them?

For example, if they choose to call Mike first, then call Sarah, how do I hide the option to "Call Mike" on Sarah, or the other character's call pages? Whenever someone calls a character, the variabe "CallNAME" is set to "y", but I don't know how to hide options if the variable is set to y, essentially.

Thanks in advance!

1 Answer

+1 vote
by (8.9k points)

Hey LMan!  Please use the Question Tags to state which version of Twine and which Story Format you're using, as the answers will differ.  Also, it's much easier to help you if you paste in the existing code.

In Sugarcube, you could use the <<if>> macro.

<<if not $callMike == "y">>\
  [[Call Mike]]
<</if>>\
<<if not $callSarah == "y">>\
  [[Call Sarah]]
<</if>>\

(The \ back slashes at the end of the code lines prevent blank lines appearing in the game.)

If your variable is just a yes/no, it might be better to use a boolean.  Here's how it would work.  When the player calls Mike, you would:

<<set $calledMike to true>>

Then, in future passages:

<<if $calledMike>>
  The player has called Mike.
  <<elseif not $calledMike>>
  The player has not called Mike.
<</if>>

 

by (130 points)
Awesome, thanks so much! When I get back to my workstation, I'll give it a try! Sorry, I'm a complete beginner, I'm not sure what Story Format I'm using, but I know I'm on Twine 2.2.1! Thanks, again! :)
by (8.9k points)

Your Story Format is very important because it sets which coding language your story uses.  You can check your story format in Twine by clicking the name of your story on the bottom left (next to the home icon), and choosing "Change Story Format" from the popup menu.

The default story format is Harlowe (and the code above won't do anything in Harlowe).  If you want to stay using Harlowe, you should reäsk this question so a Harlowe expert can see it and help you.

Guide to picking Story Formats:

  • Pick Snowman only if you're already a good JavaScript developer.
  • Pick Harlowe or Sugarcube otherwise.  Most people think that Harlowe is slightly easier to learn, and that Sugarcube is more versatile.

My personal advice is to go with Sugarcube, since you're not already familiar with Harlowe – if you're going to learn a coding language, you may as well learn the one that lets you do more.

I learned Sugarcube from Vegetarian Zombie's YouTube tutorials...and coming here when I got stuck!

Best of luck.  :-)

...