Branching Storyline Descriptions

What’s the best way to make… Oh, how do I put this… branching storylines based on what the player looks at/interacts with first?

So, there's a secret in the game, that essentially changes all the text and how you'd search things before you find it and after you find it.  So, there's in turn at least three ways the character would interact with a lot of items:
  1. First interaction (without the secret)

  2. First interaction (with the secret)

  3. All following interactions.

There may even be a fourth subset, where you interact with the thing again and don’t know the secret, but that’s a little less likely, and a bit less useful.

How do I present this, then? I’m guessing I need an “if” statement in there, somewhere, and something that saves the state of the game, but how to go about doing it is where it gets tricky. I know there’s a way to have your initial interaction with something be different overall, but I can’t seem to find it again in the manual.

I imagine mixing the two together would get a half-decent result, but, eh… I haven’t had much luck making “if” statements with dialogue yet. I think I deleted the last time I tried it with a door, so I’m not sure if I can share and get a code-level diagnosis, but either way help would be appreciated.

You can set variables, or switch the text based on what the parser knows.

[code]Study is a room.

Suspicion is a truth state that varies.

Lady Cottingley is a woman in Study. The description is “[if we have examined Lady Cottingley]You have already studied her well. [otherwise]Lady Cottingley is a suspiciously flamboyant woman with her monogrammed white handkerchiefs spotted with tiny red roses. [end if][if suspicion is true]You know she is the murderer![end if]”

A bloody candlestick is in Study. The description is “[candledesc]”

To say candledesc:
say "It is seemingly covered in dried blood that someone has attempted to wipe clean. ";
if we have examined Lady Cottingley:
say "Zounds, you notice a backward monogram from a handkerchief stenciled in the blood! It’s a backwards C!!! ";
now suspicion is true.

What if there’s more than one way for the variable to be triggered, or to logically be triggered?

Like, first time through, obviously you take the book from the bookcase and read that, because that’s what everything is pointing to. But because we’re setting this in a normal house where you can read anything anywhere, you should logically be able to read something without a cop-out of the reveal that goes something like “you don’t feel like reading right now”. And my case makes even less sense than that. Because of that, there are now at least three ways – possibly more – to trigger the variable.

I’m thinking this is probably more of a logistical problem than a coding problem, but having three or more different ways to change a variable quickly gets… wordy. Do I essentially just do the same thing, limit the effect, and try to deal with it?

I’m not sure I understand the problem.

You say your variable can be set in multiple ways. As long as the variable is set in one place, it’s going to stay the same. If knowledge.gained is set to “true” by reading a book or attending a class, it shouldn’t make a difference so long as the player gets it from somewhere.

If you have multiple variables or conditions that must be met, you make a longer rule or use a decide phrase.

[code]To decide if knowledge was gained:
if classroom is unvisited:
decide no;
if we have not examined the tome of lore:
decide no;
if einstein-dream is false:
decide no;
decide yes.

Check opening The Vault of Unknowable Answers:
if knowledge was gained:
continue the action;
say “You are not worthy.” instead.[/code]

If you have a situation where you just want the player to do several things and it doesn’t matter if they repeat them, say going to class for five days, or reading for five days, you make a numeric stat variable like

[code]Knowledge is a number that varies.

Carry out reading the encyclopedia:
increase knowledge by 1.

Carry out studying in class: [whatever this is]
increase knowledge by 1.

Before going to College:
if knowledge < 5:
say “You’re not ready for college.” instead.[/code]

Thank you – I’m sorry that I’m being confusing. I guess I’m just in the mode of thinking “I now have to write three different revelation scenes for this game” when I should be thinking “how do variables work”.