This code shows an example how to use the same function (Move_Object()) for different objects (the red ball and the yellow block). You can switch the moving object with a mouseclick. Your function to move a object will probably be more complicated.
backdrop on
autocam off
hide mouse
set text size 14
set text font "Verdana"
set text to bold
cls
sync on
make object sphere 1,2
color object 1, rgb(255,0,0)
position object 1,0,0,0
make object cube 2,2
color object 2, rgb(255,255,0)
position object 2,5,0,0
position camera 0,5,-8
point camera 0,2,10
ObjNumber=1
EndIt=0
disable escapekey
while EndIt=0
if inkey$()=chr$(27) then EndIt=1
Move_Object(ObjNumber)
if mouseclick()
if ObjNumber=1
ObjNumber=2
else
ObjNumber=1
endif
while mouseclick():sync:endwhile
endif
text 1,10, "Use mouseclick to switch objects, <esc> to exit"
sync
endwhile
end
function Move_Object(n)
x#=object position x(n)
y#=object position y(n)
z#=object position z(n)
z#=z#+.2
position object n, x#,y#,z#
endfunction