Some time ago I wrote some functions for DBP, making it "more objectorientated". You could create primitives, load objects etc. with such functions and apply a function for each object, which is checked with a select-case-block..
So basically you could do things like this:
Enemy = MakeCube(10,"enemy")
MyGun = MakeBox(1,0.8,4,"weapon")
Ball = MakeSphere(5,"dynamic")
...
do
UpdateObjects()
sync
loop
function UpdateObjects()
for o = 1 to ObjectCount
select Object(o).FunctionName
case "enemy"
`AI
endcase
case "weapon"
`Weapon-Management
endcase
`...
endselect
next o
endfunction
However... umm... Maybe we should get back to topic.
I read some months ago, that the function might be faster, when you do it like this:
function FreeObject()
ID = 0
repeat
inc ID, rnd(30)
until object exist(ID)=0
endfunction ID