Needing help on a wait-through scene (and a few other stuff)

So currently I have this in my source code.

Aquarium Window is a room. "The giant window showcases an aquarium bigger than the window itself."

I have no idea how to make it say

"A fish swims by"

on the next turn, changing the room description to

"The giant window showcases an aquarium bigger than the window itself. Some fish are swimming by."

Then having the game talk about the fish (the same text) at every alternate turn until after several times it says

The fish that swam by dropped a clam!

which changes the room description to

"The giant window showcases an aquarium bigger than the window itself. Some fish are swimming by. A clam also sits on a  rock"

While still talking about the fish and moving said clam into play. 2 turns later it would say

"The clam opens to reveal a pearl! The pearl falls and hits the seabed while the clam is swept away by the current"

which moves the pearl into play while removing the clam. Which changes the description to

"The giant window showcases an aquarium bigger than the window itself. Some fish are swimming by. A pearl is stuck on the seabed"

I know it sounds kinda complicated but i have no other way of explaining it. D: Also I’ll focus on the “other stuff” when I get this solved.

(Mostly it’s the problem of changing the room description and also using “say”)

EDIT: I also forgot to mention that the player will remain stuck in this room until this scene ends though free to examine anything.

I don't have Inform 7 at my disposal right this moment, but I'll hazard some tentative help anyway.

A text token is a sort of generic wrapper for some words; a “To say” statement is one way to determine what’s inside the wrapper.

For example:

The Aquarium is a room. The description of the aquarium is “[aquarium-state].”

To say aquarium-state:
if a clam is in the aquarium:
say “The aquarium, whose sole inhabitant is a clam, seems fairly sedate”;
say “The aquarium seems quite serene”.[/code]

You’ve also said you want to have a small scene occurring while the player-character is in the aquarium. There are numerous ways to implement the ideas you mentioned, but in fact an Inform “scene” will handle almost all of them fairly well.

For example, you could write something like:

Aquarium-visiting is a scene. Aquarium-visiting begins when the location of the player is the aquarium for the first time. Aquarium-visiting ends after going from the aquarium.

Every turn during aquarium-visiting:
do this, do that, etc[/code]

Or you could write something like:

The Aquarium is a room.  The aquarium has a number called aquarium-status.  Aquarium-status is usually 0.  The description of the aquarium is usually "The giant window showcases an aquarium bigger than the window itself."

There is a clam. [note, we don't say where, which means it's off-stage]

After going to the aquarium for the first time:
	increment aquarium-status.

Aquarium-visiting is a scene.  Aquarium-visiting begins when the location of the player is the aquarium for the first time.  Aquarium-visiting ends after going from the aquarium.

Instead of going during aquarium-visiting:
	unless the [whatever has happened]:
		say "Nope, you can't leave yet.";
		continue the action.

Every turn during aquarium-visiting:
	unless aquarium-status is 1:
		if aquarium-status is 2:
			say "A fish swims by.";
			now the description of the aquarium is "The giant window showcases an aquarium bigger than the window itself.  Some fish are swimming by.";
			increment aquarium-status;
		otherwise if aquarium-status is 3:
			say "The fish that swam by dropped a clam!";
			move the clam to the aquarium;
			now the description of the aquarium is "The giant window showcases an aquarium bigger than the window itself. Some fish are swimming by. A clam also sits on a  rock.";

and so forth.

I’m reluctant to write any more, since as I said I don’t have Inform to work with and check anything I’m telling you. But generally speaking, some of these ideas (which are hardly the only ways to do what you’d like) should get you thinking about how to pull together all the things you mentioned.


I didn’t really get the text just by reading it and I don’t have time to check it right now. Thanks for now, when I check tomorrow. It should be noted that I used placeholders due to me not wanting to reveal what I was doing (I really have to stop that behavior). The player is automatically moved after the scene has ended, by the way.

About my other thing, a barrier that can be placed by doors that block things (or people, animals, stuff you hold) with certain characteristics (if you hold the item yourself will not be able to cross) and not others (like yourself).

Also something I did plan on doing though I am not sure if it even is gonna be in the game: A movable container operatable with buttons inside it. AKA vehicles.

EDIT: Another thing, the “Fish swimming by” part is recurring every 2 turns while the scene lasts.

Vehicles are a built-in kind; declare “The crab suit is a vehicle” and you’ll have an enterable container that moves around with the player. This will respond automatically to navigation commands, which you may not want; one possible solution would be to disable the navigation commands until the player has figured out how to work the buttons. Another solution would be not to make the suit a vehicle, but merely an enterable movable container (just declare “The crab suit is a container. It is enterable”), and move the player and the suit when the appropriate button is pressed – but if you do that you’ll have to make sure you don’t accidentally move the player through any closed doors or something like that. (My guess is that it’d be simpler to make it a vehicle and intercept any navigation commands, because intercepting the navigation commands will be simpler than recreating the rules for going from scratch, but I haven’t tried it.)

One thing about vehicles and movable containers: if you have rooms outside rooms, it may be tetchy for the player to go outside while in the vehicle. (I just tried this and had to type “go out” to drive the vehicle outside, because “out” had me exit the vehicle.) The solution may be not to use “out” as a direction if you’re using vehicles, at least not in a room where you can be inside the vehicle.

Not that I wanted a crab suit (more like submersible giant robot) though wearable vehicle sounds interesting, is it possible to have rooms in containers? I know outright rooms aren’t allowed but it could possibly be faked with adjacent containers. (the airlock and the control room cannot share the same space after all.

Well, the code I posted – wait, I didn’t actually post any code, did I? Hold on.

This code:

[code]The crab suit is a vehicle in Reading Room. The button is a device in the crab suit. It is switched off.

Instead of pushing the button:
if the button is switched on:
try switching off the button;
try switching on the button.
Instead of switching on the crab suit: Try switching on the button. Instead of switching off the crab suit: Try switching off the button.
Rule for printing the name of the button while switching on or switching off: say “crab suit”. [This means that it prints “switching on the crab suit” instead of “switching on the button.” It may not be the best solution.]
Last report switching on the button: say “The crab suit powers up and clamps onto you.”
Last report switching off the button: say “The crab suit powers off and relaxes around you.”
Instead of going when the player is in the crab suit and the button is switched off: say “You’ll have to switch on the crab suit or get out of it.”
Instead of exiting when the player is in the crab suit and the button is switched on: say “You’ll have to switch off the crab suit in order to get out of it.”

and similar code where you implement a vehicle doesn’t actually make it wearable – commands like “wear suit” won’t work. (Clothing is another kind that can be implemented automatically, where you could write special rules to make sure you can’t move while wearing it if you haven’t switched it on, and maybe some other stuff, but that’s not what you want to do anyway.)

[This code probably has some issues, by the way. For instance, if you’re in an enterable container, I think you can get out of it while the crab suit is switched off, because this code doesn’t block exiting. I say “I think” because the code doesn’t let me get into an enterable container without getting out of the suit anyway, at least not in the scenario I dropped it into.]

Anyway, if you want multiple rooms inside the vehicle you probably want to fake it the other way around – instead of creating a vehicle, create a bunch of rooms for the inside of the giant robot, and then do something that makes sure that when you enter and exit the giant robot you wind up in the same place. There’s some discussion of that here; note that though you have an enterable container, the player never winds up in it; when they enter the container they wind up in the appropriate room inside the TARDIS. (The comment above that one has a more complicated and probably less satisfactory way of doing the same thing.) Then you could use whatever code you want to allow the robot to move around when the player pushes the buttons; you’d just need to move the robot-container from one room to another.

One complication is that you probably want the player to be able to see outside the robot. In this case, to do that you’d probably have to put the room where the robot is in scope when the player is inside the robot (or in the observation room, or something). Some of the code in the example Dinner Is Served would probably be useful there.

The only window I’d like would probably be in the control room. It is possible to have the control room be the only container, with the rest of the robot rooted at some place (though the air lock might need a bit of work).

Instead of going down, move player to Torso Hub

and the code for the Torso Hub would be

Instead of going up, move player to Control Room

Meaning the control room is the only container part.

When up button is pushed, move Control Room to Coral Shores

Though the underwater rooms probably need fine-tuning (and prevent the player from trying to enter them.

Any ideas for the barrier thing?

I just tried Endosphere’s last solution which I modified to what I was actually doing (a stasis pod malfunctioning and not giving air to the player) and one of the things I managed not to do was aliases to the objects and all the saying.

The ??? is a room. The description of the ??? is usually “You do not know where you are. You cannot focus your eyes to make out anything and to top it off, you cannot breathe.”

Bedroom is a room

There is a red thing. It is scenery. “All you can make out is a red fuzzy circle.”
There is a red release button. “This red button has the words release printed on it’s side.” It is scenery. The red release button can be pushed.

[These are aliases I’m gonna need help with]
Understand “fuzzy” or “circle” as red thing
Understand “fuzzy” or “red” or “thing” or “circle” as button

Instead of examining yourself:
say “Your eyes feel blur and you cannot breathe”

Instead of pushing button:
say “You muster up some strength but even then you have no energy to lift your arms”

Malfunctioning Pod is a scene. Malfunctioning Pod begins when the location of the player is the ??? for the first time.
Instead of going during Malfunctioning Pod:
say “You try to get up but you lack the energy to do so.”

[Something isn’t right here either]
During Malfunctioning Pod:
wait one turn
say “You still cannot breathe”
say “You hear a robotic voice. ‘‘It is O-eight-hundred hours’’”;
wait one turn
say “You still cannot breathe”
say “You squint your eyes and you are able to make out something red”
now the description of the ??? is “You do not know where you are. You cannot focus your eyes to make out anything and to top it off, you cannot breathe. You barely make out something red and fuzzy.”
move red thing to ???
wait one turn
say “You still cannot breathe”
say “’‘It is O-eight-hundred hours’’”;
wait three turns
say “You forcibly squint your eyes further and the red thing turns out to be a button.”
now the description of the ??? is “You do not know where you are. You cannot focus your eyes to make out anything and to top it off, you cannot breathe. You see a red button in front of you.”
move red thing out of play
move red release button to ???
wait one turn
say “’‘It is O-eight-hundred hours’’”
wait one turn
say “The robotic voice says ‘‘engaging emergency release’’”
wait one turn
say “You feel yourself being pulled out and you breathe in some fresh air”
move player to the Bedroom.[/code]

Yes, I notice some tabs are out of line, I’ll leave them be. You can fix it if ya want.
EDIT: Fixed it

That should be simple. Something like this:

A room can be underwater or aboveground. A room is usually aboveground. Instead of going to an underwater room: Say "You can't breathe underwater!"

If there are other breathing apparatuses that let you go into an underwater room by typing directional commands, then you have to make that “instead” slightly more complicated (for instance, if you make the submersible robot a vehicle); but if you can only go underwater by pressing buttons that should be fine.

Hm. So you’d implement the Control Room as an actual container, with descriptions of how to get to the other rooms, and then move the player to the other rooms by hand? That seems like it might be possible; the syntax you want would be something like this:

Instead of going down when the player is in the Control Room: Move the player to the Torso Hub.

It might not work very well for the room descriptions when you’re in the Control Room. The default description would look something like this (though I haven’t tested to see exactly what):

Which isn’t very satisfactory; you need to replace the “In the Control Room” stuff with something that actually makes the Control Room seem like a room, and that describes how you can get to the other parts of the submarine.

Whereas if you make the Control Room a room, and use a rule to describe whatever room you’re in, you get something like:

There are advantages and disadvantages to both approaches – the first approach places the emphasis on the underwater location, not on the control room, which might well be better. But I think the first approach might also require a bit more customization; you’d want to turn (inside the Control Room) into (inside the giant robot), and you’d want a special rule for talking about the Control Room when you’re inside it – which might not be too hard, once you figure out the right activity to write a rule for. Also you’d want to make sure the player can’t exit the Control Room and wind up in the water (the first rule I wrote won’t work for that, since getting out of a container isn’t going in a direction). But it might be made to work nicely.

Your “understand” statements look OK to me, except that you need periods at the end. Also “red thing” might not be an acceptable name, since “thing” is a kind of object in Inform (I’m not sure). Also, you don’t need to define “red” here; it’ll automatically be understood, since it’s part of the objects name.

Scenes don’t work the way you have it, though. What you want is a series of rules saying things like:

Every turn when time since Malfunctioning Pod began is 2 minutes: say "You still cannot breathe."

or something like that – I’ve never programmed scenes myself. “Wait one turn” doesn’t work – the closest that you could come is “try waiting,” but what that would do is have the player wait (as if they had typed “WAIT”). You really need separate rules (or a table of events) to trigger the different things you want to happen during the scene.

Also, make sure that you have “Instead of examining yourself while Malfunctioning Pod is happening:” – you don’t want that rule to trigger when the scene isn’t happening.

Example 159 “Day One” in the Recipe Book shows how to do this with tables.

Though that example is just about printing different texts, not moving things in and out of play. Though you could use that approach anyway, moving things in and out of play using text substitutions and to-say phrases.

(And it looks like, as in that example, you want to disable every action except a few examines and maybe some other things during the scene. You don’t want the player jumping on the spot, fruitlessly, or heaven forbid taking the button.)

I’m giving up on the character actually doing stuff and I’m gonna just get the player to see what happens without doing anything. Right now the problem is beginning the scene…

When play begins: [Whole buncha stuff here that actually works as planned, not needing me to bringing it up] begin Prologue

Prologue is already defined as a scene and I’m pretty sure that’s not the code. I would’ve done a

Prologue starts when...

but there is no point in time to define that.

So you want to start the scene right when the game starts? You can piggyback on the “Entire Game” scene that starts when the game starts and lasts for the duration of the game.

Prologue begins when the entire game begins.

Nope, I did mention I added stuff in between. What I probably did fail to mention was that there was some player interaction there.

Ok, then you just have to figure out what is the change in the world state that would trigger the scene and use that. The common trigger is a change in the player’s or some other object’s location, or a change in some object’s property.

I did give him something near the end of that sequence though he would use it often and sometimes some players actually drop it (because they want to). I should prolly just give him a box of beans that won’t be able to be seen by the player.

You can prevent the PC from dropping things. I don’t have access to Inform, but:

Instead of dropping the Vital Plot Element: say "You don't want to leave behind [the noun]!" instead.

Much, much easier than coding an invisible thing (which is likely to be uncovered by some players anyway, since it’s hard to really hide stuff).

You can do this with every object (instead of dropping something) or one specific object (instead of dropping the camera) or a certain kind of object (A thing is either essential or nonessential. A thing is usually nonessential. The Vital Plot Element, the camera, and the purple buffalo are essential. Instead of dropping something essential . . .)

I’d test those if I were able, but I can’t, so the syntax may be slightly off.

But it doesn’t have to be a held item or location that triggers a scene. Scenes can start in a specified number of turns, or in response to a player action, or almost anything you can think of.