Create a fixed in place tourist telescope


I want to create a fixed in place tourist telescope (coin operated). When used it allows you to look N,E,S,W etc. For all directions is just returns the room description of what is N,E,S,W, but for one direction, e.g. North, you get to see something that you wouldnt see if you were in that location e.g. an NPC up to something (hiding something).

I’ve looked at telescope and ‘ginger beer’ in documentation, but it’s not what I need.

You might want to check out §3.4 of the Recipe Book (not the main documentation!) on “Continuous Spaces and the Outdoors” which has several versions of a “look toward” command, which enables you to look toward certain rooms. These tend to work by giving you a list of things in the room you’re looking toward rather than an explicit description, but you could change it to print the description and then a list of things. (Or, since your setup will be limited to four rooms, you can write special descriptions for the rooms without worrying about things getting out of control.)

There’s a lot of other aspects to this–the coin, communicating the proper syntax to the player–if you have any more questions, do post them.

If you want to just get the results of looking in another room, you could try putting this at the appropriate place in your code (for you it’d probably be in the rules for looking through the telescope, where you’d already determined what the room you want to look in is)

	let home be the holder of the player;
	move the player to the room looked into; [where the room looked into would be the room that you want to look in--you'd have had to set that somehow]
	move the player to the home, without printing a room description.

This stores the original place where the player is in a temporary variable called “the home.” (Making it the holder of the player instead of the location means that if the player is on a supporter or something, they’ll return to it.) Moving the player to the room looked into will print the room description and all the associated stuff for the room looked into–then moving the player back to the home without printing a room description will restore the location. So the effect is like printing the other room description without moving.

I haven’t tested this too much, though, so it might break some things. And you’d have to make sure that your room descriptions are suitable for both looking in the room and looking through the telescope.

1 Like

Try this extension. Once you’ve included it, you can get a full description of any room using

describe [a room]


describe [a room] from the viewpoint of [an object]

So then you’d just need a new action:

Pointing it to is an action applying to one thing and one visible thing.
Understand "point [something] at/to/-- [direction]" as pointing it to.

Some basic rules:

Check pointing it to when the noun is not the telescope: say "Nothing interesting happens." instead.
Check pointing the telescope to: if the room (second noun) from the location is nothing, say "You see nothing in that direction." instead.
Carry out pointing the telescope to a direction:
    let the place be the room (second noun) from the location;
    say "You peer through the telescope...";
    describe the place.

And a special case for north:

After describing the Roof of Symphony Hall:
    say "You also notice a message written on the roof tiles, only visible from far away!"

Maybe give the player some syntax hints too:

Instead of searching the telescope: [LOOK THROUGH = SEARCH]
    say "When it's not being pointed at something, the telescope gives you a wonderful view of the stamped-metal floor. [italic type][bracket]Try POINT TELESCOPE SOUTH to get a better view.[close bracket][roman type]"

After examining the telescope:
    say "[italic type][bracket]You can move the telescope with POINT TELESCOPE EAST, for example.[close bracket][roman type]";
    continue the action.