Why program end after draw the box a round the knight ? Why program stop

! principle : zooming
dim reflect(4,4)
mat read reflect
data 0,1,0,0
data 1,0,0,0
data 0,0,1,0
data 0,0,0,1
open #1:screen 0,.5,0,1
set window -2,5,-2,5
print "orginal picture"
set color "blue"
draw knight with scale(2)
do
get mouse x1,y1,s1
if s1=2 then
plot x1,y1
exit do
end if
loop
do
get mouse x2,y2,s2
if s2=2 then
plot x2,y2
exit do
end if
loop
box lines x1,x2,y1,y2
open #2:screen 0.5,1,0,1
!set window x2,x1,y2,y1
set window x1,x2,y1,y2
print " resized picture"
set color "blue"
draw knight with scale(2)
set color "green"
print " reflected picture rescaled"
draw knight with scale(2)*reflect
end

PICTURE Knight ! Picture of knight

PLOT .2,.1;.8,.1;.8,.2;
PLOT .7,.25;.7,.3;.8,.4;.65,.7;.6,.9;.55,.9;
PLOT .5,.82;.2,.75;.2,.6;.3,.6;.4,.55;
PLOT .25,.45;.2,.37;.3,.3;.3,.25;.2,.2;.2,.1

END PICTURE

best regards

from Peter

for support

Comments

re: why program stops

If you process your program with DO FORMAT from the RUN menu, you will see the problem. Once you have set the second set of coordinates, the program runs to the end. You either need a PAUSE statement to at least show your results, or you need another DO LOOP (with appropriate exit) to reset.

Below is the program with the formatting and with a pause added at the end. [NOTE: The TrueBasic forum handler automatically takes out leading spaces, so I have added underlines to show the formatted indentations. Will add a request to TrueBasic to change their software if possible to display formatted programs.]

rwt

! principle : zooming
dim reflect(4,4)
mat read reflect
data 0,1,0,0
data 1,0,0,0
data 0,0,1,0
data 0,0,0,1
open #1:screen 0,.5,0,1
set window -2,5,-2,5
print "orginal picture"
set color "blue"
draw knight with scale(2)
do
___get mouse x1,y1,s1
___if s1=2 then
______plot x1,y1
______exit do
____end if
loop
do
___get mouse x2,y2,s2
___if s2=2 then
______plot x2,y2
______exit do
___end if
loop
box lines x1,x2,y1,y2
open #2:screen 0.5,1,0,1
!set window x2,x1,y2,y1
set window x1,x2,y1,y2
print " resized picture"
set color "blue"
draw knight with scale(2)
set color "green"
print " reflected picture rescaled"
draw knight with scale(2)*reflect

PAUSE 5 !waits 5 seconds before ending

end

PICTURE Knight ! Picture of knight

PLOT .2,.1;.8,.1;.8,.2;
PLOT .7,.25;.7,.3;.8,.4;.65,.7;.6,.9;.55,.9;
PLOT .5,.82;.2,.75;.2,.6;.3,.6;.4,.55;
PLOT .25,.45;.2,.37;.3,.3;.3,.25;.2,.2;.2,.1

END PICTURE