PDA

View Full Version : Max Script Questions...


bloodlocust
06-30-2002, 01:10 AM
Dear Community,

I'm an avid user of Blitz3D, it's an excellent high powered game engine with a basic interface (www.blitzbasic.com).

I've been trying to create an exporter in Max for the .B3D file format blitz uses, and am having a great deal of trouble. I suspect I could probably try and do it within maxscript, except the file required is a binary file!

Does MaxScript only export text (ascii) files?

I cannot code in C++ since I lack the neccesary experience to do so, hence I'm using a high powered basic language such as blitz :)

If anyone here would be kind enough to help our community with perhaps a c++ shell application I could modify and compile, or even some tips on getting binary files out of maxscript (is it even possible?) then I would be extremily thankful.

Thanks for reading!

-R

bloodlocust
06-30-2002, 01:15 AM
Hi again - here's the source files if anyone's interested in giving us a few tips!

http://www.blitzbasic.co.nz/sdk_specs/sdk_specs.html

There is also a milkshape exporter there! This language is used to quickly proof and prototype a few commercial games out there... I'm hoping to take my work to the next level :)

Reality3D
06-30-2002, 01:29 AM
In max 4:

Search in Maxscript manual:

BinStream for Binary Reading and Writing

Topic: version 4 MAXScript Language Improvements/Language Improvements

BinStream fopen <String fileName> <String mode>

Opens a file for reading or writing based on the mode parameter. This can either be "wb" for Writing Binary or "rb" for Reading Binary. The function will return a BinStream value.

Boolean FClose <BinStream>

Close a BinStream value. Returns True if it successfully closed the BinStream.

Boolean fseek <BinStream> <Integer> <#seek_set | #seek_cur | #seek_end>

Move the file pointer to the specified location based off the seek parameter.

#seek_set - base off start of file.

#seek_cur - base off current position.

#seek_end - base off end of file.

Integer ftell <BinStream>

Returns the current file pointer position.

Boolean WriteByte <BinStream> <Integer> [#signed | #unsigned]

Writes a Integer to the file as one byte. Returns True if write was successful.

Boolean WriteShort <BinStream> <Integer> [#signed | #unsigned]

Writes a Integer to the file as two bytes. Returns True if write was successful.

Boolean WriteLong <BinStream> <Integer> [#signed | #unsigned]

Writes a Integer to the file as four bytes. Returns True if write was successful.

Boolean WriteFloat <BinStream> <Float>

Writes a Float to the file as four bytes. Returns True if write was successful.

Boolean WriteString <BinStream> <String>

Writes a string to the file. Returns True if write was successful.

Integer ReadByte <BinStream> [#signed | #unsigned]

Read a one byte value and return as an Integer.

Integer ReadShort <BinStream> [#signed | #unsigned]

Read a two byte value and return as an Integer.

Integer ReadLong <BinStream> [#signed | #unsigned]

Read a four byte value and return as an Integer.

Float ReadFloat <BinStream>

Read a four byte value and return as an Float.

String ReadString <BinStream>

Read a string from the file.

Example:

f=fopen "c:\\test.bin" "wb"

WriteString f "String"

WriteByte f 64

WriteShort f 128

WriteLong f 256

WriteFloat f 512.0

WriteString f "gnirtS"

WriteLong f (ftell f)

fclose f

f=fopen "c:\\test.bin" "rb"

ReadString f

ReadByte f

ReadShort f

ReadLong f

ReadFloat f

ReadString f

ftell f

ReadLong f

fclose f

bloodlocust
06-30-2002, 01:31 AM
:bounce: I never spotted that! I suppose I'm living under a rock... rest assured I'll be bothering everyone about any more scriptworthyness I may encounter.

Thanks for your help r3D :)

CGTalk Moderation
01-13-2006, 09:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.