Making something appear that wasn't there before

Hi! I just started messing with IF last night, and I’m having a bit of trouble finding the answer to my question.

I have a scene in which a poem needs to be read/looked at/examined before a portal appears. Essentially, the poem says something like “Don’t look behind you,” which should compel the player to look in the opposite direction at that given time, thus seeing the portal, when looking in that direction before reading the poem would be fruitless.

How should I go about this?

Thanks in advance. :slight_smile:

Which developing system are you using?

Oops, sorry! I’m using Inform 7.

You can define a thing without placing it anywhere in the model world:

[code]There is room.

Here is a poem. It has description “‘Look behind you!’”.

The portal is a thing.[/code]

Then all it takes to bring it into play is to move it into a room during play – such as the location of the player.

You’d need to implement “look behind” as a new verb, too.

Understand “look behind [yourself]” as looking behind. Looking behind is an action applying to one thing.

Check looking behind yourself:
if we have not examined the poem or the portal is on-stage, try examining south instead.
[Just to trigger the standard “You see nothing unexpected in that direction.” error message.]

After looking behind yourself:
now the portal is in the location;
say “You find an immense inter-dimensional portal has opened up behind you!”[/code]

The puzzle itself might be counterintuitive for most players because the game model usually assumes they can see all directions in a room at once.

Just for kicks, I wrote out an implementation that does what I think you have in mind. It doesn’t require a “look behind” verb. The point of adding the Pantry to the test game is that the player can read the poem in the pantry, in which case the portal will appear but the player won’t see the burst of blue light.

[code]The Library is a room. “A charming Edwardian Library. The door to the pantry is to the west[if the glowing portal is in the Library]. You can also go north through the glowing portal[end if].”

The Pantry is west of the Library. “Empty shelves here.”

The scented piece of paper is in the Library. “A piece of pink, scented paper is lying here.” The description is “Pink and scented – and there’s writing on it.” Understand “pink” and “poem” and “writing” as the paper.

The glowing portal is a thing. “In the north wall is a glowing portal.” The description is “It’s impressive. It’s embedded in the north wall.” The glowing portal is fixed in place.

The Amusement Park is a room. “Wow – look at all the rides! You can go south to return to the Library.” The Library is south of the Park. North of the Library is nowhere.

Understand the command “read” as something new.

Reading is an action applying to one thing and requiring light. Understand “read [something]” as reading.

Carry out reading:
say “Nothing is printed on [the noun].”

Instead of reading the scented paper:
if the player does not carry the paper:
say “(first picking up the piece of paper)[line break]”;
now the player carries the paper;
say “The paper says, ‘Roses are red, violets are blue, this stupid poem doesn’t even rhyme.’”;
if the glowing portal is not in the Library:
now the glowing portal is in the Library;
if the player is in the Library:
say “[line break]A burst of blue light erupts behind you.”

Instead of going north in the Library:
if the glowing portal is in the Library:
say “”;
now the player is in the Amusement Park;
continue the action.

Instead of entering the glowing portal, try going north.[/code]