Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: New Utility: DF Word Generator  (Read 2843 times)

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
New Utility: DF Word Generator
« on: August 21, 2008, 10:01:53 pm »

OK, finally at the point where I'm happy with this little script. You'll need perl for it.

I don't think this one can be turned into an executable too easily. I have most of the variable stuff hard-coded into it. Too lazy to try and give it any sort of control file or anything. But if someone wants to upgrade it to do that, they're welcome to.

You can download it at: http://dffd.wimbli.com/file.php?id=463

-----------------------------------------------------------------------------------
DFWordGenerator
by Mephansteras

This perl script is designed to make brand new languages for Dwarf Fortress. Useing it is fairly simple. However, it does require the Math::Random module. If you do not have it, you can get it using the PPM.

For those that need perl, I suggest going to Active State and using their distribution. I also use the Open Perl IDE which is a program that makes writing/editing/running perl scripts much easier. To use the PPM, after installing ActiveState it should be in the Perl/bin directory. You may want to add the following repository to it's list: http://cpan.uwinnipeg.ca/PPMPackages/10xx/. I know that one has the Math::Random module on it.


All you need to do is update the file locations at the top of the program:

my $LangFile = 'C:\Games\DwarfFortress\40a\raw\objects\language_words.txt';  # This is the language file to get the words from
my $NewLanguage = 'DWARF_CHAOS'; ## This goes in the [trANSLATION: ] entry in the entities file
my $OutputFile = 'C:\Games\DwarfFortress\40a\raw\objects\language_' . $NewLanguage . '.txt';  # This is where the new language is going to go

The NewLanguage entry is the name of the language you're creating. It goes in the entities file under the race as [trANSLATION:YOUR_LANGUAGE] or whatever you've named it.

Next, you need to set the rules for the language.

First, you set the frequency of each vowel.
For example, if you want 'a' to be used often, set it to a high number like 10.
$Vow{'a'}{'Freq'} = 10;
Or, if you want it to be used infrequently, set it to a low number like 1 or 2
$Vow{'a'}{'Freq'} = 1;
If you don't want it to be used at all, set it to 0
$Vow{'a'}{'Freq'} = 0;

You can also give letters specific rules. They are:
$Vow{'a'}{'NoStart'} = 1 means the letter cannot start a word
$Vow{'a'}{'NoEnd'} = 1 means the letter cannot end a word
$Vow{'a'}{'NoDouble'} = 1 means that the letter cannot follow itself
$Vow{'a'}{'OnlyStart'} = 1 means that the letter can only start a word
$Vow{'a'}{'OnlyEnd'} = 1 means that the letter can only end a word
Setting any of them to 0 will turn off that rule

Do the same for the consonants, which is the next section in the program.
You are free to add in any letter combinations that you like. Simple add the appropriate line, and copy any rules you like from the existing letters.

Next you set the word specific rules. These will add more flavor to your language.
## StartWithCons = 1 means that the word can start with a consonant
## StartWithVowel = 1 means that the word can start with a vowel
## EndWithCons = 1 means that the word can end with a consonant
## EndWithVowel = 1 means the the word can end with a vowel
## NoDoubleCons = 1 means the word cannot have two consonant picks in a row
## NoDoubleVowels = 1 means the word cannot have two vowel picks in a row
my %Rules;
$Rules{'StartWithCons'} = 1;
$Rules{'StartWithVowel'} = 1;
$Rules{'EndWithCons'} = 1;
$Rules{'EndWithVowel'} = 1;
$Rules{'NoDoubleCons'} = 1;
$Rules{'NoDoubleVowels'} = 1;

Setting any of these to 0 will turn off that rule.

Have fun making languages, and if you have any issues you can PM on the dwarf fortress board, post in the thread about this program, or e-mail me at [my username] @ gmail.com
« Last Edit: October 02, 2008, 01:01:38 pm by Mephansteras »
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

IndonesiaWarMinister

  • Bay Watcher
    • View Profile
Re: New Utility: DF Word Generator
« Reply #1 on: September 24, 2008, 09:03:02 pm »

Is this utility is good? [necromancy! YEAH! I'm a NECROMANCER! DIE TO THE PRIESTs!]
Logged

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: New Utility: DF Word Generator
« Reply #2 on: September 24, 2008, 09:20:19 pm »

Well, I haven't gotten any feedback on it. But I've found it useful.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: New Utility: DF Word Generator
« Reply #3 on: October 02, 2008, 01:02:04 pm »

Added some additional perl help to the OP. Mostly where to get stuff.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

Owie

  • Bay Watcher
    • View Profile
Re: New Utility: DF Word Generator
« Reply #4 on: October 02, 2008, 04:53:04 pm »

This is going to be awesome. Finally, custom civs with a custom language!
Logged
Yaha!

Zeta

  • Bay Watcher
  • Insane guy with a fox civilization
    • View Profile
    • Kitsune Zeta's Domain
Re: New Utility: DF Word Generator
« Reply #5 on: November 17, 2008, 05:39:12 pm »

I can't seem to acquire the Math::Random module from anywhere (don't know why), and attempting to continue (or step past that) causes OTHER modules (including one "win32" module) to throw errors.

some help here would be appreciated.
Logged

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: New Utility: DF Word Generator
« Reply #6 on: November 17, 2008, 05:42:04 pm »

*crickets chirping in head*

How do I shot perl in Mac?
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: New Utility: DF Word Generator
« Reply #7 on: November 19, 2008, 06:05:16 pm »

@Zeta: Are you using ActiveState perl? If so, did you try adding the http://cpan.uwinnipeg.ca/PPMPackages/10xx/ repository for the PPM?

@Warlord: Sorry, I don't have any experience with perl on Macs. What problem are you having? I may be able to give some advice, anyway.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

Zeta

  • Bay Watcher
  • Insane guy with a fox civilization
    • View Profile
    • Kitsune Zeta's Domain
Re: New Utility: DF Word Generator
« Reply #8 on: November 19, 2008, 06:34:07 pm »

@Zeta: Are you using ActiveState perl? If so, did you try adding the http://cpan.uwinnipeg.ca/PPMPackages/10xx/ repository for the PPM?
yes, and yes. no Math::Random module in there.

it keeps looking for a file "math/random.pm" (or whatever the extension is), and googling it says it should be in the basic perl math package.

(of course, right now, language generation is kinda taking a backseat to other issues I've come across with my new raceciv, namely the unusual inability to DIG or PICK UP PICKS. dunno why)
« Last Edit: November 19, 2008, 06:36:06 pm by Zeta »
Logged

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: New Utility: DF Word Generator
« Reply #9 on: November 19, 2008, 06:54:37 pm »

Hmmm. Odd, that's where I found it. The math/random.pm is in fact the path it should be looking for. the :: in Math::Random is telling perl the file path.

Well, worst case scenario you can e-mail me the file and I'll send you back a language file for them.

As for the Picks issue, that's usually caused because the Entity file doesn't have picks in it. Or, that picks are too large for them to use two-handed.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

Zeta

  • Bay Watcher
  • Insane guy with a fox civilization
    • View Profile
    • Kitsune Zeta's Domain
Re: New Utility: DF Word Generator
« Reply #10 on: November 19, 2008, 07:59:24 pm »

hmm... seems like the default repository has it. imagine that. and with that, it works just fine (had to fix one line - changed directories since I last tried the script)

also, the fox-picks issue is being fixed (I hope - I'll have to regen to do it, though).
Logged

Captain Mayday

  • Bay Watcher
  • A Special Kind of Terrible
    • View Profile
Re: New Utility: DF Word Generator
« Reply #11 on: November 20, 2008, 08:11:05 am »

I've found this useful. Thanks for the awesome utility.
Logged
Why not join us on IRC? irc.newnet.net #bay12games