If you can't understand how to use this, I reccommend giving up on the RTS for now.
randomize timer()
box 10,0,20,30
box 0,10,30,20
get image 1,1,1,30,30
ink rgb(255,0,0),0
box 10,0,20,30
box 0,10,30,20
get image 2,1,1,30,30
ink rgb(255,255,255),0
dim sx(10)
dim sy(10)
for t = 1 to 10
sx(t) = rnd(800)
sy(t) = rnd(600)
sprite t,sx(t),sy(t),1
next t
DO
cls
gosub boxline
if clicked=1 then box_outline(x1,y1,mousex(),mousey())
if clicked=1
tx1=x1
tx2=x2
ty1=y1
ty2=y2
gosub sort_coordinates
for t=1 to 10
if sx(t) > tx1 and sx(t) < tx2 and sy(t) > ty1 and sy(t) < ty2
sprite t, sx(t),sy(t),2
else
sprite t, sx(t),sy(t),1
endif
next t
endif
LOOP
sort_coordinates:
if tx1 > tx2
t=tx1
tx1=tx2
tx2=t
endif
if ty1 > ty2
t=ty1
ty1=ty2
ty2=t
endif
RETURN
boxline:
if mouseclick()=1 and clicked=0
clicked=1
x1=mousex()
y1=mousey()
endif
if mouseclick()=1 and clicked=1
x2=mousex()
y2=mousey()
endif
if mouseclick()=0 and clicked=1
clicked=0
x2=mousex()
y2=mousey()
endif
return
function box_outline(a,b,c,d)
line a,b,c,b
line a,d,c,d
line a,b,a,d
line c,b,c,d
endfunction