Some VBScript pointers required.

Many thanks.
I’ve been doing some investigation and I (think) I can probably do it with building strings up with chrb(x), then writing them out..
I’m just going to create a set of functions WriteInt, WriteFloat etc to create these strings…

I’ll let you know how I get on.

I’m part way through creating a .b3d format exporter (the native format for blitz 3d models).
So far I have successfully created an ascii intermediate form to make sure I am extracting all the correct bits of data.
The next stage is to create the actual .b3d files, which is andnbsp;where my (limited) vbscript knowledge fizzles out.
I need to be able to write binary data into the file in the following formats : bytes, 4 byte integers, ieee floating point (4 bytes) ie. binary representations.

looking at the example sources etc, I can see how the fileobject can write ascii, and (possibly) by using a few homebrew functions and constructing values using chr$( ) andamp; chr$( )… andnbsp;to write out the representations..

But I guess I’m asking if there is a simple way to write out these values. blitz has commands like writeInt, WriteFloat etc to manage it… anything similar in VBS ?

I guess that is possible, but it isn’t super easy. Here is post/sample code that I found:

The ADODB.Stream object supports binary file i/o. andnbsp;

sFilename = andquot;c: tempdata.binandquot;

const adTypeBinary = 1
const adModeReadWrite = 3
const adSaveCreateOverwrite = 2

set stream = createobject(andquot;adodb.streamandquot;)
stream.type = adTypeBinary
stream.mode = adModeReadWrite

stream.open
stream.write binaryData
stream.savetofile sFilename, adSaveCreateOverwrite

stream.close

Done it andnbsp;;D andnbsp;;D
One of the gotcha’s is that you cant just to a fileobject.write binarystring

Instead you have to step throught the string using something along the lines of :

fileobject write chr(asc(mid(s,i,1)))

I ‘think’ I’m about 30 mins away from exporting my first .b3d model from 3DC… (no textures yet tho <!– s:( –><img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad" /><!– s:( –> need some work on the UV coords)

This is easy if you are using the Visual Basic, but unfortunately VBScript doesn’t support all of the functions of Visual Basic.

If you hunt around the visual basic sites you may find these functions have already been written.

Richard

You must be logged in to reply in this thread.

5 posts