Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Loading and saving(For DBClassic)

Author
Message
cusoi
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 14th Feb 2003 20:59
If you want, for example, save from all objects the x,y and z coordinates you can use this. I haven't tested the code, but I think it works.

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.
Current project: Earth Chaos, a FPRTS
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 14th Feb 2003 22:13
he rtspider

ik zag dat je uit nederland komt mag ik mischien je e-mail dan kan ik nog wat dingetjes over games en programmeren enz uitwisselen ???

greetz

Berry

(sorry its dutch

cusoi
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 14th Feb 2003 23:36
Here is it, jdejong41@hotmail.com

Current project: Earth Chaos, a FPRTS

Login to post a reply

Server time is: 2024-11-24 05:04:48
Your offset time is: 2024-11-24 05:04:48