Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Success!  (Read 1214 times)

Uristsonsonson

  • Bay Watcher
    • View Profile
Success!
« on: July 11, 2014, 02:15:14 am »

It took about thirteen hours of constant work and some moderate neck pain, but I finally finished alphabetizing the language_words file by hand. I'm planning to use it in a language overhaul mod, but i can upload it to DFFD if anyone wants it for any reason. I haven't changed anything but the order. I'll be doing the racial language files next if anyone's interested (or wants to help in any way).

http://dffd.wimbli.com/file.php?id=8862 is the link. :D
« Last Edit: July 11, 2014, 02:34:23 am by Uristsonsonson »
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #1 on: July 11, 2014, 03:30:56 am »

Aphabetizing by hand for 13 hours?

Wouldn't writing a sorting program be quicker than that, and you can reuse it on multiple files.

How about incorporate my real-world language pack with what you're doing? IDK if languages have had any updates from 31.25, which is the version the language pack I collected/created (see .sig) was developed for.

I can code what's needed in the language of your choice, whatever, if you're not a programmer.

Granite

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #2 on: July 11, 2014, 03:36:17 am »

What he said. Well, I guess Uristsonsonson ain't got the skills to write that script, but, oh man! Dude, you should learn some basic programming language to do that for you, really. Maybe something like Bash (for Linux) or Batch (for Windows)... You might even be capable of learning that language in less then those 13 hours.
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #3 on: July 11, 2014, 03:39:47 am »

VBS is pretty powerful for Windows noobs, much better than Batch scripts, and it's built-in so you never need to worry about installing crap or updates.

I'd probably recommend Python if you're not on windows.

Granite

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #4 on: July 11, 2014, 04:11:45 am »

Yeah, you're probably right about Python, I guess it's easier for the newby programmer to grasp than shell scripting.
Logged

Uristsonsonson

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #5 on: July 11, 2014, 04:27:49 am »

I could look into it. How could I get to it?

I think they were still well spent if it helps anyone out anyway.
Logged

Granite

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #6 on: July 11, 2014, 08:01:56 am »

I could look into it. How could I get to it?

I think they were still well spent if it helps anyone out anyway.
For sure, I didn't mean you wasted your time, but you know, with a simple script that could be done in no time.

Anyway, in case you want to learn how to deal with texts(or 'strings') in Python, there are many tutorials around the internet. Ofc, you'd still need to learn the basics of programming logic before venturing deep into the language.

Here's about control flow/programming logic. There's more to it than just that, but even if I post a lot of things in here, it won't be enough for you to learn alll there's to learn about string operations, or general python programming. But it's a beginning.
http://en.wikibooks.org/wiki/Python_Programming/Control_Flow

Here is about string operations.
http://www.learnpython.org/en/Basic_String_Operations
http://www.pythonforbeginners.com/basics/string-manipulation-in-python
« Last Edit: July 11, 2014, 08:13:32 am by Granite »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Success!
« Reply #7 on: July 11, 2014, 09:42:30 am »

Code: [Select]
import os

#LANGUAGE
filename = 'language_DWARF.txt'
files = [filename]
totdat = [[]]*len(files)
for i in range(len(files)):
f = open(files[i],encoding='cp437')
dat = []
for row in f:
dat.append(row)
totdat[i] = dat
f.close()

ddtot = [[]]*len(totdat)
for j in range(len(totdat)):
d = []
for i in range(len(totdat[j])):
if totdat[j][i].count('[TRANSLATION:') >= 1:
y = totdat[j][i].partition('[TRANSLATION:')[2].partition(']')[0]
d.append([y,i])
dd = []
if len(d) >= 1:
for i in range(len(d)-1):
dd.append([d[i][0], d[i][1], d[i+1][1]])
dd.append([d[-1][0], d[-1][1], len(totdat[j])])
ddtot[j] = dd

wf = open(filename, 'w',encoding='cp437')
words = totdat[0][:ddtot[0][0][1]-1]
for i in range(len(ddtot)):
if len(ddtot[i]) > 0:
vals = []
for j in range(len(ddtot[i])):
x = ddtot[i][j][1]
y = ddtot[i][j][2]
z = len(''.join(totdat[i][x+1:y]).split('['))
vals = []
for k in range(z-1):
vals.append(''.join(totdat[i][x+1:y]).split('[')[k+1].split(']')[0].split(':')[1])
order = sorted(range(len(vals)), key=vals.__getitem__)
for k in order:
words.append(totdat[i][x+1+k])

for i in range(len(words)):
wf.write(words[i])

This is python code that alphabetically organizes language files. Works on my system with vanilla languages. It *should* handle multiple [TRANSLATION] in a single file, but I haven't tested it with that.
Logged