Notifications
Clear all

[Closed] Text to Point helper cluster

Well the maxscript does say it is even for ppl with no scripting experience, but what seems to be a simple tasks at first now look like I would have to crunch down dozens of terms, syntaxes and many other thing that I have not a single clue about.

So I ask you kind sirs to help me out with this please.

I have a text file that contains text and numbers. I would need the script to open and skip the file contents until it finds a line “member::LinearTransform” then create a Point helper at coordinates that follows below the line
member::LinearTransform
right::Vec3
x 1.0
y 0.0
z 0.0
up::Vec3
x -0.0
y 1.0
z 0.0
forward::Vec3
x 0.0
y -0.0
z 1.0
trans::Vec3
x 2.0
y 0.9
z 0.5

Then go to next line create a point helper at line coordinates, and so on.

If someone could give me at least a base idea for the code so I can try to refine it myself. But I do need a base to to start from.

Full text file https://dl.dropbox.com/u/88155050/BF3/Venice1pSke01.txt
Thank you very much guys

3 Replies

What about something like this:

(
	fn nextFloat stream =
		(trimLeft (readLine stream) " xyz") as float
	
	fn getVector stream type =
	(
		skipToString stream type 
		skipToNextLine stream
		Point3 (nextFloat stream) (nextFloat stream) (nextFloat stream)
	)
	
	fn getNextMatrix stream =
		if skipToString stream "member::LinearTransform" != undefined do
			matrix3 (getVector stream "right::Vec3") \
				(getVector stream "up::Vec3") \
				(getVector stream "forward::Vec3") \
				(getVector stream "trans::Vec3")
	
	local file = openFile "C:\\TEMP\\Venice1pSke01.txt"

	while (local matrix = getNextMatrix file) != undefined do
		Point transform:matrix size:.5
)

Swordslayer you are my Hero!!!

Your script works like a charm, I`ll send you a box of finest cookies.

Thank you so much!!!

The script works great, but I keep failing on finding a correct function to name the created pointers according to the “BoneName::Array” (.txt file in attachment)

So instead of naming created: “Pointer01” it would be named “Reference”, then instead of “Pointer02” name “AITrajectory”, and follow the rest of the list…

Anyone any tips?

Thanks ;]