- Step1: Install Python 2.7 from http://www.python.org (do not use 3.x)
- Step2: Create a new folder anwhere on your computer and name it anything you like
- Step3: Create the following file: "CopyAesthetics.py" and copy and paste the script below into this file
- Step4: Extract and place the Universe XML witch holds the visual data you want to copy in the same folder as the python script and name it "x3_universe_source.xml"
- Step5: Extract the Universe XML witch you would like to input visual data to and place it in the same fodler as the python script and name it "x3_universe_target.xml"
- Step6: Execute(Double Click) the script, A "x3_universe_output.xml" file should be created
- Step7: Rename the "x3_universe_output.xml" file to "x3_universe.xml"
- Step8: ???
- Step9: Profffffit!
CopyAesthetics.py:
Code: Select all
#Written by Jack08
SourceXML = open("x3_universe_source.xml", "r")
def ExtractElement(Element, Data):
Element = Element+"="
A = Data.split(Element)
if len(A) > 1:
A=A[1]
A=A.split('"')[1]
return A
return False
def IsTypeNonF(Type, Data):
Chk = ExtractElement("t", Data)
if Chk == False or Chk != str(Type) or ExtractElement("f", Data)!=False:
return False
return Chk
def IsType(Type, Data):
Chk = ExtractElement("t", Data)
if Chk == False or Chk != str(Type):
return False
return Chk
def IsSector(Data):
return IsType(1, Data)
def IsSun(Data):
return IsTypeNonF(3, Data)
def IsBackground(Data):
return IsType(2, Data)
def IsPlanet(Data):
return IsType(4, Data)
Data = SourceXML.readline()
Sectors = []
cSector = []
while Data != '':
if(IsSector(Data)):
if len(cSector):
Sectors.append(cSector)
cSector = []
A=Data
cSector.append([int(ExtractElement("x", Data)), int(ExtractElement("y", Data))])
if(IsBackground(Data) or IsSun(Data) or IsPlanet(Data)):
cSector.append(Data)
Data = SourceXML.readline()
SourceXML.close()
XML_OUT = []
Target = open("x3_universe_target.xml", "r")
Data = Target.readline()
Enable = False
while Data != '':
if(IsSector(Data)):
XML_OUT.append(Data)
CoOrd = [int(ExtractElement("x", Data)), int(ExtractElement("y", Data))]
for Entry in Sectors:
if CoOrd in Entry:
for NewData in Entry:
if type(NewData) == str:
XML_OUT.append(NewData)
Enable = True
break
else:
Enable = False
Data = Target.readline()
continue
if((IsBackground(Data) or IsSun(Data) or IsPlanet(Data)) and Enable):
Data = Target.readline()
continue
XML_OUT.append(Data)
Data = Target.readline()
Target.close()
Output = open("x3_universe_output.xml", "w")
for Element in XML_OUT:
Output.write(Element)
Output.close()