Wait for key or mouse button press
r = waitforbuttonpress
ev = xclick(); r = (or(ev==(0:2)) | ev>31)*1;