Aborting a procedure
 
If your procedure involves a loop, you check the mouse each
time through it. For example, the following is a startup procedure
which enters what would be an infinite loop, if it were not for the
MOUSE check, whch exits when a button is pressed.
 
DefProcStartup
Local I_win_the_lottery%,x%,y%,z%
I_win_the_lottery%=False
Repeat
Mouse x%,y%,z%
If z%<>0 Then
. .EndProc
Until I_win_the_lottery%
Endproc
 
There are other ways of doing this sort of thing. In a repeat loop,
I could set a flag to exit the loop.
 
DefProcStartup
Local I_win_the_lottery%,x%,y%,z%
I_win_the_lottery%=False
Repeat
Mouse x%,y%,z%
If z%<>0 Then
. . I_win_the_lottery%=True
Until I_win_the_lottery%
Endproc