Guest_imported
New member
- Jan 1, 1970
- 0
HI,
I've never written a Python script before. I've decided I want to write one for a TS scene I'm making. What I want to do is to load some objects (.cob files) into the scene based upon the data read in from a .txt file. The .txt file will be a series of either "1" or "0" to indicate whether or not the object should be loaded into the scene. I've been researching how to do this and here's what I've come up with, can I get somebody to verfiy my code and/or offer suggestions as to how to improve?
I think the script will look something like this:
def ontimestarted():
shipfile = open('c:\program files\SSI\shipgroup.txt','r')
ship1 = shipfile.readline()
if ship1 == 1
queenmary = doc.LoadObject("queenM.cob"
queenmary.Position = (50,50,50)
ship2 = shipfile.readline()
if ship2 == 1
Titanic = doc.LoadObject("Titanic.cob"
Titanic.Position = (100,100,100)
# etc for each needed model
shipfile.close()
doc.PlayAnim()
Thanks in advance for any help that can be given...
I've never written a Python script before. I've decided I want to write one for a TS scene I'm making. What I want to do is to load some objects (.cob files) into the scene based upon the data read in from a .txt file. The .txt file will be a series of either "1" or "0" to indicate whether or not the object should be loaded into the scene. I've been researching how to do this and here's what I've come up with, can I get somebody to verfiy my code and/or offer suggestions as to how to improve?
I think the script will look something like this:
def ontimestarted():
shipfile = open('c:\program files\SSI\shipgroup.txt','r')
ship1 = shipfile.readline()
if ship1 == 1
queenmary = doc.LoadObject("queenM.cob"
queenmary.Position = (50,50,50)
ship2 = shipfile.readline()
if ship2 == 1
Titanic = doc.LoadObject("Titanic.cob"
Titanic.Position = (100,100,100)
# etc for each needed model
shipfile.close()
doc.PlayAnim()
Thanks in advance for any help that can be given...