Startup

Hi there, my first day here.
I know scripting since much time but not MAX SCRIPTING and I need to make a script for this program.

It is a pretty simple (I think) script, here I explain what it should do:
- scan for all the objects in a scene (for/next cycle or whatever)
- write, for each object, in a ascii text file, object filename, position, rotation, size (world related)
- write, for each object, some stuff like referral number and such
- write the file with this list of objects and their datas on disk

I need to make it working with instances (I.E. must find which objects are instanced and refer them all to a single filename).

It would be nice to have the ability to save options (configuration) of this script on PER FILE base: in example it would be nice to be able to have as an option that in each file I can save the output text file into a specified directory, so I don't have to set it up every time.
So, a popup window is probably needed.

Well, anyone can help me sto start this up?
I don't want the script made, just tell me if there is a BASIC tutorial so I can find how to set up a popup window, how to write a line to a text file, how to find the full list of objects in the current scene, and how to write the text file to filename.map.

Thank you!!!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
GODLIKE's picture

Well here I am again. I

Well here I am again.
I produced this stuff because I must first read the existing file and clean it from existing objects in it:

-- WORK FILE set up
fileNamez = getOpenFileName \
caption:"WORK FILE" \
filename:"" \
types:"NeoAxis Map|*.map|All Files|*.*|"
---- FileNamePath = ((GetDir #export)+FileName)
mapFile = openFile fileNamez

-- ========== scan the file to clean it from STATIC MESHES and in case from LIGHTS (depending on how the flag is set)
-- finds the START and END of record in the XML file
skipToString mapFile "\n{\n"
recordStart = filePos mapFile
print recordStart
skipToString mapFile "\n}\n"
recordEnd = filePos mapFile
print recordEnd
-- see if the current record is a STATIC MESH
--seek mapFile recordStart
skipToString mapFile "type = StaticMesh"
-- if there is no string defining a STATIC MESH then go back to the beginning of the record
if filePos mapFile > recordEnd then seek recordStart
-- if this record is not a STATIC MESH then it tries to find if it's a LIGHT
--seek mapFile recordStart
skipToString mapFile "type = light"
-- if there is no string defining a LIGHT then continue to the next record
if filePos mapFile > recordEnd then seek recordEnd

But it gives me this error when I run it:
No ""seek"" function for 1005 <<

I need to reposition the cursor to the start of the record and when I set it then this error comes.

masquerade's picture

No problem. I am glad if we

No problem. I am glad if we could help. Since you said that you dont want the script made, I thought a little scratching wont hurt. :)

cheers

masquerade's picture

I am not sure if you checked

I am not sure if you checked the manual good enough. There is a whole section called 

"How to Output Object Data To file" Its under the "How to" section obviously. It explains the process with an example script step by step.

I am also not sure that you look well enough for similar scripts :) Or maybe you were not sure where to look. Here is my search results from scriptspot.

http://www.scriptspot.com/forums/3ds-max/scripts-wanted/export-coordinat...

http://www.scriptspot.com/3ds-max/position-exporter

http://www.scriptspot.com/forums/3ds-max/scripts-wanted/i-want-to-export...

http://www.scriptspot.com/forums/3ds-max/scripts-wanted/coordinates-expo...

 

Here are the commands list that you asked for.

- Command to have a list of objects =

all_objects_array=objects as array

- Command for loop=

for i in all_objects_array do

(

blablabla

)

 - command to set up a file (filename and path) and write 

createFile
<filename_string>

FileStream Values

print <value> to: <filestream>

Prints
the value to the specified file stream.

format <fmt_string> {
<value> } to: <filestream>

Formats
the value to the specified file stream.

Look for the documentation for detailed usage.

 

 

GODLIKE's picture

Thank you, the last part to

Thank you, the last part to write to file is precious to me :)
The thing is that the documentation I am on is not easy to find things in...

masquerade's picture

I dont know if it is

I dont know if it is necessary to say that, but If I were you I would also look for scripts which do the similar things and move forward through analyzing them.

GODLIKE's picture

Well I looked around but

Well I looked around but sincerely I cannot find anything similar to what I need.
I don't need complex things, no vertex moving, or functions.
I just need to export the list of objects that are in the scene (of course filtering in some way and changing their name and type and adding some parameters like position, rotation and size).
I really cannot find ANYTHING similar to this task.

If somebody can help me I would be very grateful.
Telling me in example:
- command to have the list of objects in the scene
- how to start examining the objects from the first to the last (no name, I must scan of course all the objects in the scene)
- command to set up a file (filename and path)
- what is the command to add text to the file
- I.E. if I meet object inc_tower_A_01 at position 5,4,0 with rotation 0,0,37 and scale 1,1,2 and I want to write it on the file with this format:

entity
{
type = inc_tower_A_01
uin = 12
classPrompt = MapObject
position = 5 44 0
rotation = 0 0 37
scale = 1 1 1
editorAlignmentMethod = None
name = inc_tower_A_01_1
}

It is really easy but I don't want to learn ALL MaxScript to make this, this is why I ask your help.
As I said, I have pretty good programming experience (though NOT in any sort of C...) and if you just tell me what are the commands to proceed I will put all my effort and time to produce the result :D

GODLIKE's picture

OK thank you, I'll give it a

OK thank you, I'll give it a look right now :)

martinskinner's picture

Hi, Since you already know

Hi,
Since you already know scripting I suggest you read the MaxScript documentation and scripting tutorials that ship with 3dsMax.
They cover pretty much everything - use the Index to search and find what you want.

Also check out the book - 3ds Max MAXScript Essentials - since you have scripting knowledge you should be able to pick things up pretty fast, and this is a great way to begin and for quick reference.

Martin

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.