Mailbox piston, Need another set of eyes to help me


Post the green snapshots only. For your piston, change the variable value to ‘nothing selected’. Right now each time the piston triggers it will be set to 0.


I originally had that… Doesn’t run at all when I select “nothing selected“ for mail variable… When I set the value to 0, it runs but overwrite/save the variable.


You might get more joy by defining your variable as a boolean and using true and false values. A variable that isn’t initialised will evaluate as false which should then get your piston going.

You can, of course, manually set the variable outside the piston but that’s not ideal as you’d have to do it every time you restarted it. I just mention that as an aside.


Re-did it. Do I still leave the variable as nothing selected for initial value? Or do I set it to value and false?


When you give a variable an initial value it is used every time the piston runs which isn’t what you want. You want the Mail variable to keep its value until you change it.

I should also point out that if you have kept the original structure the piston will detect motion, set the Mail variable in the first if block, and then promptly change it back again in the second one as changes to active is still true.

You really want to run either the first or second if block. So you might want to create a nested structure

If motion changes
  If Mail is false
  End If
End If

I do note you have the break commands which might seem like they’d avoid the above problem. However as far as I know those will just break out of the current if block so they effectively do nothing. Using exit might be more fruitful if you prefer that structure.