Enquirer Home Page | Twitter | Back to Improbable Island

Advanced Techniques I - Making a Grand Entrance - Full Version

You've got a room in your Place. You've got several rooms in your Place, but one in particular. This room has several entrances leading into it, and you'd like to set things up so that how a guest sees this room depend on where they came into it from. One way of dealing with this in the simple case of just two entrances was covered in Program Tutorial V. Here we show a slightly different method, one which works for any amount of entrances.

For this method the room descriptions need to split into two parts. First an entrance specific paragraph (or paragraphs). "The great doors open in front of you...", "You sweep majestically down the stairs...", "Going through the door you find yourself coming into the side of a great hall...". Then second, a general description of the room. "The hall is well lit by the two enormous chandeliers...". Decorate your room with the general description, and build a page each for of your entrances, decorating each of them with your specific descriptions.

To program this, you need one Previous Room Contrivance and one Show Page Contraption for each entrance. Arrange them in the programming grid so that each line has a Previous Room Contrivance on the left hand side, and the corresponding Show Page Contraption in the escape hatch. Click on the program flow knobs so that they all show Any Fail. Your program should look something like this.

 Different views of the same room depending on where you came in.

There you go.

Note: If you want all of your rooms to look quite different, without a shared general description, then that is easily accomodated. Simply decorate your main room with an empty decoration, and then each of your pages with the desired entire decoration.

There is a slight variation on this theme. The final row does not have to have a Previous Room Contrivance on it, just the Show Page Contraption. This will fire whenever none of the other Previous Room Contrivances have passed.

 Setting a default page to cover 'none of the above'.

This can be useful in two different situations. In the Great Hall example, there might be several doors leading into the hall from the side, all of which have the same entrance descriptions. Instead of having a program line for each of them, you can put the "Sweep down the stairs..." and the "The great doors open in front of you..." parts of the program on the first and second lines, and then just put a Show Page contraption pointing to the side door entry description page on the bottom line. This will then catch all of the side doors.

The second use for this is in the very first room in your Place. A guest could be coming into here from the outside, and you can't set the Previous Room Contraption to point to that. In this case you can have the entry descriptions for all the other ways into your first room on the first lines of your program, and your 'Come in from the outside world' description on the bottom line by itself.

Note for budding programmers.

Notice how the program flow knobs and the escape hatches are being used here. Each line asks "Did the guest come in from this room?" If the answer is no, then continue to the next line and keep looking. Otherwise go to the escape hatch and fire the Show Page Contraption there.

This trick can be used to have whole lists of instructions, but there's a catch. As soon as one line in your program fires the escape hatch, then no further lines will be looked at, so ensure that this will not be a problem. This idea will be looked at in more detail in the next tutorial, but note that in this case you're not going to have a guest entering your room from two different directions at the same time, so you're only ever going to want one line's escape hatch to fire.

Using this can get a little confusing, as it's more natural to think of the escape hatch as what happens if the line passes, if the line fails then keep looking. In the above program, if the guest enters from this direction then show this page, otherwise keep going. This is the opposite round way to the way the program logic flows. Be careful when setting the program flow knob. At the risk of over emphasising this, we will show another example in the next tutorial.

Combining this program with other Pages in the room

If you use the second variation, with only a Show Page in the last row, note that this program will fire all the time whenever someone is in the room. Even when they're looking at other Pages - and the Page they are looking at will appear below the text in your final ShowPage.

This doesn't always look very nice. Having the text for "look around the room" appearing on top of the text for "examine clock" is to at the least confusing, since if people click on a Page then its text usually appears on top of the room description (or, if you've set it, without the room description at all).

How to get around this: in every Page in the room which is accessed via navigation link, add a Stop Program contraption. This stops all programs, including the ones in other grids in the room - so including the room program with its Previous Room to Show Page actions. Your guest will only see the decoration in the Page that they just clicked on.

But then that leaves your guest unable to see the room's description again without leaving the room and coming back in. How to get around that: add another Page to the room, and call it something like "look around the room". How you decorate it will depend on how your Grand Entrance program is set up: if your program adds text to the top of the original room description, leave it blank; if your program substitutes an entire description (e.g. to a room which is decorated with a blank description or via a Hide Room Description contraption), then give it a non-directional description, the text that you'd want someone to see if they're just standing in the room e.g. after having looked at an item in it. In the Master Settings, as above, if your ShowPages add text, set it with room description to show; if your pages substitute text and your room description is blank, set it to hide the room description.

And how to use this Page? There are two ways. The simplest is just to let it be visible all the time - so your guest walks into the room and sees the "where you came from" text. Then they click on either "look at the clock" to look at the clock's page and then "look around the room" to look at the room's non-directional description, or, they just click on "look around the room" to look at the room's non-directional description.

There's a slightly classier way to use it. If you don't want them to see a "look around the room" navlink unless they have clicked to look at something else within the room, then you can hide it. Not via Master Settings, though - leave it with its navigation link visible. In the Room program, in the first row, add a Hide Page Link. Now, the "look around the room" Page will not appear in the navigation links when someone has just walked into the room or chatted in it; but once they have clicked on another Page in the room, then they will see that Page's description - and the Stop Program in that page will stop the "Grand Entrance" system, so that'll hide - and, now, a new navlink will appear to them to let them "look back around the room", which when they click on it will display the non-directional description.

You could even give each Page in the room its own "look around the room" escape-back-to-room, if you like. Say you have Pages "look at the clock" and "play with the music box". Make two more Pages, with navigation links hidden, and decorated with e.g. a line about turning away from the clock or putting the box down along with a modified non-directional "look around the room". In the page "look at the clock", add an Add Page Link pointing to the page for "look around the room - from clock". Add your Stop Program after that, so that the page link is shown before the program stops. In the page "play with the music box", add an Add Page Link pointing to the page for "look around the room - from music box", and a Stop Program.

Further notes

This subsection, of course, can be used for any page, whether or not there are other programs in the Room. If you click on a Page's navlink and read its text, but then want to go back to just the original room description, have a "back to room" page with a blank description.

And if you want to have the "back to room" link show only from having clicked in a page, remember it can be done either by having a Hide Page Link in the room and a Stop Program in the pages to click on, or by having the navlink hidden in Master Settings and adding an Add Page Link in every other Page in the room.

Best of all: if you are happy with having a standard navlink text for "turn back to room" throughout your Place, and you only use the first version of the Grand Entrance system, then you only need one Page (decorated blank). Not one Page for each Room, not one for each Page in each Room: just one. The Add Page Access contraption can point to any Page in the Place - and if its description is blank, then only the room description will show.

Proceed to next part of advanced tutorial.
Return to Introduction to Programming.
Return to Places Overview

Logged in as: Guest (Guest)
places/advtuti.txt · Last modified: 2017/05/28 03:54 (external edit)