Can you call a room or object's description to print as part of another room's description

Hello everyone.

I imagine that this is possible as I have called pieces of text from here and there. I wonder though, can you call a whole room description via some kind of [include room description] as part of another description?

An example might be looking at another room via a surveillance camera.

the controlroom is a room.

the camera is an object.

the camera can be red.

the camera is not red.

the description of the camera is "The camera is focused on [if the camera is red] The yard. You can see [the description of the yard][else if] the chicken coop. You can see  [the description of the yard][end if]."

the yard is a room.

the description of the yard is "A dog is chasing a ball round.".

the chicken coop is a room.

the description of the chicken coop is "There are chickens pecking at their bowl of food.".

say the description of the yard works fine so far as it goes, but I suspect you’re after the whole output one would get from looking. And that gets tricky quickly, 'cause the only thing that does that is carry out looking and it requires the player to be there.

This is a crude and hacky work-around with not pretty results but that could give one a starting place:

lab is a room. "xar".

Parlor is a room. "foo".
the settee is in the parlor.

to say teleport to (r - a room):
 now the player is in r;

to say looking at (r - a room):
  let l be the location;
  if l is r begin;
    try looking;
    let t be "[teleport to r]";
    let scratch be "[teleport to l]";
    say t; 
  end if;

instead of jumping:
say looking at parlor.
1 Like

This pair of statements gets a lot of what you want, although it’s not exactly the same as being there:

	say the description of R;
	carry out the printing the locale description activity with R;

(The “printing the locale description” activity shows all the objects in the given room. If you’re not personally there, it goes “In the room you can also see…” instead of just “You can also see…”)

(This is imperfect in a number of ways, mind you. Secretly teleporting the player may be better, although I’d recommend the “move the player to R, without printing a room description” phrase.)


Now why is this? I feel like I’ve been trying to discern any difference between ‘move blah’ and ‘now blah is in blah’ in the long term and never noticed one. The main difference so far has been that ‘move (blah)’ is easier to search up in the source.


They are identical, except that “move player” supports the “…without printing a room description” modifier.

My point is that if you do this (combined with “try looking”) it’s less rickety than the "[teleport to r]" trick.

1 Like

Thanks, Andrew; I didn’t remember the modifiers to move <object> to <object>; they make for a much less grotty approach:

To remote view (r - a room):
  let l be the holder of the player;
  if l is r begin;
    try looking;
    move the player to r, without printing a room description;
    try looking;
    move the player to l, without printing a room description;
  end if;

(That also fixes my original use of location instead of holder of the player.)