It is a bit psuedo. With properly declared variables and keywords it would compile and run. Unfortunately it has a bug and is therefore quite dangerous to anyone stepping on the trap door. I forgot two important parameters. A variable for a timer and a constant for maximum standing time allowed. The trap would trigger as soon as you got up to use the restroom. Now, if you really want to use the code, rather than applying it to a trap door, apply it to an arduino or raspi controlled supper soaker water gun sitting on the desk, pointed in the direction of the standing interloper. To be not so obvious and have some real fun, place a small hidden water device on the sealing above the spot and have it spew out just enough water to make it feel like a bird just pissed on the individual. For real effectiveness, make the device focus on any area behind the desk that's within the monitors viewing area. Hmmm; It appears that I have been reading way to many Instructables and Hackadays. And also watching to many YouTube videos utilizing arduino controlled devices. :laugh: