22. Time delays ~~~~~~~~~~~ Apart from using a dummy FOR-NEXT loop, there are two main ways to put a time delay in programs. The first is to use the TIME facility, and the other is to use INKEY. The first TIME routine resets the TIME to zero on each occasion. If you wish to avoid this, then the second routine will overcome the problem. The INKEY routine will give a similar delay, except that the delay terminates on pressing any key. The example provides a 2 second delay, (200 centiseconds). Call them with PROCdelay. 1000 DEFPROCdelay:TIME=0:REPEAT UNTIL TIME>=200:ENDPROC 1000 DEFPROCdelay:LOCAL now%:REPEAT UNTIL TIME>=now%+200:ENDPROC 1000 DEFPROCdelay:LOCAL pause%:pause%=INKEY(200):ENDPROC Another way is to call up whatever length delay you want, but still only using one Procedure. You can call up delays with PROCdelay(100), or PROCdelay(200) etc. as follows:- 1000 DEF PROCdelay(wait%):TIME=0:REPEAT UNTIL TIME>=wait%:ENDPROC 1000 DEF PROCdelay(wait%):LOCAL now%:now%=TIME:REPEAT UNTIL TIME>=now%+wait%:ENDPROC 1000 DEF PROCdelay(wait%):LOCAL pause%:pause%=INKEY(wait%):ENDPROC Note the use of Integer variables for accuracy. The variable pause% is a dummy, to satisfy the INKEY syntax. The variable wait% is an implied LOCAL variable, so can be used elsewhere in the program quite independently, without any clash.