Page 1 of 2
Help with Python please?
Posted: Tue Jun 03, 2008 12:57 pm
by Amen Brick
I can do the models, I can understand the game scripting just (thanks to copy and paste lol), but Python always defeats me (as does *mumble sputter yafray, but that's another story).
Could some give me a really, really basic (ie, aimed at chimps) step by step guide to converting obj to dat via python or (god, let there be) some other way.
I have python, i have the model utility files. I'm using a PC.
I tried to follow the guide in 'how to make models', but when I entered the line beginning with $ in python it gave me a syntax error and I know too little to know where I have gone wrong. I don't know if its because I put the script in the wrong folder or what ( i put it in scripts, but that may be just too damned easy).
Thanx in advanx!
Posted: Tue Jun 03, 2008 1:28 pm
by CaptKev
with Obj2DatTex.py and <model name>.obj and <model name>.mtl in the C: directory
Start/Run/cmd to go to a command prompt
then type
cd\ [ENTER]
Obj2DatTex.py <model name>.obj [ENTER]
exit [ENTER]
You should end up with <model name>.dat in the C: directory
Posted: Tue Jun 03, 2008 1:29 pm
by Amen Brick
God I hope that works, I'm biting the table top!
Thanks!
C: being optional? I could change the above to Desktop?
Posted: Tue Jun 03, 2008 2:09 pm
by Griff
yes, after captKev writes:
cd\ [ENTER]
you'd have to add an extra command line, something like:
cd C:\Documents and Settings\[your_username]\Desktop
then continue as captKev says.
what i usually do is just a slight variation of CaptKev's advice, i usually make a new folder on the C: drive, called 'newship' or something, put my new models .obj and .mtl fles and the obj2dattex.py script file in it, then
open a command prompt and type
cd \
cd c:\newship
obj2dattex.py my_cool_model.obj [where 'my_cool_model' is replaced by your models name]
when i navigate back to c:\newship using windows there should be a new file in it called my_cool_model.dat
if you're getting errors or no dat file appears, make sure the original model is all triangles (no quads or n-gons) and that it's within Oolite's limits on vertices & polygons, which are:
Oolite v1.69 (and higher) - 500 vertices, 800 polygons (all must be triangles), 8 materials.
Oolite 1.65 - 320 vertices, 512 polygons (all must be triangles), 7 materials
Posted: Tue Jun 03, 2008 4:26 pm
by Frame
when i first used the python script i got an Error
canĀ“t recall the exact words but it was something like
"error in line 73 empty float"
if you encounter this, look here for solution
https://bb.oolite.space/viewtopic.ph ... ght=python
Cheers Frame.
Posted: Tue Jun 03, 2008 4:31 pm
by Selezen
Before you do that make sure that Python is listed in your PATH statement in Windows. It's usually not.
To make this as simple as possible, I usually put everything in the Python installation folder.
So, to summarise my method:
Install Python. Note the installation folder, i.e. C:\PYTHON25.
Copy the Obj2DatTex.py file into that installation folder.
When you've created your ship model, export it to OBJ format and make sure the OBJ and MTL files are saved (or copied) to the Python installation folder.
Open a command box and change directory to the installation folder, i.e. CD\PYTHON25.
Type the command to run the converter as listed above.
It works for me.
Posted: Wed Jun 04, 2008 9:17 am
by Amen Brick
Ok, I'll try that. I was getting syntax error at the end of my model name (which wouldn't have worked anyway, too many faces!).
I hates the python.
Seriously, I'll sell my soul and the souls of my family to anyone who makes a simple gui or program that does this with a click.
Posted: Wed Jun 04, 2008 1:16 pm
by Frame
Amen Brick wrote:Ok, I'll try that. I was getting syntax error at the end of my model name (which wouldn't have worked anyway, too many faces!).
I hates the python.
Seriously, I'll sell my soul and the souls of my family to anyone who makes a simple gui or program that does this with a click.
Tempting... can you cook ?,weld & (MAG), and paint with an Electro static paint gun, that way you can goto work for me, and i can stay at home making o.. GUI Programs ^^
Posted: Wed Jun 04, 2008 1:21 pm
by Amen Brick
Aaargh.
I did this as suggested
and this still happens
Maybe the path is still out, but I can't path either. (always worried I'll screw something important up). I had python in d: (my main drive), but copied it over to c: (trying to keep as close to instructions as possible). When it first misfired, I deleted the D: copy and restarted my comp. Still nada.
Note: Yeah, I see the python script isn't showing the Python snake either, but it didnt work while it did and I don't know why its lost it's icon either (tho probably deleting the d: drive copy did it?)
Grrr. submit dammit
Posted: Wed Jun 04, 2008 1:34 pm
by Frame
you cant just COPY it from D to C...
you need to run it from the location you have it installed allthough i figure if you ran it from C it would still get the important stuff it needs from D, that is if you still have it on D:
and it seems you do... anyway.
you need to type
Not
cd is a command, it means Change Directory, Windows or DOS will read it as "CD/python" and not know of that command...
Invalid syntax means really "unknown command" when in a dos prompt..
a dos promt is the black window you see, it is a leftover from the days we did not have windows but DOS... but has been kept in windows for various reasons but one of them is so you can run command line programs as python is..
Posted: Wed Jun 04, 2008 1:36 pm
by Amen Brick
kk, i'll try it without the slash, and then I'll try redownloading it to c and then I'll try going crazy in a clocktower.
gree submit dammit
Posted: Wed Jun 04, 2008 1:45 pm
by Frame
Amen Brick wrote:kk, i'll try it without the slash, and then I'll try redownloading it to c and then I'll try going crazy in a clocktower.
I hope you refer to python,, not oolite.. just double checking
Anyway its not really your fault.. past days, and present days programmers sometimes come up with eloborate word combinations for really simple errors.. while they are warrented for the more serious ones..
Invalid syntax, or syntax error, does not give the unexperienced computer user 1 hint of a clue. when navigating through directories one should not presume the user is familiar with programming "smart talk".
An error like this should be "cd/python is an unknown or unvalid command syntax"
Posted: Wed Jun 04, 2008 2:10 pm
by CaptKev
@Amen Brick, you need to run the commands in a DOS box.
Pick Start/Run... then type cmd and click the OK button.
http://download.marlinsoftware.co.uk/Oolite/obj2dat.png
Posted: Wed Jun 04, 2008 2:13 pm
by Amen Brick
Doh!
Ok, will do!
Posted: Fri Jun 06, 2008 9:13 am
by Amen Brick
It worked, thank god, it worked.
*puts away rifle and mad glint in eye.