libtcoddocumentation

15.3.4. Example structure

Consider this example structure. It does not contain syllables, but rather full names.

name "king" {
syllablesStart = "Alexander, Augustus, Casimir, Henry, John, Louis, Sigismund,"
"Stanislao, Stephen, Wenceslaus"
syllablesMiddle = "I, II, III, IV, V"
syllablesEnd = "Bathory, Herman, Jogaila, Lambert, of_Bohemia, of_France,"
"of_Hungary, of_Masovia, of_Poland, of_Valois, of_Varna, Probus,"
"Spindleshanks, Tanglefoot, the_Bearded, the_Black, the_Bold, the_Brave,"
"the_Chaste, the_Curly, the_Elbow-high, the_Exile, the_Great,"
"the_Jagiellonian, the_Just, the_Old, the_Pious, the_Restorer, the_Saxon,"
"the_Strong, the_Wheelwright, the_White, Vasa, Wrymouth"
rules = "%50$s, $s_$m, $s_$50m_$e"
}



The above structure only uses three syllable lists and has three different rules. Let's analyse them one by one.

%50$s - this will simply output a random Start syllable, but this rule is not intended to be picked with the same frequency as the others, so the frequency marker at the beginning ("%50") ensures that 50% of the time this syllable will be rejected and a different one will be picked.

$s_$m - this will output a Start syllable and a Middle syllable, separated with a space.

$s_$50m_$e - This will output a Start syllable, followed by a Middle syllable, followed by an End sylable, all separated with spaces. However, the Middle syllable has only 50% chance of appearing at all, so 50% of the time the rule will actually produce a Start syllable followed directly by an End syllable, separated with a space.

As you may have noticed, the third rule may produce a double space if the Middle syllable is not chosen. You do not have to worry about such cases, as the generator will automatically reduce all double spaces to single spaces, and leading/ending spaces will be removed completely.

Output from this example set would contain kings' names based on the names of real monarchs of Poland. Have a look at the sample:

Alexander IV
Alexander
Sigismund
Stanislao V
Stanislao
Henry I of Poland
Augustus V
Stanislao I the Pious
Sigismund IV the Brave
John the Great
Henry the Old
John the Bold
Stanislao II the Saxon
Wenceslaus of France
John Probus
Louis V
Wenceslaus Lambert
Stanislao Spindleshanks
Henry Herman
Alexander the Old
Louis V the Curly
Wenceslaus II
Augustus IV
Alexander V
Augustus Probus