Jump to content
Age of Civilizations
pastelynn

A python script that create province files from mapAoC2_v2.txt in map editor

Recommended Posts

I just lazy to change name of PROV file so I create this file to save my time.

thing that it this is just create province files for who missed the PROV file and who want to save time (like me).

How to use:

  1. this is an python script so you must have python installed.
  2. place my 0123.py file at same folder as mapAoC2_v2.txt or \editor_data\Provinces (I named this way because province files name is 0, 1, 2, 3...).
  3. run it and type file name (without .txt) if file name is mapAoC2_v2.txt just type enter.
  4. enjoy!

Download:

Mega: https://mega.nz/#!eVYnRCqJ!n8JHcOzv7WFU_hYcKkxHJMrfb_0PkaMsQjIVbEGLOxw

or below this post

If you have download problem you can just create python script by using code below:

filename=str(input('filename (without .txt): '))
if filename:
    filename = filename + '.txt'
else:
    filename = 'mapAoC2_v2.txt'
f= open(filename,'r')
num_lines = sum(1 for line in open(filename))
line = 0
print(0/2)
while line < num_lines:
    fo = open(str(int(line/2)),'w+')
    lin1 = f.readline()
    if line == num_lines-2:
        lin2 = f.readline()+'\n'
    else:
        lin2 = f.readline()
    fo.write(lin1[:-1]+';'+lin2[:-1])
    fo.close
    line = line + 2
    print(str(int(line/2)),'done')
f.close

Isn't you post this before?:

Yes it is, but I noticed that my file have a problem (last province, last point, last digit just disappear) so I fixed it.

I'm bad at coding but I think this would help some people (like me). also sorry for my grammar, i'm not a native English speaker.

0123.py

Share this post


Link to post
Share on other sites
11 hours ago, Tincho987 said:

Do you have a virus?

It just a python script. if you don't trust me just copy the code and create a new .py file in your computer. if you think python is a virus, python has millions of user, if it has a virus someone would notice and report but this didn't happen. so I'm sure this didn't have any virus

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...