Start a new topic

New API user No Clue what im doing.

New to the API, learning a little but really struggling on how to even think of a way to do more complicated tasks.

What I am wanting to do:

inside the master.flt

find the lower left vertex of the tile filename0_0

translate all the tiles in the master.flt from said vertex to 0,0,0

save file

I'm really trying to learn how to do too many things at once, and not really succeeding on grasping the basics. I can look for older scripts, pick and pull and make a few things work, but if I don't have a file to reference, I'm pretty much lost.

any help would be greatly appreciated.

got this typed into the script, nothing moved at all. I tried replacing the 0's with bestVertex.z and -bestVertex.z, still no movement

ive gone through this 3x and each time found a few spelling errors but fixing them has not made the script act any different

Python can be difficult to find logic errors. I suspect one of your lines is not indented to the correct level. For instance, in one of your walk functions, if the return statement is indented too far, it will not return true. If this happens it is a signal to stop the walk. This small change can break the entire script and will cause no errors.

The best way to find errors like this is to insert print statements

print 'in function xx'

Then you can follow the output in the window to see what is called, how often it is called and it will help to find things you did not expect. Be careful with print statements though as they are slow and your script will appear to stop functioning if it tries to print a few thousand of them. (easily done with one print statement in a walk that walks vertices for instance)

Ok with that said, you shouldn't have to retype this. You can copy and paste it into the script editor. I just gave it a try and it pasted in and functioned for me.

ok, i got it now. i was still waiting on dm to get the file to me so I tried to replace the 0's with bestVertex.z and -bestVertex.z

and it moved all the tiles correctly. 

I took a break from this task to try a few simpler  tasks, i have a long way to go. But I do feel like I am understanding what things do. I dont think Ill ever just be able to throw together a script without using bits and pieces of other scripts. 

I really appreciate the help. This will same me alot of time.

Login to post a comment