I got this from another thread but here it is! This is for Darkbasic 1 not Pro.
First
First you need to have a variable that holds the number of objects. You can use this for example:
a=0
obj=0
do
a=a+1
if object exist(a)=1 then obj=obj+1
if object exist(a)=0 then goto know
loop
know:
rem Know the variable obj holds the number of objects
Saving
Now you know how many objects there are, you can save all the coordinates of the objects. Use this for example:
if file exist("1.obj") then delete file("1.obj")
open file to write("1,obj",1)
for a=1 to obj
write string 1,str$(object position x(a))
write string 1,str$(object position y(a))
write string 1,str$(object position z(a))
next a
Loading
Now, everything is saved, you can load it and create the objects again. Use this:
open file to read("1,obj",1)
for a=1 to obj
read string 1,x$
read string 1,y$
read string 1,z$
make object box a,1,1,1
position object a,val(x$),val(y$),val(z$)
next a
Finally
This are only the basics, if you want to do it right, write to the first line the number of objects. You can also write the color and angles and size. You can save whatever you like. But remember, always write the data in the same order as you read it. I hope this is usefull for you.
Andrew Tamalunas