How do I play an alarm for x amount of seconds?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
Deliberate Grief
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Nov 16, 2020 7:09 pm
Contact:

How do I play an alarm for x amount of seconds?

Post by Deliberate Grief »

Instead of 1 beep alarm from my programmable speaker, I want to play it for 10 seconds. How can I do that?

Image

I connected this with a green wire to my passive provider chest. So, whenever a Atomic Bomb is made, the alarm goes off, but it only happens once. I want it to beep for a few seconds and then stop.

MassiveDynamic
Filter Inserter
Filter Inserter
Posts: 260
Joined: Sun Sep 16, 2018 10:44 pm
Contact:

Re: How do I play an alarm for x amount of seconds?

Post by MassiveDynamic »

I tried to explain the build process, but I couldn't build it in my head, so I built you a blueprint.

300 is 5 seconds, 60 ticks/second. You can set X<300 to however long you want the alarm to play.




Here is one for multiple assemblers feeding the belt




Here it is with provider chest and 10 second timer...

Zanthra
Fast Inserter
Fast Inserter
Posts: 207
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: How do I play an alarm for x amount of seconds?

Post by Zanthra »

You can use two decider combinators. Both set to activate if "each" (under the signals category) is less than the minimum number of ticks you want the alarm to go off for (300 for 5 seconds). One of the combinators is set to ouptut "each" with a value of the input count, and the other set to output "each" with a value of 1. Now if you wire all the inputs and outputs of those combinators together you will have a counter that if primed, will count up by 1 each tick until it reaches the limit (together they output "value + 1"). When that happens, both combinators will not output anything. Because of how the "each" signal works, a non-existant value won't be compared with the limit and so nothing will be compared or output even though the value is arguably less than the limit. Now to start the counter, use the other color of wire, and connect your input signal chest to the input of the decider set to output a value of 1. If it sees an Atomic Bomb on the input, it will inject the atomic bomb signal into the counter, and will start counting to the upper limit.

You can use the signal network that wires the combinator inputs and outputs together to drive your alarm with a condition of Atomic Bomb > 0 as the counter will count from 1 to the limit.

Here is a blueprint demonstrating it.


User avatar
Deliberate Grief
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Nov 16, 2020 7:09 pm
Contact:

Re: How do I play an alarm for x amount of seconds?

Post by Deliberate Grief »

MassiveDynamic wrote:
Tue Nov 17, 2020 1:11 am
Zanthra wrote:
Tue Nov 17, 2020 6:26 am
Thanks to both of you, it's working perfectly.

Post Reply

Return to “Gameplay Help”