Since you are using lasers to modify the scene via the onHitByLaser event, and then using the onCollide event, your scene has ventured into the realm of 'not possible'.
There are ways to create such a machine using magnets that do not change polarity and are not tied to any scripts with algodoo.. check out https://www.youtube.com/watch?v=c87_-1e74RI