Skip to content

Instantly share code, notes, and snippets.

@ericoporto

ericoporto/namegen.asc

Last active Nov 9, 2019
Embed
What would you like to do?
WIP
// Fantasy name generator AGS Module Script
#region CREATE_WORD_TABLES
//---- CREATE WORD TABLES -----------------------------
String _symbol_s[];
String _symbol_v[];
String _symbol_big_v[];
String _symbol_c[];
String _symbol_big_b[];
String _symbol_big_c[];
String _symbol_i[];
String _symbol_m[];
String _symbol_big_m[];
String _symbol_big_d[];
String _symbol_d[];
int _symbol_s_length = 115;
int _symbol_v_length = 6;
int _symbol_big_v_length = 22;
int _symbol_c_length = 21;
int _symbol_big_b_length = 43;
int _symbol_big_c_length = 36;
int _symbol_i_length = 47;
int _symbol_m_length = 43;
int _symbol_big_m_length = 23;
int _symbol_big_d_length = 21;
int _symbol_d_length = 36;
void _initialize_word_tables(){
_symbol_s = new String[_symbol_s_length];
_symbol_v = new String[_symbol_v_length];
_symbol_big_v = new String[_symbol_big_v_length];
_symbol_c = new String[_symbol_c_length];
_symbol_big_b = new String[_symbol_big_b_length];
_symbol_big_c = new String[_symbol_big_c_length];
_symbol_i = new String[_symbol_i_length];
_symbol_m = new String[_symbol_m_length];
_symbol_big_m = new String[_symbol_big_m_length];
_symbol_big_d = new String[_symbol_big_d_length];
_symbol_d = new String[_symbol_d_length];
_symbol_s[0] = "ach";
_symbol_s[1] = "ack";
_symbol_s[2] = "ad";
_symbol_s[3] = "age";
_symbol_s[4] = "ald";
_symbol_s[5] = "ale";
_symbol_s[6] = "an";
_symbol_s[7] = "ang";
_symbol_s[8] = "ar";
_symbol_s[9] = "ard";
_symbol_s[10] = "as";
_symbol_s[11] = "ash";
_symbol_s[12] = "at";
_symbol_s[13] = "ath";
_symbol_s[14] = "augh";
_symbol_s[15] = "aw";
_symbol_s[16] = "ban";
_symbol_s[17] = "bel";
_symbol_s[18] = "bur";
_symbol_s[19] = "cer";
_symbol_s[20] = "cha";
_symbol_s[21] = "che";
_symbol_s[22] = "dan";
_symbol_s[23] = "dar";
_symbol_s[24] = "del";
_symbol_s[25] = "den";
_symbol_s[26] = "dra";
_symbol_s[27] = "dyn";
_symbol_s[28] = "ech";
_symbol_s[29] = "eld";
_symbol_s[30] = "elm";
_symbol_s[31] = "em";
_symbol_s[32] = "en";
_symbol_s[33] = "end";
_symbol_s[34] = "eng";
_symbol_s[35] = "enth";
_symbol_s[36] = "er";
_symbol_s[37] = "ess";
_symbol_s[38] = "est";
_symbol_s[39] = "et";
_symbol_s[40] = "gar";
_symbol_s[41] = "gha";
_symbol_s[42] = "hat";
_symbol_s[43] = "hin";
_symbol_s[44] = "hon";
_symbol_s[45] = "ia";
_symbol_s[46] = "ight";
_symbol_s[47] = "ild";
_symbol_s[48] = "im";
_symbol_s[49] = "ina";
_symbol_s[50] = "ine";
_symbol_s[51] = "ing";
_symbol_s[52] = "ir";
_symbol_s[53] = "is";
_symbol_s[54] = "iss";
_symbol_s[55] = "it";
_symbol_s[56] = "kal";
_symbol_s[57] = "kel";
_symbol_s[58] = "kim";
_symbol_s[59] = "kin";
_symbol_s[60] = "ler";
_symbol_s[61] = "lor";
_symbol_s[62] = "lye";
_symbol_s[63] = "mor";
_symbol_s[64] = "mos";
_symbol_s[65] = "nal";
_symbol_s[66] = "ny";
_symbol_s[67] = "nys";
_symbol_s[68] = "old";
_symbol_s[69] = "om";
_symbol_s[70] = "on";
_symbol_s[71] = "or";
_symbol_s[72] = "orm";
_symbol_s[73] = "os";
_symbol_s[74] = "ough";
_symbol_s[75] = "per";
_symbol_s[76] = "pol";
_symbol_s[77] = "qua";
_symbol_s[78] = "que";
_symbol_s[79] = "rad";
_symbol_s[80] = "rak";
_symbol_s[81] = "ran";
_symbol_s[82] = "ray";
_symbol_s[83] = "ril";
_symbol_s[84] = "ris";
_symbol_s[85] = "rod";
_symbol_s[86] = "roth";
_symbol_s[87] = "ryn";
_symbol_s[88] = "sam";
_symbol_s[89] = "say";
_symbol_s[90] = "ser";
_symbol_s[91] = "shy";
_symbol_s[92] = "skel";
_symbol_s[93] = "sul";
_symbol_s[94] = "tai";
_symbol_s[95] = "tan";
_symbol_s[96] = "tas";
_symbol_s[97] = "ther";
_symbol_s[98] = "tia";
_symbol_s[99] = "tin";
_symbol_s[100] = "ton";
_symbol_s[101] = "tor";
_symbol_s[102] = "tur";
_symbol_s[103] = "um";
_symbol_s[104] = "und";
_symbol_s[105] = "unt";
_symbol_s[106] = "urn";
_symbol_s[107] = "usk";
_symbol_s[108] = "ust";
_symbol_s[109] = "ver";
_symbol_s[110] = "ves";
_symbol_s[111] = "vor";
_symbol_s[112] = "war";
_symbol_s[113] = "wor";
_symbol_s[114] = "yer";
_symbol_v[0] = "a";
_symbol_v[1] = "e";
_symbol_v[2] = "i";
_symbol_v[3] = "o";
_symbol_v[4] = "u";
_symbol_v[5] = "y";
_symbol_big_v[0] = "a";
_symbol_big_v[1] = "e";
_symbol_big_v[2] = "i";
_symbol_big_v[3] = "o";
_symbol_big_v[4] = "u";
_symbol_big_v[5] = "y";
_symbol_big_v[6] = "ae";
_symbol_big_v[7] = "ai";
_symbol_big_v[8] = "au";
_symbol_big_v[9] = "ay";
_symbol_big_v[10] = "ea";
_symbol_big_v[11] = "ee";
_symbol_big_v[12] = "ei";
_symbol_big_v[13] = "eu";
_symbol_big_v[14] = "ey";
_symbol_big_v[15] = "ia";
_symbol_big_v[16] = "ie";
_symbol_big_v[17] = "oe";
_symbol_big_v[18] = "oi";
_symbol_big_v[19] = "oo";
_symbol_big_v[20] = "ou";
_symbol_big_v[21] = "ui";
_symbol_c[0] = "b";
_symbol_c[1] = "c";
_symbol_c[2] = "d";
_symbol_c[3] = "f";
_symbol_c[4] = "g";
_symbol_c[5] = "h";
_symbol_c[6] = "j";
_symbol_c[7] = "k";
_symbol_c[8] = "l";
_symbol_c[9] = "m";
_symbol_c[10] = "n";
_symbol_c[11] = "p";
_symbol_c[12] = "q";
_symbol_c[13] = "r";
_symbol_c[14] = "s";
_symbol_c[15] = "t";
_symbol_c[16] = "v";
_symbol_c[17] = "w";
_symbol_c[18] = "x";
_symbol_c[19] = "y";
_symbol_c[20] = "z";
_symbol_big_b[0] = "b";
_symbol_big_b[1] = "bl";
_symbol_big_b[2] = "br";
_symbol_big_b[3] = "c";
_symbol_big_b[4] = "ch";
_symbol_big_b[5] = "chr";
_symbol_big_b[6] = "cl";
_symbol_big_b[7] = "cr";
_symbol_big_b[8] = "d";
_symbol_big_b[9] = "dr";
_symbol_big_b[10] = "f";
_symbol_big_b[11] = "g";
_symbol_big_b[12] = "h";
_symbol_big_b[13] = "j";
_symbol_big_b[14] = "k";
_symbol_big_b[15] = "l";
_symbol_big_b[16] = "ll";
_symbol_big_b[17] = "m";
_symbol_big_b[18] = "n";
_symbol_big_b[19] = "p";
_symbol_big_b[20] = "ph";
_symbol_big_b[21] = "qu";
_symbol_big_b[22] = "r";
_symbol_big_b[23] = "rh";
_symbol_big_b[24] = "s";
_symbol_big_b[25] = "sch";
_symbol_big_b[26] = "sh";
_symbol_big_b[27] = "sl";
_symbol_big_b[28] = "sm";
_symbol_big_b[29] = "sn";
_symbol_big_b[30] = "st";
_symbol_big_b[31] = "str";
_symbol_big_b[32] = "sw";
_symbol_big_b[33] = "t";
_symbol_big_b[34] = "th";
_symbol_big_b[35] = "thr";
_symbol_big_b[36] = "tr";
_symbol_big_b[37] = "v";
_symbol_big_b[38] = "w";
_symbol_big_b[39] = "wh";
_symbol_big_b[40] = "y";
_symbol_big_b[41] = "z";
_symbol_big_b[42] = "zh";
_symbol_big_c[0] = "b";
_symbol_big_c[1] = "c";
_symbol_big_c[2] = "ch";
_symbol_big_c[3] = "ck";
_symbol_big_c[4] = "d";
_symbol_big_c[5] = "f";
_symbol_big_c[6] = "g";
_symbol_big_c[7] = "gh";
_symbol_big_c[8] = "h";
_symbol_big_c[9] = "k";
_symbol_big_c[10] = "l";
_symbol_big_c[11] = "ld";
_symbol_big_c[12] = "ll";
_symbol_big_c[13] = "lt";
_symbol_big_c[14] = "m";
_symbol_big_c[15] = "n";
_symbol_big_c[16] = "nd";
_symbol_big_c[17] = "nn";
_symbol_big_c[18] = "nt";
_symbol_big_c[19] = "p";
_symbol_big_c[20] = "ph";
_symbol_big_c[21] = "q";
_symbol_big_c[22] = "r";
_symbol_big_c[23] = "rd";
_symbol_big_c[24] = "rr";
_symbol_big_c[25] = "rt";
_symbol_big_c[26] = "s";
_symbol_big_c[27] = "sh";
_symbol_big_c[28] = "ss";
_symbol_big_c[29] = "st";
_symbol_big_c[30] = "t";
_symbol_big_c[31] = "th";
_symbol_big_c[32] = "v";
_symbol_big_c[33] = "w";
_symbol_big_c[34] = "y";
_symbol_big_c[35] = "z";
_symbol_i[0] = "air";
_symbol_i[1] = "ankle";
_symbol_i[2] = "ball";
_symbol_i[3] = "beef";
_symbol_i[4] = "bone";
_symbol_i[5] = "bum";
_symbol_i[6] = "bumble";
_symbol_i[7] = "bump";
_symbol_i[8] = "cheese";
_symbol_i[9] = "clod";
_symbol_i[10] = "clot";
_symbol_i[11] = "clown";
_symbol_i[12] = "corn";
_symbol_i[13] = "dip";
_symbol_i[14] = "dolt";
_symbol_i[15] = "doof";
_symbol_i[16] = "dork";
_symbol_i[17] = "dumb";
_symbol_i[18] = "face";
_symbol_i[19] = "finger";
_symbol_i[20] = "foot";
_symbol_i[21] = "fumble";
_symbol_i[22] = "goof";
_symbol_i[23] = "grumble";
_symbol_i[24] = "head";
_symbol_i[25] = "knock";
_symbol_i[26] = "knocker";
_symbol_i[27] = "knuckle";
_symbol_i[28] = "loaf";
_symbol_i[29] = "lump";
_symbol_i[30] = "lunk";
_symbol_i[31] = "meat";
_symbol_i[32] = "muck";
_symbol_i[33] = "munch";
_symbol_i[34] = "nit";
_symbol_i[35] = "numb";
_symbol_i[36] = "pin";
_symbol_i[37] = "puff";
_symbol_i[38] = "skull";
_symbol_i[39] = "snark";
_symbol_i[40] = "sneeze";
_symbol_i[41] = "thimble";
_symbol_i[42] = "twerp";
_symbol_i[43] = "twit";
_symbol_i[44] = "wad";
_symbol_i[45] = "wimp";
_symbol_i[46] = "wipe";
_symbol_m[0] = "baby";
_symbol_m[1] = "booble";
_symbol_m[2] = "bunker";
_symbol_m[3] = "cuddle";
_symbol_m[4] = "cuddly";
_symbol_m[5] = "cutie";
_symbol_m[6] = "doodle";
_symbol_m[7] = "foofie";
_symbol_m[8] = "gooble";
_symbol_m[9] = "honey";
_symbol_m[10] = "kissie";
_symbol_m[11] = "lover";
_symbol_m[12] = "lovey";
_symbol_m[13] = "moofie";
_symbol_m[14] = "mooglie";
_symbol_m[15] = "moopie";
_symbol_m[16] = "moopsie";
_symbol_m[17] = "nookum";
_symbol_m[18] = "poochie";
_symbol_m[19] = "poof";
_symbol_m[20] = "poofie";
_symbol_m[21] = "pookie";
_symbol_m[22] = "schmoopie";
_symbol_m[23] = "schnoogle";
_symbol_m[24] = "schnookie";
_symbol_m[25] = "schnookum";
_symbol_m[26] = "smooch";
_symbol_m[27] = "smoochie";
_symbol_m[28] = "smoosh";
_symbol_m[29] = "snoogle";
_symbol_m[30] = "snoogy";
_symbol_m[31] = "snookie";
_symbol_m[32] = "snookum";
_symbol_m[33] = "snuggy";
_symbol_m[34] = "sweetie";
_symbol_m[35] = "woogle";
_symbol_m[36] = "woogy";
_symbol_m[37] = "wookie";
_symbol_m[38] = "wookum";
_symbol_m[39] = "wuddle";
_symbol_m[40] = "wuddly";
_symbol_m[41] = "wuggy";
_symbol_m[42] = "wunny";
_symbol_big_m[0] = "boo";
_symbol_big_m[1] = "bunch";
_symbol_big_m[2] = "bunny";
_symbol_big_m[3] = "cake";
_symbol_big_m[4] = "cakes";
_symbol_big_m[5] = "cute";
_symbol_big_m[6] = "darling";
_symbol_big_m[7] = "dumpling";
_symbol_big_m[8] = "dumplings";
_symbol_big_m[9] = "face";
_symbol_big_m[10] = "foof";
_symbol_big_m[11] = "goo";
_symbol_big_m[12] = "head";
_symbol_big_m[13] = "kin";
_symbol_big_m[14] = "kins";
_symbol_big_m[15] = "lips";
_symbol_big_m[16] = "love";
_symbol_big_m[17] = "mush";
_symbol_big_m[18] = "pie";
_symbol_big_m[19] = "poo";
_symbol_big_m[20] = "pooh";
_symbol_big_m[21] = "pook";
_symbol_big_m[22] = "pums";
_symbol_big_d[0] = "b";
_symbol_big_d[1] = "bl";
_symbol_big_d[2] = "br";
_symbol_big_d[3] = "cl";
_symbol_big_d[4] = "d";
_symbol_big_d[5] = "f";
_symbol_big_d[6] = "fl";
_symbol_big_d[7] = "fr";
_symbol_big_d[8] = "g";
_symbol_big_d[9] = "gh";
_symbol_big_d[10] = "gl";
_symbol_big_d[11] = "gr";
_symbol_big_d[12] = "h";
_symbol_big_d[13] = "j";
_symbol_big_d[14] = "k";
_symbol_big_d[15] = "kl";
_symbol_big_d[16] = "m";
_symbol_big_d[17] = "n";
_symbol_big_d[18] = "p";
_symbol_big_d[19] = "th";
_symbol_big_d[20] = "w";
_symbol_d[0] = "elch";
_symbol_d[1] = "idiot";
_symbol_d[2] = "ob";
_symbol_d[3] = "og";
_symbol_d[4] = "ok";
_symbol_d[5] = "olph";
_symbol_d[6] = "olt";
_symbol_d[7] = "omph";
_symbol_d[8] = "ong";
_symbol_d[9] = "onk";
_symbol_d[10] = "oo";
_symbol_d[11] = "oob";
_symbol_d[12] = "oof";
_symbol_d[13] = "oog";
_symbol_d[14] = "ook";
_symbol_d[15] = "ooz";
_symbol_d[16] = "org";
_symbol_d[17] = "ork";
_symbol_d[18] = "orm";
_symbol_d[19] = "oron";
_symbol_d[20] = "ub";
_symbol_d[21] = "uck";
_symbol_d[22] = "ug";
_symbol_d[23] = "ulf";
_symbol_d[24] = "ult";
_symbol_d[25] = "um";
_symbol_d[26] = "umb";
_symbol_d[27] = "ump";
_symbol_d[28] = "umph";
_symbol_d[29] = "un";
_symbol_d[30] = "unb";
_symbol_d[31] = "ung";
_symbol_d[32] = "unk";
_symbol_d[33] = "unph";
_symbol_d[34] = "unt";
_symbol_d[35] = "uzz";
}
//---- END CREATE WORD TABLES --------------------------
#endregion //CREATE_WORD_TABLES
int _generative_length(String achar){
if(achar == "s") return _symbol_s_length;
if(achar == "v") return _symbol_v_length;
if(achar == "V") return _symbol_big_v_length;
if(achar == "c") return _symbol_c_length;
if(achar == "B") return _symbol_big_b_length;
if(achar == "C") return _symbol_big_c_length;
if(achar == "i") return _symbol_i_length;
if(achar == "m") return _symbol_m_length;
if(achar == "M") return _symbol_big_m_length;
if(achar == "D") return _symbol_big_d_length;
if(achar == "d") return _symbol_d_length;
return 0;
}
String[] _generative(String achar){
if(achar == "s") return _symbol_s;
if(achar == "v") return _symbol_v;
if(achar == "V") return _symbol_big_v;
if(achar == "c") return _symbol_c;
if(achar == "B") return _symbol_big_b;
if(achar == "C") return _symbol_big_c;
if(achar == "i") return _symbol_i;
if(achar == "m") return _symbol_m;
if(achar == "M") return _symbol_big_m;
if(achar == "D") return _symbol_big_d;
if(achar == "d") return _symbol_d;
return null;
}
// Returns a new string with the first character capitalized.
String _capitalize(String strPiece){
if(strPiece.Length<1){
return "";
} else if(strPiece.Length==1){
return strPiece.UpperCase();
}
String first_letter = strPiece.Substring(0, 1);
String rest_of_string = strPiece.Substring(1, strPiece.Length - 1);
first_letter = first_letter.UpperCase();
return first_letter.Append(rest_of_string);
}
// Fantasy name generator AGS Module Header
// This is free and unencumbered software released into the public domain.
//
// The compile() function creates a name generator based on an input
// pattern. The letters s, v, V, c, B, C, i, m, M, D, and d represent
// different types of random replacements. Everything else is emitted
// literally.
//
// s - generic syllable
// v - vowel
// V - vowel or vowel combination
// c - consonant
// B - consonant or consonant combination suitable for beginning a word
// C - consonant or consonant combination suitable anywhere in a word
// i - insult
// m - mushy name
// M - mushy name ending
// D - consonant suited for a stupid person's name
// d - syllable suited for a stupid person's name (begins with a vowel)
//
// All characters between parenthesis () are emitted literally. For
// example, the pattern "s(dim)", emits a random generic syllable
// followed by "dim".
//
// Characters between angle brackets <> emit patterns from the table
// above. Imagine the entire pattern is wrapped in one of these.
//
// In both types of groupings, a vertical bar | denotes a random choice.
// Empty groups are allowed. For example, "(foo|bar)" emits either "foo"
// or "bar". The pattern "<c|v|>" emits a consonant, vowel, or nothing at
// all.
//
// An exclamation point ! means to capitalize the component that follows
// it. For example, "!(foo)" will emit "Foo" and "v!s" will emit a
// lowercase vowel followed by a capitalized syllable, like "eRod".
//
// This library is based on the RinkWorks Fantasy Name Generator.
// http://www.rinkworks.com/namegen/
//
// Return codes
enum NameGenReturnCodes {
eNameGenSuccess=0,
eNameGenTruncated, /* Output was truncated */
eNameGenInvalid, /* Pattern is invalid */
eNameGenTooDeep, /* Pattern exceeds maximum nesting depth */
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment