I'd do it like this:
sync on
sync rate 60
rem objects
randomize 20
for n=1 to 10
make object cube n,30
position object n,rnd(600),0,rnd(600)
next n
make object sphere 11,10
color object 11,rgb(200,50,50)
hide object 11
make matrix 1,1000,1000,10,10
position camera 0,300,400,-100
point camera 0,300,0,300
do
rem mouse
my=mousey()
mx=mousex()
mz=mousez()
rem selection things
pointed = pick object(mx,my,1,10)
if pointed>0
yrotate object pointed, object angle y (pointed)-0.9
endif
if mouseclick()=1 and pick object(mx,my,1,10)>0
picked=pick object(mx,my,1,10)
position object 11,object position x(picked), object position y(picked)+40, object position z(picked)
show object 11
position camera 0,object position x(picked), object position y(picked)+400, object position z(picked)-200
point camera 0,object position x(picked), object position y(picked), object position z(picked)
endif
if picked>0
yrotate object picked, object angle y (picked)-0.9
endif
set cursor 0,0
print "pointed= ",pointed
print "picked= ",picked
sync
loop