To complete this puzzle, you must set each of four tumblers to the correct height. The most foolproof way to do this (although not necessarily the quickest) is to set all tumblers to the lowest height and try the lock.
If a tumbler shows a green circle, do not change that tumbler anymore.
Ignore blue and red circles. For all the other tumblers, increase the height by one and try again.
Continue until the lock unlocks. This method will take at most six attempts.
The Holy Grail
Once you have bypassed the gate, climb up two sets of staircases to reach the top floor.
Search the table and click the purple cylinder second from the right.