Here's my code:
First program
Sync On:Sync Rate 0:Autocam off
//Objects
Make object Cube 1,100
Make object Cube 2,100
//Object save storage
Type ObjectSaverFunctions
Total as Integer
SON//Save as this object number
Shape as String//Save the Shape Of The Object
SX as Integer //Size x
SY as Integer //Size y
SZ as Integer //Size Z
RX as Integer //Rotation x
RY as Integer //Rotation y
RZ as Integer //Rotation Z
GRN as Integer //Ground object number
PNT as Integer //Pointer Object Number
Texture as String //Texture Applied
Object as Integer //Object Textured
PoX as Float
PoY as Float
PoZ as Float
Endtype
//Array, This mirrors the total of the object library
Dim OSS(5000) as ObjectSaverFunctions
//Reset count
OSS(0).Total = 0
//Find as much objects as Possible, 5000 is the max that can fit in my objects library
For n=1 to 5000
//Check if object exists
If Object Exist(n)=1
//Store the amount
If Object Exist(n)=1 then Inc OSS(0).Total,1
//Save Object Number
OSS(n).SON = n
//Shape and size
OSS(n).Shape = libO(n).Shape
OSS(n).SX = libO(n).SizeX
OSS(n).SY = libO(n).SizeY
OSS(n).SZ = libO(n).SizeZ
//Rotation
OSS(n).RX = Object Angle X(n)
OSS(n).RY = Object Angle Y(n)
OSS(n).RZ = Object Angle Z(n)
//Position
OSS(n).PoX = Object Position X(n)
OSS(n).PoY = Object Position Y(n)
OSS(n).PoZ = Object Position Z(n)
Endif
Next
//Store to text file
If File Exist ("Setting.txt")=1 then Delete File "Setting.txt"
Open To Write 1,"Setting.txt"
Write String 1,"[Total Objects]"
Write String 1,Str$(OSS(0).Total)
Write String 1,"[Textures]"
For f=1 to 5000
If Object Exist(f)=1
If OSS(f).Texture = ""
Write String 1,"!None!"
Else
Write String 1,OSS(f).Texture
Endif
Endif
Next f
Write String 1,"[Object Textured]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,str$(OSS(f).Object)
Next f
Write String 1,"[Object Number]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).SON)
Next f
Write String 1,"[Shape]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,OSS(f).Shape
Next f
Write String 1,"[Size X]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).SX)
Next f
Write String 1,"[Size Y]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).SY)
Next f
Write String 1,"[Size Z]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).SZ)
Next f
Write String 1,"[Angle X]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).RX)
Next f
Write String 1,"[Angle Y]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).RY)
Next f
Write String 1,"[Angle Z]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).RZ)
Next f
Write String 1,"[Position X]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).PoX)
Next f
Write String 1,"[Position Y]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).PoY)
Next f
Write String 1,"[Position Z]"
For f=1 to 5000
If Object Exist(f)=1 then Write String 1,Str$(OSS(f).PoZ)
Next f
Write String 1,"#End#"
Close File 1
//see result
Execute File "Setting.txt","",""
//The second program
Sync On:Sync Rate 0:Autocam off
Gosub Declare///Not included! this is used only to declare some pre made functions for the camera.
Type ReloadAll
tt as String
texture as String
obtex as Integer
Object as Integer
TextNum as Integer
ScaleX as Integer
ScaleY as Integer
ScaleZ as Integer
AngleX as Integer
AngleY as Integer
AngleZ as Integer
PositionX as Float //Changed this from integer; But i get the same visual result.
PositionY as Float
PositionZ as Float
Endtype
Dim Rel(5000) as ReloadAll
Open To Read 1,"Setting.txt"
// Reload
Repeat
//Load Varable into a string
` Read String 1,EndString$
//Get the amount of objects
If Lower$(Left$(EndString$,3))="[to"
//Read line under then catch the string
Read String 1,EndString$
Rel(0).tt = EndString$
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Textures]"
Close File 1
Open To Read 1,"Setting.txt"
// Reload
EndString$ = ""
Repeat
Read String 1,EndString$
Until EndString$ = "[Textures]"
//Get the Textures to Load then load
If EndString$="[Textures]"
//Read line under then catch the string
Read String 1,EndString$
For f=1 to Val(Rel(0).tt)
Rel(f).texture = EndString$
ldt$="Textures\Var 4\"+Rel(f).texture
Load Image ldt$,f
//Store Texture Number
Rel(f).TextNum = f
Read String 1,EndString$
Next f
Endif
Close File 1
Open To Read 1,"Setting.txt"
// Reload
Repeat
//Get object textured numbers
If Lower$(Left$(EndString$,3))="[ob"
//Read line under then catch the string
`Read String 1,EndString$
For n=1 to Val(Rel(0).tt)
Rel(n).obtex = Val(EndString$)
Read String 1,EndString$
Next n
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Object Number]"
Close File 1
Open To Read 1,"Setting.txt"
// Reload
Repeat
//Get the Object numbers
If EndString$="[Object Number]"
//Read line under then catch the string
Read String 1,EndString$
For n=1 to Val(Rel(0).tt)
Rel(n).Object = Val(EndString$)
Read String 1,EndString$
Next n
Else
Read String 1,EndString$
Endif
Until EndString$ = "#End#"
Close File 1
Open To Read 1,"Setting.txt"
// Reload
Repeat
//Get Make thenshape
If Lower$(Left$(EndString$,3))="[sh"
//Read line under then catch the string
Read String 1,EndString$
For n=1 to Val(Rel(0).tt)
//Make the object
Select EndString$
Case "Cube"
jj=Rel(n).Object
Make Object Cube jj,10
Endcase
Case "Cylinder"
jj=Rel(n).Object
Make Object Cylinder jj,10
Endcase
Case "Sphere"
jj=Rel(n).Object
Make Object Sphere jj,10
Endcase
Case "Cone"
jj=Rel(n).Object
Make Object Cone jj,10
Endcase
Endselect
Read String 1,EndString$
Next n
//Texture Objects
For f=1 to Val(Rel(0).tt)
If Rel(f).texture = "!None!" //Do nothing If texture does not exist
Else
Texture Object Rel(f).Object,Rel(f).TextNum
Endif
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "#End#"
Close File 1
//Gather Scalling data
Open To Read 1,"Setting.txt"
// Reload
Repeat
If EndString$ = "[Size X]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).ScaleX = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Size Y]"
Repeat
If EndString$ = "[Size Y]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).ScaleY = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Size Z]"
Repeat
If EndString$ = "[Size Z]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).ScaleZ = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "#End#"
Close File 1
//Now to actually scale
For f=1 to Val(Rel(0).tt)
Scale Object Rel(f).Object,Rel(f).ScaleX,Rel(f).ScaleY,Rel(f).ScaleZ
Next f
//Gather Angle data
Open To Read 1,"Setting.txt"
// Reload
Repeat
If EndString$ = "[Angle X]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).AngleX = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Angle Y]"
Repeat
If EndString$ = "[Angle Y]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).AngleY = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Angle Z]"
Repeat
If EndString$ = "[Angle Z]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).AngleZ = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "#End#"
Close File 1
//Now to actually ANGLE the objects
For f=1 to Val(Rel(0).tt)
Rotate Object Rel(f).Object,Rel(f).AngleX,Rel(f).AngleY,Rel(f).AngleZ
Next f
//Gather Position data
Open To Read 1,"Setting.txt"
// Reload
Repeat
If EndString$ = "[Position X]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).PositionX = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Position Y]"
Repeat
If EndString$ = "[Position Y]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).PositionY = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "[Position Z]"
Repeat
If EndString$ = "[Position Z]"
For f=1 to Val(Rel(0).tt)
Read String 1,EndString$
Rel(f).PositionZ = VAL(EndString$)
Next f
Else
Read String 1,EndString$
Endif
Until EndString$ = "#End#"
Close File 1
//Now to actually POSITION the objects
For f=1 to Val(Rel(0).tt)
Position Object Rel(f).Object,Rel(f).PositionX,Rel(f).PositionY,Rel(f).PositionZ
Next f
Do
//These three function arnt included in this example
drag_object()//Pick object
MSFB() //Move camera
CamMousMove(0) //Rotate Camera
///////////////
//See if the values loaded are the same(They always are)
Text 0,500,Str$(Object PosiTION x(1))
Text 0,520,Str$(Object PosiTION y(1))
Text 0,540,Str$(Object PosiTION Z(1))+ " oNE"
Text 0,570,Str$(Object PosiTION x(2))
Text 0,580,Str$(Object PosiTION y(2))
Text 0,600,Str$(Object PosiTION Z(2))+ " TWO"
Sync
Loop
My point is that, regardless of the fact that the objects are made and positioned with the same values, they still endup in diffeent places (Visually!).
Please test for yourself in DBPro and Compare the positions of the objects in both programs.
bconline