{"id":2167,"date":"2012-08-08T16:10:27","date_gmt":"2012-08-08T23:10:27","guid":{"rendered":"http:\/\/www.nathalielawhead.com\/candybox\/?p=2167"},"modified":"2014-03-18T23:13:24","modified_gmt":"2014-03-19T06:13:24","slug":"the-wacky-name-generator-downloadable-source","status":"publish","type":"post","link":"https:\/\/www.nathalielawhead.com\/candybox\/the-wacky-name-generator-downloadable-source","title":{"rendered":"The Wacky Name Generator &#038; Downloadable Source"},"content":{"rendered":"<p>The Wacky Name Generator (Version 1.0.0.0.1.0.2)<br \/>\n<strong>Try it bellow:<\/strong><\/p>\n<p>[swfobj src=&#8221;http:\/\/nathalielawhead.com\/sourcefiles\/Wacky_Name_Generator\/namegenerator.swf&#8221; height=&#8221;261&#8243; width=&#8221;500&#8243;]<\/p>\n<p>So I&#8217;m making <a href=\"http:\/\/tetrageddon.com\" target=\"_blank\">a game<\/a>!<br \/>\nThe premise is that you play a monster tearing up a fictional city. Any city really.<br \/>\nProbably Tokyo, but I&#8217;m undecided.<br \/>\nThe other great premise is that you eat A LOT of civilians, military, and law enforcement officials.<br \/>\nTo add a touch of random (and reduce the time it takes for coming up with names for an &#8220;expendable&#8221; population), names for each enemy sprite are randomly created (in this case pieced together using a set amount of vowels and consonants), and then applied to the sprite.<br \/>\nIt&#8217;s intended for cute little dinky Asian sounding short names (first + last + occasional suffix).<\/p>\n<p>Some made me laugh so I figure good use could be had from playing with a name generator version of the code.<\/p>\n<p>You can download the sourcefiles <a href=\"http:\/\/nathalielawhead.com\/sourcefiles\/Wacky_Name_Generator\/\" target=\"_blank\">here (AS3 only).<\/a><br \/>\n<a href=\"http:\/\/nathalielawhead.com\/sourcefiles\/Wacky_Name_Generator\/\" target=\"_blank\">Download Source.<\/a><\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #888888\">\/\/USAGE:<\/span>\r\n<span style=\"color: #888888\">\/\/trace(generate_name(2,0,arr_prefix,arr_suffix));<\/span>\r\n<span style=\"color: #888888\">\/\/trace(generate_name(2,2,arr_prefix,arr_suffix));<\/span>\r\n<\/pre>\n<\/div>\n<p>Code:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #888888\">\/\/letters (vowels and consonants) for the names<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_vowels:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;A&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;E&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;I&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;O&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;U&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_cons:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;B&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;C&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;D&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;F&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;G&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;H&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;J&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;K&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;L&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;M&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;N&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;P&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Q&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;R&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;S&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;T&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;V&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;W&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;X&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Y&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Z&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #888888\">\/\/suffixes (applying a suffix is random)<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_suffix_city:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;B.A.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;B.F.A.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;B.Tech.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;B.Sc.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;M.A.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;M.F.A.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;LL.M&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;M.L.A.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;M.B.A.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;M.Sc.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;J.D.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;M.D.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;D.O.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Pharm.D.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Ph.D.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;D.Phil.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;LL.D&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Eng.D.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_suffix_civilian:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Esq.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Esquire&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Esq.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;esq.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Jr.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Junior&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Jnr.&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Snr.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #888888\">\/\/prefixes<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_prefix_military:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Lieutenant&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Commander&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Colonel&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Marine&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Cadet&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Cadet&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Cadet&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Captain&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Sergeant&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Major&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Master&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Pretty Officer&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Officer&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Chief&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Advisor&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Corporal&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_prefix_law:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Detective&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Inspector&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Investigator&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Captain&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Lieutenant&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Sergeant&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Inspector&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Commander&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Colonel&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Undersheriff&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Deputy&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Chief&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Commissioner&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Superintendent&quot;<\/span><span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;Sheriff&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_prefix_civilian:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Mr.&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Mrs.&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Mister&quot;<\/span><span style=\"color: #333333\">,<\/span><span style=\"background-color: #fff0f0\">&quot;Miss&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #888888\">\/\/the currently selected prefix and suffix<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_suffix:<span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">();<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_prefix:<span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">();<\/span>\r\n<span style=\"color: #888888\">\/\/above set to a default (on first run)<\/span>\r\narr_suffix <span style=\"color: #333333\">=<\/span> arr_suffix_civilian<span style=\"color: #333333\">;<\/span>\r\narr_prefix <span style=\"color: #333333\">=<\/span> arr_prefix_civilian<span style=\"color: #333333\">;<\/span>\r\n<span style=\"color: #888888\">\/\/to length of the text fields... otherwise just pass it a hard coded value<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> num_fnLength:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> int<span style=\"color: #333333\">(<\/span>txt_fncnt<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">text<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> num_lnLength:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> int<span style=\"color: #333333\">(<\/span>txt_lncnt<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">text<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #888888\">\/\/<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">generate_name<\/span><span style=\"color: #333333\">(<\/span>fnLength<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">,<\/span> lnLength<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">,<\/span> arrPrefix<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">,<\/span> arrSuffix<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">)<\/span>\r\n<span style=\"color: #333333\">{<\/span>\r\n\t<span style=\"color: #888888\">\/\/prefix and suffix part<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> randNumSuffix:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()*<\/span><span style=\"color: #0000DD; font-weight: bold\">100<\/span><span style=\"color: #333333\">);\/\/<\/span><span style=\"color: #008800; font-weight: bold\">if<\/span> bellow a certain number then yes show one\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> randSuffix:<span style=\"color: #333399; font-weight: bold\">String<\/span> <span style=\"color: #333333\">=<\/span> arrSuffix<span style=\"color: #333333\">[<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()*<\/span>arrSuffix<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">)-<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">];<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> randPrefix:<span style=\"color: #333399; font-weight: bold\">String<\/span> <span style=\"color: #333333\">=<\/span> arrPrefix<span style=\"color: #333333\">[<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()*<\/span>arrPrefix<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">)-<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">];<\/span>\r\n\t<span style=\"color: #888888\">\/\/the name part<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> firstName:<span style=\"color: #333399; font-weight: bold\">String<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"background-color: #fff0f0\">&quot;&quot;<\/span><span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> lastName:<span style=\"color: #333399; font-weight: bold\">String<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"background-color: #fff0f0\">&quot;&quot;<\/span><span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> fullName:<span style=\"color: #333399; font-weight: bold\">String<\/span><span style=\"color: #333333\">=<\/span> <span style=\"background-color: #fff0f0\">&quot;&quot;<\/span><span style=\"color: #333333\">;\/\/<\/span><span style=\"color: #008800; font-weight: bold\">this<\/span> will be returned<span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #888888\">\/\/regexp to strip out any spaces left <\/span>\r\n\t<span style=\"color: #888888\">\/\/if user doesn&#39;t want last\/first name (fnLength or lnLength are 0)<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> reg_trimSpaces:<span style=\"color: #333399; font-weight: bold\">RegExp<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #000000; background-color: #fff0ff\">\/^\\s+|\\s+$\/g<\/span><span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #888888\">\/\/randomize the vowel vs. consonant order (so the name starts with either or)<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_firstNameOrder:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span>arr_vowels<span style=\"color: #333333\">,<\/span>arr_cons<span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_lastNameOrder:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span>arr_vowels<span style=\"color: #333333\">,<\/span>arr_cons<span style=\"color: #333333\">);<\/span>\r\n\tarr_firstNameOrder <span style=\"color: #333333\">=<\/span> arr_firstNameOrder<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">sort<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">function<\/span><span style=\"color: #333333\">(){<\/span><span style=\"color: #008800; font-weight: bold\">return<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">round<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">());});<\/span>\r\n\tarr_lastNameOrder <span style=\"color: #333333\">=<\/span> arr_firstNameOrder<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">sort<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">function<\/span><span style=\"color: #333333\">(){<\/span><span style=\"color: #008800; font-weight: bold\">return<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">round<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">());});<\/span>\r\n\t<span style=\"color: #888888\">\/\/first name<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">for<\/span> <span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">var<\/span> i:<span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">=<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;<\/span> i<span style=\"color: #333333\">&lt;<\/span>fnlength <span style=\"color: #333333\">;<\/span> <span style=\"color: #333333\">++<\/span>i<span style=\"color: #333333\">)<\/span>\r\n\t<span style=\"color: #333333\">{<\/span>\r\n\t\tfirstName <span style=\"color: #333333\">+=<\/span>  arr_firstNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">][<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()<\/span> <span style=\"color: #333333\">*<\/span> arr_firstNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>length<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">-<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">]<\/span> <span style=\"color: #333333\">+<\/span> arr_firstNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">][<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()<\/span> <span style=\"color: #333333\">*<\/span> arr_firstNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">].<\/span>length<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">-<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">];<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n\t<span style=\"color: #888888\">\/\/last name<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">for<\/span> <span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">var<\/span> j:<span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">=<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;<\/span> j<span style=\"color: #333333\">&lt;<\/span>lnLength<span style=\"color: #333333\">;<\/span> <span style=\"color: #333333\">++<\/span>j<span style=\"color: #333333\">){<\/span>\r\n\t\tlastName <span style=\"color: #333333\">+=<\/span>  arr_lastNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">][<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()<\/span> <span style=\"color: #333333\">*<\/span> arr_lastNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>length<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">-<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">]<\/span> <span style=\"color: #333333\">+<\/span> arr_lastNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">][<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()<\/span> <span style=\"color: #333333\">*<\/span> arr_lastNameOrder<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">].<\/span>length<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">-<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">];<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n\t<span style=\"color: #888888\">\/\/edit so that ONLY the first letter of both names is uppercase (rest is lowercase)<\/span>\r\n\tfirstName <span style=\"color: #333333\">=<\/span> firstName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">substr<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">).<\/span>toUpperCase<span style=\"color: #333333\">()+<\/span>firstName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">substr<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">,<\/span> firstName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">).<\/span>toLowerCase<span style=\"color: #333333\">();<\/span> \r\n\tlastName <span style=\"color: #333333\">=<\/span> lastName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">substr<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">).<\/span>toUpperCase<span style=\"color: #333333\">()+<\/span>lastName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">substr<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">,<\/span> lastName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">).<\/span>toLowerCase<span style=\"color: #333333\">();<\/span>\r\n\t<span style=\"color: #888888\">\/\/if it should have a suffix (and append a suffix)<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>randNumSuffix<span style=\"color: #333333\">&amp;<\/span>lt<span style=\"color: #333333\">;<\/span><span style=\"color: #0000DD; font-weight: bold\">30<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\tfullName <span style=\"color: #333333\">=<\/span> randPrefix<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot; &quot;<\/span><span style=\"color: #333333\">+<\/span>firstName<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot; &quot;<\/span><span style=\"color: #333333\">+<\/span>lastName<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot; &quot;<\/span><span style=\"color: #333333\">+<\/span>randSuffix<span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #333333\">}<\/span><span style=\"color: #008800; font-weight: bold\">else<\/span><span style=\"color: #333333\">{<\/span>\r\n\t\tfullName <span style=\"color: #333333\">=<\/span> randPrefix<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot; &quot;<\/span><span style=\"color: #333333\">+<\/span>firstName<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot; &quot;<\/span><span style=\"color: #333333\">+<\/span>lastName<span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n\tfullName <span style=\"color: #333333\">=<\/span> fullName<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">replace<\/span><span style=\"color: #333333\">(<\/span>reg_trimSpaces<span style=\"color: #333333\">,<\/span> <span style=\"background-color: #fff0f0\">&quot;&quot;<\/span><span style=\"color: #333333\">);\/\/<\/span>strip out whitespaces\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">return<\/span> fullName<span style=\"color: #333333\">;<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n<\/pre>\n<\/div>\n<p>Here is a screenshot of what it will be used for:<br \/>\n<img decoding=\"async\" src=\"http:\/\/nathalielawhead.com\/noodles\/offender_2_namegen.jpg\" alt=\"\" \/><br \/>\n<em><a href=\"http:\/\/tetrageddon.com\" target=\"_blank\">Tetrageddon\u2019s<\/a> <del datetime=\"2014-03-19T06:09:52+00:00\">upcoming release<\/del> released <a href=\"http:\/\/offender2.alienmelon.com\" target=\"_blank\">Offender 2 (World War B: War on Rabbits)<\/a>.<br \/>\nThe Intergalactic Foundation for Non-Anthropomorphic Rights name registration form.<\/em><\/p>\n<p>Enjoy!<\/p>\n<p><strong>Update:<\/strong><\/p>\n<p>And for those that are interested, <a href=\"http:\/\/www.khanacademy.org\/cs\/wackynamegenerator\/1198802506\" target=\"_blank\">here&#8217;s a <strong>Javascript<\/strong> version of the above (By David Galloway). Click here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Wacky Name Generator (Version 1.0.0.0.1.0.2) Try it bellow: [swfobj src=&#8221;http:\/\/nathalielawhead.com\/sourcefiles\/Wacky_Name_Generator\/namegenerator.swf&#8221; height=&#8221;261&#8243; width=&#8221;500&#8243;] So I&#8217;m making a game! The premise is that you play a monster tearing up a fictional city. Any city really. Probably Tokyo, but I&#8217;m undecided. The other great premise is that you eat A LOT of civilians, military, and law enforcement officials. To add a touch of random (and reduce the time it takes for coming up with names for an &#8220;expendable&#8221; population), names for each enemy sprite are randomly created (in this case pieced together using a set amount of vowels and consonants), and then&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":4522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[30,12],"tags":[],"class_list":["post-2167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-games","category-resources"],"_links":{"self":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/2167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/comments?post=2167"}],"version-history":[{"count":15,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/2167\/revisions"}],"predecessor-version":[{"id":3024,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/2167\/revisions\/3024"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/media\/4522"}],"wp:attachment":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/media?parent=2167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/categories?post=2167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/tags?post=2167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}