Last active
January 24, 2016 20:32
-
-
Save pineapplemachine/4e1c22adafdb15eb064a to your computer and use it in GitHub Desktop.
Quick script to generate a StarNamesText.xml file for GalCiv III using a more convenient input format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| names = ''' | |
| One | |
| Star | |
| Name | |
| Per | |
| Line | |
| Hello | |
| World | |
| ''' | |
| names = (n.strip() for n in names.split('\n') if len(n.strip()) > 0) | |
| with open('StarNamesText.xml', 'wb') as xml: | |
| xml.write(''' | |
| <?xml version="1.0" encoding="utf-8"?> | |
| <StringTableList | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:noNamespaceSchemaLocation="../../Schema/Lib/StringTable.xsd"> | |
| ''' + | |
| ''.join( | |
| ''' | |
| <StringTable> | |
| <Label>RANDOM_STAR_NAME_%d</Label> | |
| <String>%s</String> | |
| </StringTable> | |
| ''' % (i, n) for i, n in enumerate(names) | |
| ) + | |
| '</StringTableList>' | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment