Yes its for the version 5 with pick command.
Here's the older version for DBP:
REM --- Function to tell which object is nearest to mouse ---
REM ------------- author Mikko Ketonen 2000 ----------------
dim d(100,2): Rem Make always this dim dim d(n,2), where n=number of tested objects
oldob=1
INK RGB(255,255,0),RGB(0,0,0):circle 125,125,120:circle 125,125,121
get image 100,0,0,256,256:make object plain 100,256,256
texture object 100,100:SET OBJECT TRANSPARENCY 100, 1
for f=1 to 50:make object cube f,50:position object f,rnd(1000)-500,rnd(400)-200,rnd(1000)
color object f,RGB(255,255,0):next f
sync on
do
if leftkey() then turn camera left 1
if rightkey() then turn camera right 1
if upkey() then move camera 2
if downkey() then move camera -2
color object oldob,RGB(255,255,0)
ob=obj2mous(1,50):color object ob,RGB(255,0,0)
oldob=ob
if mouseclick() then set object wireframe ob,1
position object 100,object position x(ob),object position y(ob),object position z(ob)
text object screen x (ob),object screen y (ob),str$(ob)
turn object right 100,.2
sync
loop
function obj2mous(first,last)
REM --- Function to tell which object is nearest to mouse ---
rem ---first and last define block of object (like 100 to 200)
rem --------------- REMEMBER TO PUT ------------------------
rem ------------------ dim d(n,2) ---------------------------
rem ---------AT THE BEGINNING OF PROGRAM---------------------
rem ---------Where n=number of tested objects --------------
REM ----------- author Mikko Ketonen 2000 ------------------
mx=mousex():my=mousey()
for f=first to last
ox=OBJECT SCREEN X(f): oy=OBJECT SCREEN y(f)
d(f,1)=sqrt((mx-ox)^2+(my-oy)^2)
d(f,2)=f
next f
for i=first to last
for f=first to last-1
if d(f,1)>d(f+1,1)
d1=d(f,1):d2=d(f,2):d3=d(f+1,1):d4=d(f+1,2)
d(f,1)=d3:d(f,2)=d4:d(f+1,1)=d1:d(f+1,2)=d2
endif
next f
next i
nearest=d(1,2)
endfunction nearest
And here is one for the DBC (Indi's modification):
REM --- Function to tell which object is nearest to mouse ---
REM ------------- author Mikko Ketonen 2000 ----------------
sync on : sync rate 60
autocam off
dim d(100,2): Rem Make always this dim dim d(n,2), where n=number of tested objects
oldob=1
cls
INK RGB(255,255,0),RGB(0,0,0):circle 125,125,120:circle 125,125,121
get image 100,0,0,256,256:make object plain 100,256,256
texture object 100,100
SET OBJECT 100,1,0,1,1
cls
for f=1 to 50:make object cube f,50:position object f,rnd(1000)-500,rnd(400)-200,rnd(1000)
color object f,RGB(255,255,0):next f
do
if leftkey() then turn camera left 1
if rightkey() then turn camera right 1
if upkey() then move camera 2
if downkey() then move camera -2
color object oldob,RGB(255,255,0)
ob=obj2mous(1,50):color object ob,RGB(255,0,0)
oldob=ob
if mouseclick() = 0 then set object ob,0,1,1,1,1,1
position object 100,object position x(ob),object position y(ob),object position z(ob)
text object screen x(ob),object screen y(ob),str$(ob)
turn object right 100,.2
sync
loop
function obj2mous(first,last)
REM --- Function to tell which object is nearest to mouse ---
rem ---first and last define block of object (like 100 to 200)
rem --------------- REMEMBER TO PUT ------------------------
rem ------------------ dim d(n,2) ---------------------------
rem ---------AT THE BEGINNING OF PROGRAM---------------------
rem ---------Where n=number of tested objects --------------
REM ----------- author Mikko Ketonen 2000 ------------------
mx=mousex():my=mousey()
for f=first to last
ox=OBJECT SCREEN X(f): oy=OBJECT SCREEN y(f)
d(f,1)=sqrt((mx-ox)^2+(my-oy)^2)
d(f,2)=f
next f
for i=first to last
for f=first to last-1
if d(f,1)>d(f+1,1)
d1=d(f,1):d2=d(f,2):d3=d(f+1,1):d4=d(f+1,2)
d(f,1)=d3:d(f,2)=d4:d(f+1,1)=d1:d(f+1,2)=d2
endif
next f
next i
nearest=d(1,2)
endfunction nearest
Mikko
mikko_darkbasic@hotmail.com