User blog:Jereth Khan/OR, AND, XOR Examples (For the People Asking)

I've seen a few comments on the Wiki asking for examples using OR, AND, & XOR logic switches. So after getting annoyed trying to get floors to snap together in a straight line, I decided I'd do up some very basic examples and give a brief, non-technical description of what they do. I know I can post them to the wiki pages for each, but that may look sloppy and messy; I do invite the staff on the page to take whatever they feel would be nice to use there and go for it.

Remember, these are pretty basic examples and only one way to use them. I created each example to be a very simplified way to use these for people who have no idea how they are supposed to work. So here we go.

OR GATE
I'm going to say this right off the bat, this is the most useless gate in LT2. I say this because, almost anything you could do with this practically, you can do by simply stacking wires (unless overly complex like you're building a calculator or something).

An OR Gate takes takes 2 lines. As long as one line is powered, it will power what ever it is hooked up to. Think of a laptop; it can be powered by a battery or a plug and both can be connected. As long as one has juice, the laptop works.



In this example, the Chop Saw can be used in two ways.

1. The Lever will keep it on all the time so you can chop lots of wood.

2. The Pressure Plate can be stepped on to commit suicide.


 * Note: You could also move the pressure plate back and use it as a toggle.

AND GATE
The AND Gate is pretty simple to understand. You feed it 2 lines and if both lines are on, it will send power to what ever you hook it up to. Think of it like a 2 player game where both players have to hit start for the match to start. If they both don't hit start, nothing happens.

If you have no clue how logic gates work, follow along closely.



So here we have a simple mill. In it there is a Switch Conveyor, one side loads a truck, the other goes to storage. Going into the AND Gate is a Lever by our Sawmax02 AND a Laser Detector (on a Signal Inverter).

The wood from the Sawmax02 will only go to the truck if


 * A: The lever is on.


 * B: You remembered to park your truck there.

This will keep your wood from piling up in your loading dock. Feel free to ask question about this one and look at the wiki for the Laser, Laser Detector, and the Signal Inverter for more information.

XOR GATE
No, the X does not stand for "Excellent", it stands for "Exclusive". As an exclusive OR it means that only one or the other line in can be on. If both are on or both are off, it will not power. It's almost like a 3-way switch in your house, but in reverse. If a light is on two switches, you can turn it off and on from both switches. Flick it on from one, turn it off from another. (Yes, I know 3-ways work exactly opposite of XOR, but it's the same concept).

There are a couple of neat things you can do with XOR so I have a few examples for this one.

3-way Switch For Wood Storage/Loading



So, here's another switch that either loads a truck or dumps it into storage. Let's pretend it's 25 conveyors long and not 3.

So, from either lever you can send wood to storage or load it into a truck. Doesn't matter what the other lever is doing, flicking either at anytime will change the direction.



Here, we've put wires to all the conveyor belts. From either side we can change the direction everything travels. Kind of handy to move things from, say, storage back to a truck for loading.



Here's that improper use of a chop saw again. Let's say you have it set to turn on when you step on a pressure plate, but some asshole comes along and puts a log on the plate. Well, if you have an XOR used like this, the saw will stay off until they remove the wood, or you manually turn it on with the lever.

It's not a great solution, but it's a way to show noobs, "I already thought of that, you ass".

Do you use all these or did you just think this up and make examples?
I'm glad you asked. I do use all these switches in my mill and I suppose I can post a couple pictures of it. Keep in mind, this is not just for personal use. This is for 3-5 people on my VIP server to toss full, uncut trees of Lava or Gold off the cliffs and push back to process in bulk. (Either with Chop Saws or TNT, depends on the mood).

So, what does all of this do? Each mill feeds it's own line and those lines can merge and overlap. The left lever on the left side of image #1 toggles loading 2 trucks or 4 trucks. The right lever toggles between truck loading and storage. If both are on, the middle mills go to storage and the outside ones go two the gray and beige trucks.

In picture 3, you can see a mess of lasers and wires. The bottom lasers detect if the truck is there, the top detect if the truck is full. In 2 truck mode, If the gray or beige truck are full or not there, the conveyor will reverse and not drop wood. All new wood processed then goes to the Black and Brown trucks instead. If those are full or are missing, then their own conveyors will reverse and keep the wood from falling on the ground. In 4 tuck mode, it just stops the top conveyor to each truck.

On the right of image #1, the lever controls the 3 front chop saws. We just hold the trees there and let them drop onto the belt system. There is also a button to activate the 6 chop saws in the back (yes, 4 are clipped into the Sawmaxs. Lay it flat, the press T, then place). When the button is hit, it will dislodge trapped wood, sending it flying against the walls and cut wood that may need to be smaller (such as large Blue and Lava trunks).

So, that's most of all the electrical components in a single build (storage will use the rest). The electrical upgrade cost close to 500K and took me 6 hours or so.

I hope some, all, most, or none of this was helpful to someone. At least it got me away from doing floors... now I must go back to swearing at Defaulito's snapping scripts.