Posted By
|
Message
|
The_Antisony At least I'm not Circy
Registered 01/07/2002
Points 1341
|
14th September, 2014 at 14/09/2014 04:27:27 -
I'm trying to create a simple weapon generator for Dwarf Fortress that names items by combining an item quality, item type, and a random word pulled from dwarf fortress' language files.
Here are some examples:
Dirty Tomahawk of minetha
Axe of oneniths
Dagger Axe of xamo
Dirty Tomahawk of minetha
Axe of oneni
Shiny Tomahawk of lanaleirty
I know it's picky, but I really want to capitalize the first letter of the last word - trouble is by default none of the language file words are capitalized and changing them will likely fubar dwarf fortress. Any way of doing this without editing the language files directly?
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1971
|
14th September, 2014 at 14/09/2014 13:16:39 -
A simple expression to capitalize the first letter of a string:
Upper$(Left$( String, 1)) + Right$( String, Len( String)-1)
Edited by Sketchy
n/a
|
The_Antisony At least I'm not Circy
Registered 01/07/2002
Points 1341
|
14th September, 2014 at 14/09/2014 18:26:07 -
Originally Posted by Sketchy A simple expression to capitalize the first letter of a string:
Upper$(Left$( String, 1)) + Right$( String, Len( String)-1)
I usually stick to the buttonized expressions in the editor. It doesn't normally take me long to remember that retrieving data from Special lists everything, but last night I was having a serious brain fart. I woke up this morning, had a cup of coffee, opened up MMF2 and was like "Oh, yeah! Derp!". Anyway, thanks for sorting that out for me. Saves me from having to completely overhaul the random item naming system.
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1971
|
16th September, 2014 at 16/09/2014 15:07:58 -
Funnily enough, I had a similar brain fart myself. My original solution to your problem looked like this:
Mid$( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Find("abcdefghijklmnopqrstuvwxyz", Left$( String , 1 ), 0), 1) + Right$( String , Len( String )-1 )
...and then I remembered MMF2 has the Upper$() function, and felt a bit silly - so I quickly edited the post before anyone noticed!
Oh, and thanks for the trophy
Edited by Sketchy
n/a
|
|
|