The main problem is how you setup complex object #1. You didn't set it up as group #1. Also, the computer will not recognize oldx#, oldy# and oldz# in your function. You will need to pass these values to the function or make them global.
This code works for me:
sync on : sync rate 30
load dll "SC_Collision.dll",1
global cam_speed# = 2.0 `camera speed
global cam_height# = 10.0 `camera's height above the terrain
global gravity# as float : gravity# = 0.0028
make object plain 1,1000,1000,1
`load image "media\terraintex.tga",1
`texture object 1,1
rotate object 1,90,0,0
sc_setupComplexObject 1,1,2
sc_setObjectCollisionOn 1
set object light 1,1
make object sphere 2,10
position object 2,0,50,0
sc_setupObject 2,0,0
sc_setObjectCollisionOn 2
set object light 2,1
make object sphere 3,.5
set light range 0,1000
color light 0,rgb(255,255,185)
position camera 0,0,10,-200
`rotate camera 0,90,0,0
set camera range 0,1,750
position light 0,camera position x(0),camera position y(0)-50,camera position z(0)-100
do
oldx#=object position x(2)
oldy#=object position y(2)
oldz#=object position z(2)
if inkey$()="d" then position object 2,object position x(2),object position y(2)-2,object position z(2)
collision(2,oldx#,oldy#,oldz#)
if object in screen(1) = 1
set cursor 10,10
print "Terrain in view."
endif
print object position y(2)
if inkey$()="z"
cam_height#=250.0
endif
` camera_control()
sync
loop
end
function Collision(ObjID,oldx#,oldy#,oldz#)
x# = object position x(ObjID)
y# = object position y(ObjID)
z# = object position z(ObjID)
SC_updateobject ObjID
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,y#,z#,10,0)
if collide > 0
text 10,50,"Collision!"
x# = sc_getCollisionSlideX()
y# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
position object ObjID,x#,y#,z#
endif
endfunction
if memblock exist(1) = 1 then delete memblock 1
LB