The problem with that is that it will only work for things where you know you have a range of objects to choose from, rather than needing any object.
Most people do something like this:
function FreeObj()
repeat
inc o
until object exist(o) = 0
endfunction o
which is all fair enough, but the problem with that is you can't do stuff like this:
cube = FreeObj()
sphere = FreeObj()
make object cube cube, 100
make object sphere sphere, 100
because 'cube' and 'sphere' will be the same, as an object wasnt created after 'cube' was got.
This is my method:
Dim __ObjTaken(0) as boolean ` Global array
function FreeObj()
array insert at bottom __ObjTaken()
count = array count( __ObjTaken() )
if object exist(count) = 0 and __ObjTaken(count) = 0
__ObjTaken(count) = 1
exitfunction count
endif
endfunction 0
Which makes my last example possible
"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers