• PC NEWS: 1.4.2.3 update is out! More info here. Report bugs here
  • Journey's End on Xbox and PlayStation!: Get all the info by clicking here. As of Oct 19 a new patch has been released. Click here for Known Issues and FAQ. For any other bugs, report them (with as much detail as possible) here.
  • MOBILE NEWS: Stay up to date with the latest mobile news here. Report mobile bugs here

1.3.1 Single Switch Reset Mechanism

DicemanX

Brain of Cthulhu
Prior to 1.3.1 we used hoik-based resets, but they were were often slow since the signaling agent had to visit every node to determine if a reset was necessary at that node. In 1.3.1 we can use logic gates - any will do, but I used the AND gate in the demonstration below.

azWl7ew.png
aSK1Wbc.png


The inputs are represented by the torches and the states of the inputs are controlled by the switches.

Pulling the lever resets all the inputs. Inputs will only be reset if they are in the ON state (as indicated by the torches in the schematics). Since AND gates are used in the schematics, both logic gate lamps start in the OFF state. If an input is ON, it also turns on the lamp in the reset mechanism. The lever will turn on the other lamp, and cause the input to revert to the OFF state.

The logic gate at the rightmost end in the schematic will revert the top lamps back to the off state after the lever is pulled.
 

DicemanX

Brain of Cthulhu
This is a very clean termination protocol! I approve!

I initially started with a dart trap-based reset, until I realized that having the built-in delay is completely unnecessary :). I'm already really happy that the logic-gate-based auto-shut off actually works, although 1 logic gate lamp is enough unlike the two I used.
 

Tub

Terrarian
This looks very small and clean, but I found it difficult to understand.

Hitting the switch will toggle the AND gates from all active lights to TRUE, thus the gates trigger, which turns off the light and the lamp. But that should toggle the AND gate to FALSE, it triggers again, thus activating the lamp again... Shouldn't it go into an infinite loop, until the rightmost gate stops it at a random state?
I cannot figure out why it works without acquiring a deeper understanding of activation logic, infinite loop prevention and stack order for triggers. And I try to avoid wiring where I cannot tell if a working circuit is a bug or a feature ;)

I found it easier to understand using the Faulty Logic Lamps. Despite their unhelpful name, they have a very simple and useful behaviour. Using them on top of a single lamp, they turn any gate into a transistor. Activate the faulty lamp. If the lamp below is on, the gate triggers. Otherwise, nothing happens.

TL;DR: Replace the topmost row with faulty lamps. Remove the rightmost gate. The result is slightly smaller and (IMHO) easier to explain.
 

Ranadiel

Terrarian
Great job! Was looking for a way to reset my inputs in the teleporter hub design, but didn't know how to achieve it in a compact way.
 

DicemanX

Brain of Cthulhu
This looks very small and clean, but I found it difficult to understand.

Hitting the switch will toggle the AND gates from all active lights to TRUE, thus the gates trigger, which turns off the light and the lamp. But that should toggle the AND gate to FALSE, it triggers again, thus activating the lamp again... Shouldn't it go into an infinite loop, until the rightmost gate stops it at a random state?

It turns out that it doesn't enter an infinite loop - when the box turns on it always shuts the top lamp off which causes the box to shut off without sending any additional signals. In fact I use this type of auto-shut off in the passcode-protected door mechanism in a thread I posted recently - an AND gate with just a single lamp above it and wire passing through both the lamp and the box will result in the box sending two pulses when a signal is sent through the wire, thus immediately turning off anything that the wire turned on.

As far as why this happens: it must be written into the game code to prevent infinite loops from being generated. The infinite loop is replaced with an "all OFF" final state instead of selecting a random all ON or all OFF state.

I found it easier to understand using the Faulty Logic Lamps. Despite their unhelpful name, they have a very simple and useful behaviour. Using them on top of a single lamp, they turn any gate into a transistor. Activate the faulty lamp. If the lamp below is on, the gate triggers. Otherwise, nothing happens.

That's exactly how the present mechanism works :).
 

DicemanX

Brain of Cthulhu
Like so:
(They're sneakily useful little critters.)

Indeed, this is a slightly more compact approach because it negates the need for that rightmost AND gate to auto-reset. On the other hand, the reset mechanism I posted allows for some more complex reset mechanisms involving stacking of lamps (i.e. a reset is only triggered when all lamps below the reset lamps are lit).

What I'm curious about is your claim that the reset I posted was not working for you in one of your builds. Strange that it wouldn't work consistently, because it was working fine in the passcode-protected door. Nevertheless, the switch from regular lamps to the faulty lamps is easy enough to ensure a reset line will always work properly.
 

pbq

Terrarian
With the new information from http://forums.terraria.org/index.php?threads/order-of-operations-smoke-and-how-to-prevent-it.44020/
is it possibly to build a low latency contraption with smokeless reset?
The way I understand(not entirely sure if do) it now, I have to feed gate output into a divide by 2 thingy(pardon my language), and either delay reset into subsequent ticks, or delay initial trigger into next tick, so I can hoik two dummy ghosts onto two triggers(edit: wait, or does teleporting, hoik displacement and triggering pressure plate at new location happens on the same tick?), one for the contraption, and one for the reset.
I don't mind smoking gates, and I can move them out of sight if need be, but it does seem a bit inelegant.
 
Last edited:

pbq

Terrarian
Sorry, didn't notice that those didn't cause smoke there. I'll how to figure out how to apply that. Back to reading, sorry for my silly posts
 

DicemanX

Brain of Cthulhu
Sorry, didn't notice that those didn't cause smoke there. I'll how to figure out how to apply that. Back to reading, sorry for my silly posts

No worries, the gates are not always intuitive in how they function so we're all still learning how they work ;).
 
Top Bottom