@3ds Master: I wrote a pretty cool example for you, on saving vector values etc. to a .prk file, simply via dbp commands.
It may not be the dll you requested, but have a read through the code and you'll find that using simple DBP commands for this is actually very easy (once you get to grips with it) and a DLL is simply
remstart
******************************************
Saving and loading a .prk file.
******************************************
!! --- These are simply functions. Call them when you need them --- !!
remend
` this is the vector type
type vector
x as float
y as float
z as float
endtype
dim Ride(600) as vector `we assign all the vector vars to the array of rides
global TotalRides `this keeps a hold of all the rides
global FileVersion
FileVersion=1 `this is the file version of .prk files that we're prepared to
`load. Its written directly into each and every PRK file as a byte,
`write at the top of the file. This is very handy in case we change the
`the way in which the files are saved, since we can then change this number
`to reflect this change. If we then accidentally try and load an older file
`(e.g. If were saving files as version 2, and try to load a version 1)
`we can actually check file versions and present an error of some kind,
`instead of getting screwed up parks when we load them (and hence saving on
`debugging time). This is explained again in the Load_PRK function too.
function make_ride(x#,y#,z#)
`increment the total quantity of rides, and assign the array details
`to the number.
inc TotalRides,1
Ride(TotalRides).x=x#
Ride(TotalRides).y=y#
Ride(TotalRides).z=z#
`###################################
`this is simply a template. Add all the other stuff to make a ride below...
`blah blah blah
endfunction
function Save_PRK(file$)
`file$ = where to save the file
alt$=file$+".prk" `add the .prk extension. We call this var 'alt$' because
`it is the altered filename
open to write 1,alt$
write byte 1,FileVersion `I wrote e file version here (to the top of
` the file. See Load_PRK for more info.
`(useful if you update the file saving routine)
write long 1,TotalRides `write the total quantity of rides
for a=1 to TotalRides
write word 1,a `write the number of the ride. May be useful...
write float 1,Ride(a).x
write float 1,Ride(a).y
write float 1,Ride(a).z
`you can add more data to save here, but remember:
`BYTES CAN ONLY SAVE INTEGER VALUES BETWEEN 0-255
`WORDS CAN SAVE INTEGER VALUES BETWEEN 0-65535
`FLOATS CAN SAVE NON-INTEGER (DECIMAL) VALUES
next a
`end of file.
close file 1
endfunction
function Load_PRK(file$)
`file$ = where to load the file form.
`THIS FUNCTION ASSUMES THAT THE .PRK IS ALREADY ON THE FILENAME
`(UNLIKE SAVE_PRK)
open to read 1,file$
read byte 1,version
remstart
This is where that version byte comes in handy.
If its different from the version which this code loads/saves
in, (see Global FileVersion) we can report an error of some kind.
This is extremely useful if you come to update the way the file
is saved later on (and saves alot of debugging)
remend
if Version=FileVersion
else
`show some kind of 'wrong version' error here :)
endif
read long 1,ToRides `get the total amount of rides.
`we now knoew how many pieces of data to read
for a=1 to ToRides
read word 1,a
`this is the ride number. We don't do anything with it
`(we simply skip it) but it may be useful somehow.
read float 1,Ride(a).x
read float 1,Ride(a).y
read float 1,Ride(a).z
`read any additional data you may of added in the save func.
next a
`and were done! Easy!
`end of file.
close file 1
endfunction
EDIT: I changed the code, because after compiling to check it, I found I had named both functions as 'save_prk'
EDIT2: I've added a global File version flag, which simplifies+explains things alot better.
Please note that I have not actually tested this code. So don't be surprised if you find mistakes. Should work though
Quote: "Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all."