When the distance goes under 20, the script will run.
The distance sensor detects the surrounding brightness to report distance, so you can actually use it to detect light and motion in addition to distance.
To use when distance, you need a distance sensor connected to your computer via a LEGO WeDo hub.