John Chapman's Scrap Mechanic Guide

a 'How to�' page

Scrap Mechanic Home / Logic

Logic and control 

Scrap Mechanic offers 6 different logic gates, a timer  and controllers. In addition there are switches, buttons, sensors and other devices such as robot detectors which can be used to provide an 'on' signal to a logic circuit.

Logic gates

Each logic gate can have a number of inputs and outputs. The default logic gate is an 'AND' gate but you can change it to a different type by pressing 'E' while it is selected.

Logic gates available
Symbol Name Function
 AND  Active if all the inputs are 'ON'
 OR  Active if one or more of the inputs are 'ON'
 XOR (exclusive OR)  Active if only one of the inputs is 'ON'
 NAND  Active if any of the inputs are not 'ON'
 NOR  Active if all the inputs are NOT 'ON'
 NOR  Active if all the inputs are NOT 'ON'
 XNOR  Active if an even number of the inputs are 'ON'
Starting Scrap Mechanic
If you find this guide useful...

Can you help me out?

If you find these pages useful you can return the favour by downloading a FREE ebook from Amazon - even if you don't read it, it will help our rankings! I think you'll probably like it though.

It's the first book of a series of 9 books (so far) which tell the story of how life on Earth was saved from a cataclysmic extinction when a rogue planetoid collides with Earth in 7141. This first book deals with how humanity was made immortal, giving us the incentive to do something about an event so far in the future.

Take a touch of humour, add some genetic science and nanotechnology. Steep with conspiracy and stir in murder and despair. Season with romance between three people in a secret location. Garnish with morality.

The result is 'Immortality Gene', the first in a novel series by John and Shelia Chapman. The ebook of book 1 is FREE and available at multiple retailers

Setting up an auto crop-watering system

It quickly becomes tedious watering by hand a block of 33 crops but it is possible to set up an auto-watering system  which operates at the touch of a button. Here's how.

Having found the exact joining position of four tiles create a plot of 30 soil divided into 4 plots. Two will be 3 x 3 and two 3 x 2. Surround this area with a 4 high wall and on top of that place a 3 wide pathway which will act as a barrier to wandering bots. Leave a space of at least 7 blocks all the way round your plots. Then surround the plots with a border of metal.

On the corners of your border create a metal 3 frame as below. You should note the back right hand vertical is 2 blocks wide.

Now add this. It should be 20 blocks high, made from metal 3 and long enough to take it over deep water. You will notice that it doubles part of the frame at least 9 blocks high. The end over water does not quite touch the water,

At the end over water put a vacuum pump and connect it with vacuum tubes to a water container

At the corner near the water container add these parts a water cannon, 2 x level 5 pistons, 2 x metal 3 blocks  and a sensor pointing upwards:

Now, above the sensor add a metal bar from one side of the frame to the other side. On that bar add extra blocks which the sensor will detect. You need to space the extra blocks two apart and they should be exactly over the middle of each soil plot

You now need to repeat this bar with added blocks positioned 2 blocks apart. On the last bar at the opposit corner to the water cannon replace the last block with a sensor pointing downwards.

There is a limitation to the controls which will be used - they can only cover five rows. To fix that you will notice that the soil in the last row has been replaced with automatic farm boxes. These will plant, water and harvest themselves. We could have done this with the entire plot but these automatic farm boxes take a lot of resources to make. (A water cannon, a vacuum pump, a controller and a bag of soil)

The sensor you just added will need a slight change. Point at it and press 'E'. Then in the popup change the mode to 'switch.'

Now you need to start adding the controls. Create a 6 by 3  block to position them on. I used metal 3 because I had lots of it and it's less likely to be destroyed by bots if one gets inside. On this place two logic gates and a level 2 controller. Change the first logic gate to an XOR gate by pressing 'E' and selecting XOR. Make the connections shown using the connection tool.


You now need to set the controller. Set it like this:
Possible improvements.

If you want to make the process faster then upgrade the controller. Each upgrade allows you to make it work faster. (It also allows you to control extra pistons or bearings - which we don't need.)

Connect the water container to each of the automatic farm boxes and using 'E' on each, plant some seeds in them. Be careful not to exceed the 9 total value in each tile though.

How it works

(Skip this bit if logic gates leave you baffled)

The switch next to the logic gates and the far sensor are all connected to the XOR gate. When you first assemble this, the sensor at the far side from the logic gates will not have been triggered so it will act like a switch which is off.

XOR gates are only switched ON if only one of the things connected to it are ON. When you flip the switch it will power the XOR gate and also the Vacuum pump which will fill the water container. With only one signal the XOR gate will turn ON and send power to the AND gate and the controller. The controller starts moving the piston 1 which pushes the water cannon along a track. It starts at position 0,0 - both pistons fully closed. The 2nd controller instruction is to go to position 15,0 which is piston 1 at maximum extension and piston 2 fully closed.

The AND gate also has two inputs and only turns ON if both of them are powered. One of those inputs is a sensor which immediately detects there is a block next to it so it turns ON. Both imputs are now ON so the AND gate turns ON. It sends a signal to the water cannon which blasts out water. Meanwhile the piston is moving the water cannon and sensor along the track and the sensor moves away from the first block so turns OFF. That means there is only one signal to the AND gate so it turns OFF cutting off the water from the cannon. Eventually the sensor will get to the next block so it turns on, powering the and gate again and sending a pulse of water from the water cannon. This repeats until piston 1 is fully extended and the first row of crops have been watered. The controller now goes to the third instruction 15,3 - piston 1 still fully extended and piston 2 now at position 3. The next instruction is to go to 0,3 - piston 1 fully closed and piston 2 at position 3. This causes the cannon to work its way down the track firing a pulse of water on each plot.

So it continues, each instruction being carried out in order until position 15,12 is reached. At that point the sensor there is triggered and the XOR gate has both inputs as 'ON' which means it now turns 'OFF'. The AND gate no longer has both inputs so will no longer send pulses to the water cannon. The controller no longer has an 'ON' signal so it reverts to its start position 0,0, following the instructions in reverse order. Now there is the exact reverse of the start conditions and if the switch is turned off then the whole process repeats.

Or maybe a free online interactive adventure story?

Back in 1982 early text only adventure games were being written for home computers. One such game was 'Castle of Riddles' written by Peter Killworth and published by Acornsoft. Now it's been re-written and greatly expanded with added images and sound. Play it on your computer, tablet or even a phone.
Check it out at https://jaydax.co.uk/corr

Fully-automatic crop and resource farming

You can deliberately trigger raids to not only farm crops but also gather the rewards from bot destruction. You must keep the total crop value below 80 though or tapebots will appear in raids which will remotely destroy your autofarming.

Such a system needs to be fully automatic apart from occasional intervention to gather scattered bot resources. Such a system uses a relatively simple logic circuit to detect bots and crush them. The main problem with this system are that too many resources will be collected and that straw dogs are resistant to crushing.

How to construct this

Start by laying out an area like this:

I'm using a 'Game grid block' which is indestructable to build this. To get it, you'll need to install 'The Modpack' by Durf get it at https://scrapmechanicmods.com/m=42 If you feel an indestructable block is cheating then I suggest you use metal 3 instead. You need a fairly level area but it needn't be perfect since we will create a level base.

Once you've laid out the outline which is 73 blocks square (that's 18 of the game grid plus 1)put a switch at two corners and a lamp at the other two corners. Using your connect tool connect opposite corners. Where the two connection lines cross is the exact centre. Mark it with a 2 high block.

Now fill the inside with wood 1 blocks

Build this frame. It's 16 blocks tall (4 game grid blocks) and has a barrier at the fifth block up. Around the outside lay a paved area of game grid blocks which will act as your 'anvil'.

Around your centre block build a 6 by 6 area of automatic farm boxes. You no longer need that central block.

Now add collectors positioned on their sides and refinebots. They should fit exactly. If they don't go back and move them as close as possible. It doesn't matter which collector you use since both the standard and Fant collectors are the same height.

On the end of each refinebot place a thin chest. On the outside of that place a vacuum tube at its minimum length (Q to adjust it), then a 6-way junction and vacuum tubes to join it all together. You'll need a corner vacuum tube at the corners.

At one of the corners place a vacuum pump on top of the 6-way junction. Make sure the arrow on it points upwards. On top of that add a vacuum tube at maximum length.

Now surround the automatic farm boxes with a ring of smart chests. On each smart chest place a switch. Connect each smart chest to a 6-way junction. In mine you'll notice that I painted these chests and 6-way junctions. I used red for the left and back; these will collect crops. I used green for thefront and right; these will collect seeds. I didn't paint the two chests in the back right or add 6-way junctions At the moment there are only 11 crops to grow so the 12th chests will be left for future expansion of the game. 

Connect the corners at back left and front right with vacuum tubes.

At the front left add vacuum pumps and vacuum tubes. Each needs a switch positioned beside it so that the pumps only work when the switch is on. This is particularly important with the seed area because if all the seeds are removed the crops will stop growing. You'll probably notice I didn't add a switch to the outer ring. That's because that pump needs to be left on all the time.

All the way round the crops connect the switches to the smart chests they are sitting on. Leave them off.

At this stage you can plant some crops but I suggest you plant no more than nine low level crops since you don't yet have the crusher working.

You now need to cover half of the structure with a wooden platform. You'll need to leave some holes though. The picture below shows what it will look like when it's completed. The black area is exactly above the middle of the structure. Most of the holes are for the three vacuum pipes to extend through the platform. Below is a curiously positioned toilet in one of the holes.

Here's what to add at the top. Again I coloured the items green for seeds and red for crops

You'll need some vacuum pipes, a smart chest, an autocrafter, a large chest, a vacuum pump and a fertilizer container. The green pipe collects the excess seeds from below  and stores them temporarily in a smart chest. From there they go to an autocrafter set to make fertilizer from the seeds. The fertilizer is stored first in a chest set into the platform. From there it is sent via a vacuum pump to a fertilizer container also set into the platform.

In the middle the tube from the crops goes to another smart chest and then to a teleport device. Once the switch connected to the teleport device is 'on' the crops will be teleported to a matching coloured teleport receiver in your base. 

Here's the arrangement for the water supply to the crops. Again it's set into the platform so that it can be seen from below. A teleport reciever gets water, stores it in a chest and from there it's pumped into a water container.

Something has to send the water to the teleport receiver. Here's the arrangement. It uses some simple logic rather than a switch because it must be on all the time. Switches tend to switch off when you leave the game and don't come back on when you re-enter.  You don't want to have to swim out to the rock every time you run out of water.The NOR gate gets an 'OFF' signal from the button. It reverses this and powers the vacuum pump and the  teleport sender. Note the sender and receiver must be painted the same colour.

Use the same method to send resources from the outer ring to your home base. Continue the pipe through the platform and temporarily store the collected resources in a smart chest. On top of that place a teleport sender unit. Connect a switch to this so that it only sends items when you instruct it to do so. Often you'll find you are collecting too much.

Rememer that oddly positioned toilet sticking through the platform? Its function is to allow you to quickly gain access to the platform even if the crushing part is being activated. You'll probably have to add a few extra blocks of wood to position it properly with the back of the toilet cystern 'flush' with the platform.

Pointing at it and pressing 'E' will teleport you to it where you'll apparently sit defying gravity. Press 'E' again and you'll find yourself standing on the back of the cystern ready to walk onto the platform.

Now you need to start work on the bot crushing units. First work on the corner units. Rather than having to repeat their construction four times it makes sense to make a single unit and make a blueprint from it. Construct it as above on a lift placed near one of the corners. 

Once you've made one, right click the lift and save it as a template. Then remove the lift and break the block joining the two sections. You'll need to use the template to place the crushing units at all four corners.

To mount the crusher block place a 4 block long 'bracket' placed on the 6th block from the frame corner. Repeat this all the way round the frame

Now go back to ground level and place a level 5 piston on each bracket. 

Make sure you've removed the connecting block '1' and then using a weld tool click on the block '2'. Then make a second click on the bottom of a piston. If needed, use 'Q' to turn the crushing unit round the right way before you click.

You should get something like this: 

Now make a second template block. It has the same profile as the corner blocks but has square corners and is 14 blocks long with thepiston mounting hole on the 7th block along. You are going to need 12 of these so construct them spaced out three to a side.

A

The mounting brackets for these blocks will need to be on the 16th block - a gap of 15 blocks between it and the corner block. Add pistons and connect them the way you did for the corner blocks. 

Now you need to add some controls. First place a robot detector on four blocks exactly over the middle of the syste. Set into the platform a timer and three logic blocks. All three need to be changed to two NOR gates and an OR gate as above. Make the connections  shown. Set the timer to 2 seconds- you can change this later if you wish. Connect the output NOR gate to all 20 pistons. Each piston  should be set to an extention of 9 and maximum speed, that should make them crush bots but not hit the ground and make a nasty clang. Try it out by switching the test switch 'ON'.

Now it's time to add some crops. Make sure that you don't exceed a crop value of 79.5 or you will trigger a level 7 raid  and tapebots will destroy your crops and creation.

A

Your crops won't grow well until you have watered them. You can make them grow faster by using fertilizer also. You'll need to connect the water container and fertilizer container to every automatic farm box. You'll now start triggering level 6 raids. 

Set each of the smart chests surrounding the crops to collect either a single crop (red chests) or a single seed (green chests). They won't collect anything until you turn the switch on it on. Note: although smart chests will collect the item you set as a filter they will still allow other items to pass through them while the switch is 'on'. It's important you don't leave these switches on all the time or all the crop seeds will pass through them and there will be none left to grow crops.

At the red vacuum pump set up a filter to only pump through these crops. You can add a single crop by right button dragging it to the filter.

At the green vacuum pump set up a filter to only pump through these seeds. You can add a single seed by right button dragging it to the filter.

It's a good idea to add another smart chest to the 6-way junction at the end of the outer ring of vacuum pipes. When bots are crushed most of the haybot arms will be automatically collected - a few will be scattered far and wide. Totebots will leave behind screws, circuit boards, component kits and bot head. You need to collect these manually and  the grey chest highlighted is a convenient place to put them.

Last things to do 

Set up filters on each of the smart chests surrounding the automatic farm boxes so that each chest picks up a single crop or type of seed 

 In Use

Periodically, when all the crops are growing steadily, turn on the switches to send crops and seeds up the vacuum pipes. The seeds will be converted to fertilizer and the crops will be sent to your base. You'll also need to manually collect stray bot arms that have been scattered. You can do this manually or using a mining/logging machine. If you do this manually you can use a hammer to knock the arms near enough to the collectors to pick them up. It helps if you surround the device with a wedge shape so that they don't meet a step. 

...and here's what happens if you are away too long. Each of these haybot arms represents 10 scrap metal - who needs to go mining? 

How the crusher logic works 

(You can skip this bit if you don't want to know)

The input NOR gate  turns ON if the triggers connected to it are off.
That triggers the OR gate to turn ON.
That triggers the timer to start timing. At the end of two seconds it changes state to ON.
The output NOR gate reverses this and turns off.

When the input is changed by the switch turning on or the robot detector detecting a robot then:
The input NOR gate turns OFF
The OR gate now has no signal so turns off.
The timer now has no input so changes state to off

The output NOR gate flips this OFF signal to ON powering the pistons and sending an ON signal to the OR gate.
The OR gate powers the timer which runs for two seconds and then switches to OFF which turns the output NOR gate to ON which is then passed by the OR gate to the timer which works for two seconds and then switches OFF. The timer keeps working switching the output gate from OFF to ON every two seconds.

 Possible improvements

Surround the 'anvil' with a 1x1x2 wedge and paint it black. You can then use a hammer to knock arms into the collecters or if you have a Woc Brush 900 you can use it to sweep the scattered arms up. Beware of using a vacuum gun near your 'anvil' since it's far too easy to dismantle your creation with it.

Scatter a few Tesla coils around the perimiter. They will destroy straw dogs but not very quickly. They'll also destroy other bots. Persuade a friend to come and stand next to a coil to entise the straw dogs. Tesla coils use batteries so grow oranges since you can make a battery from 3 oranges 2 paint ammo, 5 chemicals and 10 scrap metal. To avoid having to collect the paint ammo flowers there's a 'Pigment flower growbox' available which you can create in an autocrafter. Hook it up with a chest and switch and feed it from a water and fertilizer container. Better still put two in the space between a pair of collectors.

Want a short story instead?
I've written a number of short time travel stories. Each is 99p/99¢ and great for taking a break from Scrap Mechanic.
Check them out at http://iwadasn.info