Tomb Building: The Processor
This page explains how the Processor object found in the special buy mode catalog for tomb building works, with some examples and exercises to try out.
About the processor
Before attempting to use it you should be very familiar with triggers and activated behaviours.
Imagine that the processor is a box with 8 sockets going into it, and 8 coming out. We can plug any triggers on any objects in our tomb into the input sockets, and we can plug any activated behaviour in our tomb into the output sockets.
The input and output sockets themselves are in the form of activated behaviours and triggers respectively.
The inputs are numbered in0 to in7 and are all either - (no input), 0 (off) or 1 (on) at any given time. If you click the processor itself and chose "enable HUD", then by mousing over the processors on the lot you can see what the input and output values currently are. The default input "string" is --------, that is, all the inputs have nothing connected to them. The rightmost "-" represents in0, the one to the left of that is in1, and so on until the very left, which is in7.
The outputs are numbered out0 to out7, but are slightly more complicated than the inputs. In the default settings for the processor, only out0 is used, and its value is either off or on. On other logic modes, the processor has an output string like the inputs, and in those cases all the outputs can be used.
Using a floor switch to control an input.
To use a floor switch to control an input, simply place down a floor switch and a processor. Use "link triggers > step on" on the floor switch, and "link to activated behaviour > in 0" on the processor.
Ensure that Enable HUD is set. Mouse over the processor, and look at the bottom line on the little blue box. It should say "-------0 (in)". That's great. The rightmost character on the "in" string represents "in 0", and currently the value is set to 0 because the trigger to set it to 1 has not occurred.
Now, place a movable statue on the switch - this makes a good testing substitute for a Sim, and even in buy mode the switch and processor respond. A "ghost" of the processor will appear, which you can mouse over to see the current values of the processor. Note that if you disable HUD this ghost will stop appearing in live mode, it is not a permanent feature of the processor. Mouse over the processor, again, and you will see that the bottom line now says "-------1 (in)" - that means that by stepping on the switch the input value of in 0 changed from 0 to 1.
That's great but how do we change the value back to 0? Once the Sim steps on the floor switch, it's set to 1 for ever!
For this example, we'll use the same floor switch, but when the Sim sets off the switch it will set the value in the processor back to 0. On the floor switch, use "link triggers > step off" and on the processor use "link to activated behaviour > in 0 (Reset)". Move the statue on and off the switch a few times, and notice how the value of the input bit 0 on the processor changes.
So, in summary, connecting a trigger to an input, for example in 0, sets that input to 1 when the trigger occurs. Connecting a trigger to an input reset, for example in 0 (Reset), sets that input to 0 when the trigger occurs.
Using a light as output
For this example, we use the "Ankle-Height Light by GamGleam Industries".
Place a light near the processor. On the buy mode interaction menu, choose "turn off". On the processor, choose "Link triggers > out 0". On the processor, choose "add the ability to add links and activated behaviours", then choose "link to activated behaviour > light: turn on".
Move the statue off the switch and back on a few times, and observe what happens. You can also see the value of "Out" at any given time by mousing over the processor and looking at the top line of the HUD. It will either be "ON" or "off". On this mode the processor only uses out 0 for output, so it's turning our light on when it's set to ON, and not turning the light on (so letting it turn off again) when it's set to off.
You may well be thinking at this point "this is all well and good but I could've done that without the processor". Good point. So let's move on.
The processor has 8 inputs and you can use as many or as few of those as you like.
The processor will ignore any inputs set to "-". That is, any inputs which have nothing connected, it will ignore. For all the other inputs it will perform whatever logical operation it is set to perform, and output the result. The default setting is for the processor to be an "AND Gate".
So let's see what happens when we set up two switches into this AND gate. Set up the switch as input and the light as output as described above. Then place another switch. Link the trigger "step on" to "in 1" on the processor, and "step off" to "in 1 (Reset".
Now move the statue between the two switches. Nothing is happening. When the statue is on one switch, it sets the values of the inputs to "------01" and on the other it's "------10". Well you can probably guess what the AND gate will do when you get another statue already. So, get a second pushable statue, and place it on the second switch. Now the inputs are set to "------11" and the resulting output is "ON". Now try doing that without the processor!
You can set up as many switches as you like this way, and in each case the processor will require all of the switches to be on in order for the output (and the light) to be "ON".
Now let's change the logic mode to "OR". Take the statues off the switches, then on the processor choose "set logic mode > OR gate". OR means that in order for the output to be "true" any one or more of the inputs must be 1. So you can have one statue, or the other, or both on the switches, and the light will be on, but if you remove both statues from the switches, it turns off.
Logic gate modes
Here's a table explaining the 6 basic logic modes. Remember we can have up to 8 inputs to the processor, and remember that the processor ignores any "-" inputs when calculating the output.
|AND||This will be "ON" only if all the inputs are 1, otherwise it will be "off".|
|OR||This will be "ON" if any one or more of the inputs is on. It will only be "off" when all the inputs are 0.|
|NAND||NAND means "not and". This always produces the opposite result to an AND gate - in other words, it takes the output of AND and reverses it. It will be "off" only if all the inputs are 1, otherwise it will be "ON".|
|NOR||NOR means "not or". This always produces the opposite result to an OR gate - in other words, it takes the output of OR and reverses it. It will be "ON" only if all the inputs are 0, otherwise it will be "off".|
|XOR||XOR is the exclusive or. This is usually what we mean when we say "or" in English. This outputs "ON" when one and only one of the inputs is 1, otherwise it outputs "off".|
|NXOR||NXOR means "not exclusive or". This takes the output of XOR and reverses it. It will be "off" when one and only one of the inputs is 1, and "ON" the rest of the time.|
Other logic modes
The other logic modes all use all 8 outputs, so to help you understand this, consider setting up a room with a processor, 8 switches and 8 lights, with each switch linked to an input and each light to an output.
This takes one input at a time and sets the output to be the opposite. For example, if you set "in2" to "on", it sets "out2" to "off" and all the other outputs to "on". It won't invert more than one input at once. The output stays the same until the processor receives another input to invert.
Every time an input is triggered as "on", the output string increases by 1. The output string is a binary number. The screenshot shows the lights representing the binary number 9, because switches have been pressed 9 times.
Cycle (crawling ants)
This mode switches the output each time an input triggers "on". So it starts by having only out0 on, then when an input triggers, it only has out1 on, then only out2, all the way to out7, and back to out0 again.
Random (all bits random)
This mode choose a random selection of the outputs to set to 1 and a random selection to set to 0 every time an input is triggered.
Random (one triggered bit)
This mode randomly selects just one bit to set to 1 and sets the rest to 0 each time an input is triggered.
This mode starts with all outputs as 0. When an input is triggered, it toggles the corresponding output. For example, if I trigger in3, out3 changes to 1. Out3 now stay on until in3 is triggered again, then it will turn off.