Quest Gamebook > Conditional IF/THEN wording

I am trying to figure out how to make text show up based on an IF/Then. I've tried

{If HasSeenPage(MelsDiner):You've been to Mel's Diner!}

But that didn't work. How can I do a HasSeenPage script within the Text Processor?

EDIT: I'm trying to display text if the player has visited a page, but within the Text Description so I can have text before, and after what I'm trying to print.


There are two different if commands in the text processor. {if uses a very specific set of conditions, which aren't particularly consistent.

  • Convert an attribute to a string, and compare it to a static string:
    • {if object.attribute = string:
    • {if object.attribute <> string:
    • If the object name is omitted, it will assume the game object, but only if in the attribute exists and is an int (whole number). Otherwise, or if you specify the name of an object that doesn't exist, you will get literal text processor code in the output.
  • Convert an attribute to a double (floating point number) and compare:
    • {if object.attribute < number:
    • {if object.attribute > number:
    • {if object.attribute <= number:
    • {if object.attribute >= number:
    • If the object name is omitted, it will assume the game object, but only if in the attribute exists and is an int (whole number). Otherwise, or if you specify the name of an object that doesn't exist, you will get literal text processor code in the output.
  • Test if the attribute is a boolean true (objects and attributes that don't exist are treated as false):
    • {if object.attribute:
    • {if not object.attribute:

The other if statement, {either, takes an expression like the if statement in a regular script, and also allows a 'else' case separated by a pipe character (|) or a second colon:

{either HasSeenPage(MelsDiner):You've been to Mel's Diner!:You haven't been to the diner yet.}

{either is a lot more flexible than {if, so it's often best to use it even when you don't need the 'else' case.

However, in this case the function HasSeenPage is pretty useless, because all it does is return the page's seen attribute. So you could easily replace it with:

{If MelsDiner.seen:You've been to Mel's Diner!}

Using either is probably a good habit to get into, because its behaviour is closer to the if statement in scripts. But for this task you could use either option.


Log in to post a reply.

Support

Forums