Combinators,Wires and other magic, I need help :)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
dtoxic
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Fri Apr 01, 2016 8:40 pm
Contact:

Combinators,Wires and other magic, I need help :)

Post by dtoxic »

So here is a newbie question... How do i unload a Specific amount of Items. Say i want to take from the train (not the cargo wagon) 100 coal and then make the inserter stop. so basically i want to unload 100 coal from train to chest and then that chest to belt, but while the belt is being loaded i dont want more coal to be taken out of the train and in to the chest untill next time the train comes around.

xyzyxx
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Sep 06, 2016 1:39 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by xyzyxx »

My first thought is you could have the inserter load into the chest and stop when the chest reaches 100 coal. Then have the second inserter start pulling them out of the chest after the train leaves.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by Deadly-Bagel »

Well if restricting the contents and sizes of your trains' cargo is out of the question you have quite a few options.

Firstly does it need to be exactly 100 items? Because inserters move a stack of items now, 1-4 I think. If your research allows your inserters to move 3 items at once you can't get exactly 100 in the chest. If you want 100, you're better off having a "counting belt", once the requisite number of items pass over it the belt disables so any extra items are held there until the next train comes.

If a rough thing is all you want then a memory setup linked to your train signals to reset when a new train enters the loading area might be the way to go.
Money might be the root of all evil, but ignorance is the heart.

Lupoviridae
Fast Inserter
Fast Inserter
Posts: 155
Joined: Mon Apr 20, 2015 6:26 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by Lupoviridae »

This should be doable with two combinators.

1) The best method currently for detecting when a train is at station involves 3 filter inserters pulling fuel out of the locomotive and putting it back in. Inserter 1 pulls fuel into a chest, inserter 2 moves it from chest 1 into chest 2, and inserter 3 puts it back in the train. Set all three inserters to filter fuel. If the inserters are running a train is present, and when they stop a train has left. Add a single dummy item to chest 1. (I will use iron ore in this example) Connect chest 1 to a decider combinator by red wire and set it to [If fuel = 0 | Output iron ore(input count)]. Connect the output to the input with red wire. You have now created a unidirectional timer that essentially measures how long it has been since a train was at the station. With no train at station, no fuel will be in chest 1, and the iron ore count in the combinator will increase indefinitely. While a train is in the station, fuel constantly passing through chest 2 will cause the iron ore count to constantly reset to 0 every .5 seconds (the rotation time of a fast inserter).

2) Create a second Decider and set it to [If Iron ore < 60 | Output coal(input count]. Connect the output to the input with red wire. Also connect the red wire to the inserter(s) pulling coal from the train. Set the inserter to operate only if coal < 100, and to read hand contents as a pulse signal. You have now created a counter that will count all coal unloaded and stop unloading at 100. It will reset if the iron ore count reaches above 60. Since the game updates at 60 ticks/second, this means it will reset approximately 1 second after the train leaves the station. Finally, connect the output from the first decider by green wire to the input of the second.

3) Profit.

EDIT: This method is not exact. With factors like inserter stack bonus and without extra steps taken to avoid overflow, you may get up to 105 items unloaded. This can be rectified most easily by changing the operating conditions of the inserter removing cargo down from 100 to 95-99. (Exact number will vary based on various conditions)

User avatar
dtoxic
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Fri Apr 01, 2016 8:40 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by dtoxic »

Lupoviridae wrote:This should be doable with two combinators.

1) The best method currently for detecting when a train is at station involves 3 filter inserters pulling fuel out of the locomotive and putting it back in. Inserter 1 pulls fuel into a chest, inserter 2 moves it from chest 1 into chest 2, and inserter 3 puts it back in the train. Set all three inserters to filter fuel. If the inserters are running a train is present, and when they stop a train has left. Add a single dummy item to chest 1. (I will use iron ore in this example) Connect chest 1 to a decider combinator by red wire and set it to [If fuel = 0 | Output iron ore(input count)]. Connect the output to the input with red wire. You have now created a unidirectional timer that essentially measures how long it has been since a train was at the station. With no train at station, no fuel will be in chest 1, and the iron ore count in the combinator will increase indefinitely. While a train is in the station, fuel constantly passing through chest 2 will cause the iron ore count to constantly reset to 0 every .5 seconds (the rotation time of a fast inserter).

2) Create a second Decider and set it to [If Iron ore < 60 | Output coal(input count]. Connect the output to the input with red wire. Also connect the red wire to the inserter(s) pulling coal from the train. Set the inserter to operate only if coal < 100, and to read hand contents as a pulse signal. You have now created a counter that will count all coal unloaded and stop unloading at 100. It will reset if the iron ore count reaches above 60. Since the game updates at 60 ticks/second, this means it will reset approximately 1 second after the train leaves the station. Finally, connect the output from the first decider by green wire to the input of the second.

3) Profit.

EDIT: This method is not exact. With factors like inserter stack bonus and without extra steps taken to avoid overflow, you may get up to 105 items unloaded. This can be rectified most easily by changing the operating conditions of the inserter removing cargo down from 100 to 95-99. (Exact number will vary based on various conditions)
Well actually solved this by using 2 train signal + Decider combinator, set it up so that when the train leaves and when the red light turns on it should send the signal to belt loader to start working, for now it works very good, don't know how it will work once i start adding more signal lights, thou this is a single train line so i think it's working good enough for now

Lupoviridae
Fast Inserter
Fast Inserter
Posts: 155
Joined: Mon Apr 20, 2015 6:26 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by Lupoviridae »

I wasn't aware they added the ability for train lights to generate circuit network signals. That is indeed a more elegant solution :)

User avatar
dtoxic
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Fri Apr 01, 2016 8:40 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by dtoxic »

Lupoviridae wrote:I wasn't aware they added the ability for train lights to generate circuit network signals. That is indeed a more elegant solution :)
Yeap you have Red,Yellow,Green then you set up the Decider for any of those 3 signal colors and bam :) all works,but like i said dont know how it;s gona play out once i start adding more lights and stuff :)

Lupoviridae
Fast Inserter
Fast Inserter
Posts: 155
Joined: Mon Apr 20, 2015 6:26 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by Lupoviridae »

If you put a signal immediately before the train stop and one right after it makes the stop a block of its own. The signal right before the stop could be used instead of the one after.

grouchysmurf
Inserter
Inserter
Posts: 29
Joined: Mon Sep 05, 2016 8:55 am
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by grouchysmurf »

Bear with me, I am lacking a tool to annotate the images and can only hope words are enough in this case.

Setup:

Image

A. Top left blue is a hack / for presentation purposes only. It loads coal to a chest which in your case is a cargo wagon;
B. Green stack inserter unloads from the chest / wagon. It is wired to a chest with a condition "BRICK = 0";
C. Top blue inserter is also wired to the chest / wagon. Its condition is "COAL > 100";
D. Purple inserter is a filter inserter. Its filter is set to brick. It's also wired to the very same chest and its condition is "COAL = 0";
E. White one is a stack filter inserter. Its filter is set to coal. It' also wired and its condition is "BRICK = 1".

Now, the trick is that the brick is a reset token. It tells inserter B to stop once the required amount is reached. It also tells the inserter E to start. Purple inserted D sends the token back so it can be reused.

Animation:

Image

User avatar
dtoxic
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Fri Apr 01, 2016 8:40 pm
Contact:

Re: Combinators,Wires and other magic, I need help :)

Post by dtoxic »

grouchysmurf wrote:Bear with me, I am lacking a tool to annotate the images and can only hope words are enough in this case.

Setup:

Image

A. Top left blue is a hack / for presentation purposes only. It loads coal to a chest which in your case is a cargo wagon;
B. Green stack inserter unloads from the chest / wagon. It is wired to a chest with a condition "BRICK = 0";
C. Top blue inserter is also wired to the chest / wagon. Its condition is "COAL > 100";
D. Purple inserter is a filter inserter. Its filter is set to brick. It's also wired to the very same chest and its condition is "COAL = 0";
E. White one is a stack filter inserter. Its filter is set to coal. It' also wired and its condition is "BRICK = 1".

Now, the trick is that the brick is a reset token. It tells inserter B to stop once the required amount is reached. It also tells the inserter E to start. Purple inserted D sends the token back so it can be reused.

Animation:

Image
Nice stup, but like i said in the post above, a bit easier with Train lights, anyway thank you for the suggestion

Post Reply

Return to “Gameplay Help”