Need opinion on a virtual switch


#1

If there are certain pistons I want to pause (or not execute), is it preferable to create a piston that says “if virtual switch is on, pause x y and z pistons”. “If virtual switch is off, resume said pistons.”

OR

is it preferable to just add that switch as a restriction to existing pistons?


#2

A restriction would be convenient, right up top imo.


#3

I agree with @eibyer.

For me, pausing a piston is an absolute last resort. it is much better to code for the SimSwitch condition instead.


#4

I’ve always wondered, what is the difference (from a speed and resource perspective) between a condition and a restriction? It seems that a restriction would be more resource intensive than a condition but I don’t have an justification for that. Just curious.


#5

I would love to know the ‘official’ answer to that question as well…
but I highly suspect that you are correct.

In other coding languages, I have learned to layer the code going from a precise trigger all the way down to the vague conditions. I rarely place a restriction top level. This keeps the code from even being looked at unless the trigger fires…

This works well for me, and is usually the logical path I take when planning out new pistons.


#6

Don’t get me wrong, I use restrictions a lot too. But i usually use them for either whole pistons or tied to action blocks and not IF blocks. I just find the use of conditions tied with triggers to be easier for me to follow so that’s probably why I focus on them. It’s probably the same as the difference between indenting code using TAB or spaces. Just stylistic differences. We’re all coding snowflakes. LOL