Site Tools
User Tools

Advanced Techniques III - DIY gadgets, or, Programs as Gadgets Part 1

So you're trying to use the 'multiple commands' trick that has been talked about in the previous two Advanced Techniques pages. You have several commands. There's an ornament or somesuch which, if your guest works out to pull it, then a door is revealed. So that's a Show Page (“As you pull the statuette of the Watcher there is a creak behind you. Turning around you see the wardrobe swing to one side revealing a secret passage!”) and an Add Page Link (“Go down the secret passage.”). There's also a rather more obvious lever, which when pulled opens a trapdoor beneath the player. That's a Warp to Room Contraption, oh and you want to know that this has happened, so you want to increment a memory at the same time.

Now there's a problem. For both of these actions you need two Contraptions, and you can't fit them both in the escape hatch. What to do?

The short answer is - use a Run Program Contraption. For each of your actions build a new program somewhere. Call one Pull the Watcher, and put the Show Page and the Show Page Link Contraptions in it. Call the other Activate the Trapdoor and put the Increment Memory and the Warp to Room Contraptions in it. Now in the original program simply put Run Program Contraptions in the escape hatches, with the parameters set pointing to the appropriate programs.

Note: Do not put these extra programs in the room in which you want the action to happen, indeed, don't put them in any room or page where your guest is ever going to go to, otherwise they'll run automatically when your guest enters the room/looks at the page. Build a special room or page to put them on. Seeing as they're associated with a particular room it makes sense to build a page off this room to house these programs (and then set the link to this page to not showing in master settings).

Note for budding programmers

This strategy allows you to custom-build a gadget to perform a series of tasks (ideally not tied to any particular room), and then use a Run Program Contraption to deploy those tasks elsewhere. This is extremely helpful, as this two-step process allows you to maximize your use of the Escape Hatch. Read on as the original writer describes why.

The way that this writer likes to think about this trick is to say that what we have just done here is to custom build two gadgets. The Pull Watcher gadget and Activate Trapdoor gadget. Then the Run Program Contraption is used to actually use these gadgets. The basic Contraptions and Contrivances are simple gadgets, programs like the above are compound gadgets.

This has the advantage of making things fairly easy to keep track of in your head. If you consider the extra programs as just part of the main program which have been cut out of the middle and put in separate grids, then when you make a mistake you're going to be switching back and forth between programs trying to keep up with where the program is, and which branches that you've checked. You're going to have to start remembering three or four things at once, and it's going to get pretty confusing. This leads to headaches and errors, which are both to be avoided. If on the other hand you consider these sub programs to be gadgets in their own right, then you check that the gadget does what it's meant to do first, then check the main program, regarding the Run Program Contraption to be just the one gadget. You know what this gadget does, you just have to check that it's in the right place in your program.

Thinking of programs and the Run program Contraption in this way will allow you to start building some quite complicated programs. Programs which run other programs which run other programs to several layers deep. You will never manage to do this without making mistakes if you think of the whole thing as one big program which has been cut up and stored in various places.

We will bang on about this some more in the next tutorial.


Proceed to next tutorial.
Return to previous tutorial.
Advanced Tutorial Contents Page.
Return to Places Overview

gameplay/guides/places/advtutiii.txt · Last modified: 2023/11/21 23:55 by kuhsodas