Enquirer Home Page | Twitter | Back to Improbable Island

Memories V - What's been happening?

In a room in your place you've got a lever. Or a dial. Or something else similar. Depending on whether the lever is up or down, different things happen in other parts of your Place. The lights are on or off. Different coloured fireworks are showing. A bridge is up or down.

You have a central NPC in your Place, using this trick here. She gives jobs to your guest. (Go and acquire this item, go and take this message to that other NPC. Whatever.) Once one mission has been completed you get a memento or at least a page saying "Well done." and she gives you your next job.

In all these cases you need to remember something non-numerical. Whether the lever's up or down, where the dial's pointing, whether a job has been completed or not. How do you remember these things using memories which are inherently numerical?

The solution is to code the different states that you want to remember as numbers. Take the lever for example, you could have the code 0 = down : 1 = up. So if we were to use a memory called "Lever Position" then in the room with the lever in, have a program which looks out for a command to pull the lever, similar to this program here, except that this time once the appropriate command has been used the program uses a Memory Equal Contrivance to check if the number held in Lever Position is one. If it is one, then the program uses a Set Memory Contraption to set Lever Position to zero, otherwise it sets Lever Position to one. The whole program should look something like this.

 Toggle a lever: If up, set it to be down. If down, set it to be up.

Alternatively, instead of using a command to change the state of the lever, there could be various pages, one for each state of the lever or dial. These pages would each have a little program consisting of just a Set Memory Contraption to set your memory.

Now, in the Rooms where the effects take place, use a Memory Equal Contrivance to check what number is being stored in the memory and have the program act accordingly.

For the case where there is an NPC giving out jobs, set up the code something like: 0 = NPC unmet. 1 = First job given. 2 = first job completed. And so on. Then each time that the NPC is met check the memory and use an Increment Memory Contraption to add 1 to the memory.

Notes for budding programmers.

The main point of this is of course the idea of encoding information as numbers. If you want to remember which of five states something is in, then number them one to five and use a memory to remember that number.

In the above lever example we used the numbers 0 and 1 to code the two possible states. This wasn't strictly necessary, we could have used 32 and 197 instead, or anything else. The programs will work just the same. You will however increase your chances of confusing yourself and making mistakes no end. Stick with small sequential numbers. Where you are trying to remember whether something is On or Off, it is conventional to use 0 for off, and 1 for on. You may have even seen something like this on a kettle or washing machine or other such electrical compliance. Bear in mind that until you change it, a memory is considered to be set at zero.

It's worth noticing the two different ways of changing that number, using the Set memory Contraption, or using the Increment Memory Contraption. In the case of the dial, the Set Memory Contraption is easier if you want to be able to turn the dial to any setting immediately, but the Increment Memory Contraption would be better if you want to cycle through the various states. Just have one page with an Increment Memory and check that if the dial is already in the 'highest' position; if so then set it back down to zero. There is a general advantage to using Increment Memory over Set Memory that we will see in the next tutorial as well.

But memories are big things, capable of storing numbers up to one million, and here we are using it to store numbers up to two. Can't we fit more information than that in a memory? And what are those 'Memory Part' Contrivances about? Well as you may have guessed by the way I asked the questions together, they actually answer each other. Memory Parts can be used to fit extra information into one memory. Cue the next tutorial.

Procede to the next memories tutorial.
Return to the previous memories tutorial.
Return to Places overview.

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