Hiding an entire puzzle until condition met

Hi,

I have an entire puzzle, complete with objects, that I want to hide until a condition has been met.

I don’t want to hide the room, just all the elements of the puzzle, their descriptions, interactivity etc etc. I thought perhaps a region, but not sure.

Is there a standard way of doing this?

I think it’s common to keep the objects offstage and only move them into the room when the condition is met?

6 Likes

I do not know what standard ways exist besides the ones I used in a previous work:

  • Making a thing undescribed (it will not show up in a ‘look’ result, and ‘get all’ will also not ‘see’ the thing. But if the player knows it exists and Inform has a (default) understand statement for it, it can be interacted with). I used this to hide closed portals (actually doors) so the player could only see and interact with them when open.

  • Moving a thing from another location (or ‘nowhere’) to the room when the thing can be interacted with. Probably much easier to use than the undescribed trick (I needed that for doors):

now <item> is nowhere; [ move it offstage ]
now <item> is in <room>; [ move it into the room ]

If things are not in the room or mentionable by the player, that also rules out examining them or interacting with them in other ways.

However I think ‘making things appear’ does need some explanation to the player (e.g. the player sees the portal appear, or some previously examined object glows to indicate something has changed).

Another trick might be to swap a regular object (e.g. a painting which can be examined but not otherwise interacted with) with another object (a portal which looks like the painting, but now the player can enter the painting to move to a hidden location), but then again we still need to explain to the player something happened (maybe as a direct result of a player action, e.g. casting a spell).

In my current WIP I have a similar situation (I do not want the player to work on subsequent puzzles until they finished the initial puzzle). I try to avoid ‘appearing objects out of nowhere’ and use other means:

  • the player needs a key object to unlock the puzzle room
  • the player needs a trigger object to be able to start the puzzle (e.g. to brew tea, the player needs to find a tea recipe. All ingredients are readily at hand, but the player can only start collecting these after they found the recipe and know what herbs etc. to collect)
  • the player needs a trigger action to be able to start the puzzle (e.g. the player needs to sit down in front of a chess board to start playing a chess game, but is prevented to do so by an NPC “we have more urgent matters at hand” until the game is ready)

Just my 2 cents.

4 Likes

I think @JoshGrams has the answer. In fact I was only introduced to ‘off-stage’ the other day, so that should have been fresh in my mind! I haven’t tried it yet but will attempt this solution first.

1 Like

Well, Onno said the same thing, and gave actual code, but I guess sometimes a short summary is useful, heh

1 Like

Yeah, in general the easiest thing would just be to create the relevant objects but not place them in a room, then write a rule moving them all to the appropriate place once the condition is met. If it’s just one action that triggers the change, a simple After rule or something like that could work; if multiple different things could be the trigger, a scene might be the way to go. I don’t think a region would be an intuitive way of doing things, but if you want to share more of the details I’m sure we can give more specific advice!

1 Like

This is massive overkill for most purposes—and probably even for my purposes in this case!—but this is how Enigma of the Old Manor House handles lighting.

Include Scopability by Brady Garvin.

A thing can be lightbound, darkbound, or unbound. A thing is usually unbound.
To decide whether there should be light:
	[game-specific code]
To decide whether there should be darkness:
	if there should be light, no;
	yes.

To rearrange the set:
	if there should be light:
		now all lightbound things are scopable;
		now all lightbound things are not undescribed;
		now all darkbound things are unscopable;
		now all darkbound things are undescribed;
	otherwise:
		now all darkbound things are scopable;
		now all darkbound things are not undescribed;
		now all lightbound things are unscopable;
		now all lightbound things are undescribed.

Before doing anything with an unscopable thing: [Can happen with bare GET]
	now the latest parser error is the can't see any such thing error;
	carry out the printing a parser error activity;
	stop the action.
Rule for printing a parser error when the latest parser error is the can't see any such thing error and there should be darkness: say "You feel around, but can't find any such thing in the dark."

Every turn: rearrange the set.
After going: rearrange the set; continue the action.
Before looking: rearrange the set.
When play begins: rearrange the set.