Source

libtcod / doc / html2 / namegen_file_4.html

Full commit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>libtcod documentation | Example structure</title>
<script type="text/javascript" src="../js/doctcod.js"></script>
<link href="../css/style.css" rel="stylesheet" type="text/css"></head>
<body><div class="header">
<p><span class="title1">libtcod</span><span class="title2">documentation</span></p>
</div>
<div class="breadcrumb"><div class="breadcrumbtext"><p>
you are here: <a onclick="link('../index2.html')">Index</a> &gt; <a onclick="link('namegen.html')">15. Name generator</a> &gt; <a onclick="link('namegen_file.html')">15.3. Syllable set configuration</a> &gt; <a onclick="link('namegen_file_4.html')">15.3.4. Example structure</a><br>
<a class="prev" onclick="link('namegen_file_3.html')">15.3.3. Rules</a> 
</p></div></div>
<div class="filter"><input type="checkbox" id="chk_c" name="chk_c" onchange="enable('c',this.checked)" checked='checked' ><label  for='chk_c'> C   </label><input type="checkbox" id="chk_cpp" name="chk_cpp" onchange="enable('cpp',this.checked)" checked='checked' ><label  for='chk_cpp'> C++   </label><input type="checkbox" id="chk_cs" name="chk_cs" onchange="enable('cs',this.checked)" checked='checked' ><label  for='chk_cs'> C#   </label><input type="checkbox" id="chk_py" name="chk_py" onchange="enable('py',this.checked)" checked='checked' ><label  for='chk_py'> Py   </label><input type="checkbox" id="chk_lua" name="chk_lua" onchange="enable('lua',this.checked)" checked='checked' ><label  for='chk_lua'> Lua   </label></div>
<div class="main"><div class="maintext">
<h1>15.3.4. Example structure</h1>
<p>Consider this example structure. It does not contain syllables, but rather full names.<br /><div class="code"><p>name "king" {<br />  syllablesStart = "Alexander, Augustus, Casimir, Henry, John, Louis, Sigismund,"<br />    "Stanislao, Stephen, Wenceslaus"<br />  syllablesMiddle = "I, II, III, IV, V"<br />  syllablesEnd = "Bathory, Herman, Jogaila, Lambert, of_Bohemia, of_France,"<br />    "of_Hungary, of_Masovia, of_Poland, of_Valois, of_Varna, Probus,"<br />    "Spindleshanks, Tanglefoot, the_Bearded, the_Black, the_Bold, the_Brave,"<br />    "the_Chaste, the_Curly, the_Elbow-high, the_Exile, the_Great,"<br />    "the_Jagiellonian, the_Just, the_Old, the_Pious, the_Restorer, the_Saxon,"<br />    "the_Strong, the_Wheelwright, the_White, Vasa, Wrymouth"<br />  rules = "%50$s, $s_$m, $s_$50m_$e"<br />}</p></div><br /><br />The above structure only uses three syllable lists and has three different rules. Let's analyse them one by one.<br /><br />%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.<br /><br />$s_$m - this will output a Start syllable and a Middle syllable, separated with a space.<br /><br />$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.<br /><br />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.<br /><br />Output from this example set would contain kings' names based on the names of real monarchs of Poland. Have a look at the sample:<br /><div class="code"><p>Alexander IV<br />Alexander<br />Sigismund<br />Stanislao V<br />Stanislao<br />Henry I of Poland<br />Augustus V<br />Stanislao I the Pious<br />Sigismund IV the Brave<br />John the Great<br />Henry the Old<br />John the Bold<br />Stanislao II the Saxon<br />Wenceslaus of France<br />John Probus<br />Louis V<br />Wenceslaus Lambert<br />Stanislao Spindleshanks<br />Henry Herman<br />Alexander the Old<br />Louis V the Curly<br />Wenceslaus II<br />Augustus IV<br />Alexander V<br />Augustus Probus<br /></p></div><br />		</p>

</div></div>
<div class="footer"><div class="footertext">
	<p>libtcod 1.5.1, &copy; 2008, 2009, 2010, 2012 Jice & Mingos<br>
	This file has been generated by doctcod.</p>
	<p><table width='100%'><tr><td><a href="http://doryen.eptalys.net/libtcod">libtcod website</a></td>
	<td><a href="http://doryen.eptalys.net/forum/index.php?board=12.0">libtcod on Roguecentral forums</a></td>
  <td><a href="http://www.youtube.com/watch?v=PY9lJnVQbXs&feature=PlayList&p=553E3D00A1460331&playnext_from=PL&index=0&playnext=1">libtcod HOWTO video tutorials</a></td></tr></table></p>
</div></div>
</body>
<script>
initFilter();
</script>
</html>