MediaWiki:Zerospace EN.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 287: | Line 287: | ||
{ | { | ||
exotic_alien_type += ' android'; | exotic_alien_type += ' android'; | ||
} | |||
else | |||
{ | |||
exotic_alien_type += ' alien'; | |||
} | } | ||
Line 318: | Line 322: | ||
{ | { | ||
exotic_alien_type += ' android'; | exotic_alien_type += ' android'; | ||
} | |||
else | |||
{ | |||
exotic_alien_type += ' alien'; | |||
} | } | ||
Revision as of 19:05, 26 April 2018
var imperial_alien_id = new Array();
imperial_alien_id['head_structure'] = new Array();
imperial_alien_id['skin_tone'] = new Array();
imperial_alien_id['skin_color'] = new Array();
// imperial_alien_id['text']
// imperial_alien_id['organic']
// 0 = android
// 1 = organic
// 2 = synthetic
// imperial_alien_id['subtype_artifical']
// 1 = obvious
// 2 = lifelike
// imperial_alien_id['type']
// 1 = humanoid
// 2 = anthropomorphic animal
// 3 = anthropomorphic plant
// 4 = insectoid
// 10 = uncommon
// 11 = colonial
// 12 = crystalline
// 13 = cybernetic
// 14 = gaseous
// 15 = myconoid
// 16 = viscous fluid
// imperial_alien_id['subtype_animal']
// 0 = none
// 1 = avian
// 2 = canine
// 3 = cephalopod
// 4 = feline
// 5 = mustelid
// 6 = reptilian
// imperial_alien_id['symmetry']
// 1 = dendriform bilateral
// 2 = globular bilateral
// 3 = serpentine bilateral
// 4 = dendriform radial
// 5 = globular radial
// 6 = serpentine radial
// imperial_alien_id['hair']
// 0 = hairless
// 1 = hair
// 2 = feathers
// 3 = cilia
// imperial_alien_id['head_structure'][0]
// imperial_alien_id['head_structure'][1]
// 0 = none
// 1 = antennae
// 2 = brow ridges
// 3 = cranial ridges
// 4 = horns
// 5 = pointed ears
// 6 = tentacles
// imperial_alien_id['skin_tone'][0]
// imperial_alien_id['skin_tone'][1]
// 1 = colorless
// 2 = pale
// 3 = light
// 4 = medium
// 5 = deep
// 6 = dark
// 9 = absolute
// imperial_alien_id['skin_color'][0]
// imperial_alien_id['skin_color'][1]
// 1 = white
// 2 = red
// 3 = brown
// 4 = yellow
// 5 = green
// 6 = blue
// 9 = grey
// 10 = black
// imperial_alien_id['eye_type']
// 1 = circular pupil
// 2 = horizontally slit pupil
// 3 = vertically slit pupil
// 4 = pupilless
// 5 = solid color
// 6 = compound
function roll_dice(dice_size, dice_count)
{
dice_size = typeof dice_size !== 'undefined' ? dice_size : 6;
dice_count = typeof dice_count !== 'undefined' ? dice_count : 1;
var dice_total = 0;
for (i = 0; i < dice_count; i++)
{
dice_total += Math.floor((Math.random() * dice_size) + 1);
}
return dice_total;
}
function random_character()
{
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
var rnum = Math.floor(Math.random() * chars.length);
var random_character = chars.substring(rnum, rnum+1);
return random_character;
}
function get_android_model()
{
var android_model = '';
var dice_size = 3;
var dice_count = 6;
var android_model_prefix_roll = roll_dice(dice_size, dice_count);
var android_model_prefix_length = Math.floor((android_model_prefix_roll - 2)/6) + 1;
var android_model_suffix_roll = roll_dice(dice_size, dice_count);
var android_model_suffix_length = Math.floor((android_model_suffix_roll - 2)/6) + 1;
for (i = 0; i < android_model_prefix_length; i++)
{
android_model += random_character();
}
android_model += '-';
for (i = 0; i < android_model_suffix_length; i++)
{
android_model += random_character();
}
return android_model;
}
function get_exotic_alien_symmetry(android)
{
android = typeof android !== 'undefined' ? android : false;
var exotic_alien_symmetry;
var organism_type = 'alien';
var dice_size = 6;
var dice_count = 1;
var exotic_alien_symmetry_roll = roll_dice(dice_size, dice_count);
if (android)
{
organism_type = 'android';
}
switch (exotic_alien_symmetry_roll)
{
case 1:
imperial_alien_id['symmetry'] = 1; // dendriform bilateral
exotic_alien_symmetry = 'dendriform ' + organism_type + ' with bilateral symmetry';
break;
case 2:
imperial_alien_id['symmetry'] = 4; // dendriform radial
exotic_alien_symmetry = 'dendriform ' + organism_type + ' with radial symmetry';
break;
case 3:
imperial_alien_id['symmetry'] = 2; // globular bilateral
exotic_alien_symmetry = 'globular ' + organism_type + ' with bilateral symmetry';
break;
case 4:
imperial_alien_id['symmetry'] = 5; // globular radial
exotic_alien_symmetry = 'globular ' + organism_type + ' with radial symmetry';
break;
case 5:
imperial_alien_id['symmetry'] = 3; // serpentine bilateral
exotic_alien_symmetry = 'serpentine ' + organism_type + ' with bilateral symmetry';
break;
case 6:
imperial_alien_id['symmetry'] = 6; // serpentine radial
exotic_alien_symmetry = 'serpentine ' + organism_type + ' with radial symmetry';
}
return exotic_alien_symmetry;
}
function get_exotic_alien_animal()
{
var exotic_alien_animal;
var dice_size = 6;
var dice_count = 1;
var exotic_alien_animal_roll = roll_dice(dice_size, dice_count);
switch (exotic_alien_animal_roll)
{
case 1:
imperial_alien_id['subtype_animal'] = 1;
exotic_alien_animal = "avian";
break;
case 2:
imperial_alien_id['subtype_animal'] = 2;
exotic_alien_animal = "canine";
break;
case 3:
imperial_alien_id['subtype_animal'] = 3;
exotic_alien_animal = "cephalopod";
break;
case 4:
imperial_alien_id['subtype_animal'] = 4;
exotic_alien_animal = "feline";
break;
case 5:
imperial_alien_id['subtype_animal'] = 5;
exotic_alien_animal = "mustelid";
break;
case 6:
imperial_alien_id['subtype_animal'] = 6;
exotic_alien_animal = "reptilian";
}
return exotic_alien_animal;
}
function get_exotic_alien_weird_biology()
{
var exotic_alien_weird_biology;
var dice_size = 6;
var dice_count = 1;
var exotic_alien_weird_biology_roll = roll_dice(dice_size, dice_count);
var exotic_alien_symmetry;
switch (exotic_alien_weird_biology_roll)
{
case 1:
imperial_alien_id['type'] = 11; // colonial
exotic_alien_weird_biology = "colonial";
exotic_alien_symmetry = get_exotic_alien_symmetry();
exotic_alien_weird_biology += ' ' + exotic_alien_symmetry;
break;
case 2:
imperial_alien_id['type'] = 12; // crystalline
exotic_alien_weird_biology = "crystalline";
exotic_alien_symmetry = get_exotic_alien_symmetry();
exotic_alien_weird_biology += ' ' + exotic_alien_symmetry;
break;
case 3:
imperial_alien_id['type'] = 13; // cybernetic
exotic_alien_weird_biology = "cybernetic";
exotic_alien_symmetry = get_exotic_alien_symmetry();
exotic_alien_weird_biology += ' ' + exotic_alien_symmetry;
break;
case 4:
imperial_alien_id['type'] = 14; // gaseous
exotic_alien_weird_biology = "gaseous alien";
break;
case 5:
imperial_alien_id['type'] = 15; // myconoid
exotic_alien_weird_biology = "myconoid";
exotic_alien_symmetry = get_exotic_alien_symmetry();
exotic_alien_weird_biology += ' ' + exotic_alien_symmetry;
break;
case 6:
imperial_alien_id['type'] = 16; // viscous fluid
exotic_alien_weird_biology = "viscous fluid alien";
}
return exotic_alien_weird_biology;
}
function get_exotic_alien_type(android)
{
android = typeof android !== 'undefined' ? android : false;
var exotic_alien_type;
var dice_size = 6;
var dice_count = 1;
if (android)
{
dice_size = 5;
}
var exotic_alien_type_roll = roll_dice(dice_size, dice_count);
var exotic_alien_animal;
var exotic_alien_symmetry;
switch (exotic_alien_type_roll)
{
case 1:
imperial_alien_id['type'] = 1; // humanoid
exotic_alien_animal = get_exotic_alien_animal();
exotic_alien_type = exotic_alien_animal + "-headed humanoid";
if (android)
{
exotic_alien_type += ' android';
}
else
{
exotic_alien_type += ' alien';
}
break;
case 2:
imperial_alien_id['type'] = 2; // anthropomorphic animal
exotic_alien_animal = get_exotic_alien_animal();
exotic_alien_type = "anthropomorphic " + exotic_alien_animal;
if (android)
{
exotic_alien_type += ' android';
}
break;
case 3:
imperial_alien_id['type'] = 3; // anthropomorphic plant
exotic_alien_type = "anthropomorphic plant";
if (android)
{
exotic_alien_type += ' android';
}
break;
case 4:
imperial_alien_id['type'] = 4; // insectoid
exotic_alien_type = "insectoid";
if (android)
{
exotic_alien_type += ' android';
}
else
{
exotic_alien_type += ' alien';
}
break;
case 5:
imperial_alien_id['type'] = 10; // uncommon
exotic_alien_symmetry = get_exotic_alien_symmetry(android);
exotic_alien_type = exotic_alien_symmetry;
break;
case 6:
exotic_alien_type = get_exotic_alien_weird_biology();
}
return exotic_alien_type;
}
function get_alien_type()
{
var alien_type;
var dice_size = 6;
var dice_count = 3;
var alien_type_roll = roll_dice(dice_size, dice_count);
var exotic_alien_type;
if (alien_type_roll <= 13)
{
imperial_alien_id['type'] = 1; // humanoid
imperial_alien_id['organic'] = 1; // organic
alien_type = 'humanoid alien';
}
else if (alien_type_roll <= 15)
{
imperial_alien_id['organic'] = 0; // android
imperial_alien_id['subtype_artifical'] = 1; // obvious
dice_size = 100;
dice_count = 1;
var android_type_roll = roll_dice(dice_size, dice_count);
if (android_type_roll <= 50)
{
imperial_alien_id['type'] = 1; // humanoid
alien_type = 'humanoid android';
}
else if (android_type_roll <= 55)
{
imperial_alien_id['type'] = 1; // humanoid
imperial_alien_id['subtype_artifical'] = 2; // lifelike
alien_type = 'lifelike humanoid android';
}
else if (android_type_roll <= 99)
{
exotic_alien_type = get_exotic_alien_type(true);
alien_type = exotic_alien_type;
}
else
{
imperial_alien_id['subtype_artifical'] = 2; // lifelike
exotic_alien_type = get_exotic_alien_type(true);
alien_type = 'lifelike ' + exotic_alien_type;
}
}
else
{
imperial_alien_id['organic'] = 1; // organic
exotic_alien_type = get_exotic_alien_type();
alien_type = exotic_alien_type;
}
return alien_type;
}
function is_alien_skin_patterned()
{
var alien_skin_patterned = false;
var dice_size = 6;
var dice_count = 1;
var alien_skin_patterned_roll = roll_dice(dice_size, dice_count);
if (alien_skin_patterned_roll == 6)
{
var alien_skin_patterned = true;
}
return alien_skin_patterned;
}
function get_alien_skin_intensity(secondary)
{
secondary = typeof secondary !== 'undefined' ? secondary : false;
var alien_skin_intensity;
var dice_size = 5;
var dice_count = 1;
var alien_skin_intensity_roll = roll_dice(dice_size, dice_count);
var imperial_index = secondary ? 1 : 0;
switch (alien_skin_intensity_roll)
{
case 1:
imperial_alien_id['skin_tone'][imperial_index] = 2; // pale
alien_skin_intensity = "pale";
break;
case 2:
imperial_alien_id['skin_tone'][imperial_index] = 3; // light
alien_skin_intensity = "light";
break;
case 3:
imperial_alien_id['skin_tone'][imperial_index] = 4; // medium
alien_skin_intensity = "medium";
break;
case 4:
imperial_alien_id['skin_tone'][imperial_index] = 5; // deep
alien_skin_intensity = "deep";
break;
case 5:
imperial_alien_id['skin_tone'][imperial_index] = 6; // dark
alien_skin_intensity = "dark";
break;
}
return alien_skin_intensity;
}
function get_alien_skin_color(secondary)
{
secondary = typeof secondary !== 'undefined' ? secondary : false;
var alien_skin_color;
var dice_size = 6;
var dice_count = 1;
var alien_skin_color_roll = roll_dice(dice_size, dice_count);
var imperial_index = secondary ? 1 : 0;
switch (alien_skin_color_roll)
{
case 1:
imperial_alien_id['skin_color'][imperial_index] = 6; // blue
alien_skin_color = "blue";
break;
case 2:
imperial_alien_id['skin_color'][imperial_index] = 3; // brown
alien_skin_color = "brown";
break;
case 3:
imperial_alien_id['skin_color'][imperial_index] = 5; // green
alien_skin_color = "green";
break;
case 4:
imperial_alien_id['skin_color'][imperial_index] = 9; // grey
alien_skin_color = "grey";
break;
case 5:
imperial_alien_id['skin_color'][imperial_index] = 2; // red
alien_skin_color = "red";
break;
case 6:
imperial_alien_id['skin_color'][imperial_index] = 4; // yellow
alien_skin_color = "yellow";
}
return alien_skin_color;
}
function get_alien_skin_combo(secondary)
{
secondary = typeof secondary !== 'undefined' ? secondary : false;
var alien_skin_combo;
var dice_size = 2;
var dice_count = 1;
var increase_contrast_roll = roll_dice(dice_size, dice_count);
var increase_contrast;
var imperial_index = secondary ? 1 : 0;
alien_skin_intensity = get_alien_skin_intensity(secondary);
alien_skin_color = get_alien_skin_color(secondary);
if (increase_contrast_roll == 1)
{
increase_contrast = true;
}
else
{
increase_contrast = false;
}
if (increase_contrast && alien_skin_color == "grey")
{
if (alien_skin_intensity == "pale")
{
imperial_alien_id['skin_tone'][imperial_index] = 1; // colorless
alien_skin_intensity = "snow";
imperial_alien_id['skin_color'][imperial_index] = 1; // white
alien_skin_color = "white";
}
else if (alien_skin_intensity == "dark")
{
imperial_alien_id['skin_tone'][imperial_index] = 10; // absolute
alien_skin_intensity = "pitch";
imperial_alien_id['skin_color'][imperial_index] = 10; // black
alien_skin_color = "black";
}
}
alien_skin_combo = alien_skin_intensity + " " + alien_skin_color;
return alien_skin_combo;
}
function get_alien_skin()
{
var alien_skin;
var alien_skin_2;
var has_alien_skin_patterned = is_alien_skin_patterned();
if (has_alien_skin_patterned)
{
alien_skin = get_alien_skin_combo();
alien_skin_2 = alien_skin;
while (alien_skin_2 == alien_skin)
{
alien_skin_2 = get_alien_skin_combo(true);
}
alien_skin += " and " + alien_skin_2 + " pattern";
}
else
{
alien_skin = get_alien_skin_combo();
}
return alien_skin;
}
function get_alien_eyes_type()
{
var alien_eyes_type;
var dice_size = 6;
var dice_count = 1;
var alien_eyes_type_roll = roll_dice(dice_size, dice_count);
switch (alien_eyes_type_roll)
{
case 1:
imperial_alien_id['eye_type'] = 1; // circular pupil
alien_eyes_type = "circular pupil";
break;
case 2:
imperial_alien_id['eye_type'] = 2; // horizontally slit pupil
alien_eyes_type = "horizontally slit pupil";
break;
case 3:
imperial_alien_id['eye_type'] = 3; // vertically slit pupil
alien_eyes_type = "vertically slit pupil";
break;
case 4:
imperial_alien_id['eye_type'] = 4; // pupilless
alien_eyes_type = "pupilless";
break;
case 5:
imperial_alien_id['eye_type'] = 5; // solid color
alien_eyes_type = "solid color";
break;
case 6:
imperial_alien_id['eye_type'] = 6; // compound
alien_eyes_type = "compound";
}
return alien_eyes_type;
}
function get_alien_eyes_intensity()
{
var alien_eyes_intensity;
var dice_size = 6;
var dice_count = 1;
var alien_eyes_intensity_roll = roll_dice(dice_size, dice_count);
switch (alien_eyes_intensity_roll)
{
case 1:
alien_eyes_intensity = "pale";
break;
case 2:
alien_eyes_intensity = "light";
break;
case 3:
alien_eyes_intensity = "medium";
break;
case 4:
alien_eyes_intensity = "deep";
break;
case 5:
alien_eyes_intensity = "dark";
break;
case 6:
alien_eyes_intensity = "glowing";
}
return alien_eyes_intensity;
}
function get_alien_eyes_color()
{
var alien_eyes_color;
var dice_size = 6;
var dice_count = 1;
var alien_eyes_color_roll = roll_dice(dice_size, dice_count);
switch (alien_eyes_color_roll)
{
case 1:
alien_eyes_color = "blue";
break;
case 2:
alien_eyes_color = "brown";
break;
case 3:
alien_eyes_color = "green";
break;
case 4:
alien_eyes_color = "grey";
break;
case 5:
alien_eyes_color = "red";
break;
case 6:
alien_eyes_color = "yellow";
}
return alien_eyes_color;
}
function get_alien_eyes()
{
var alien_eyes;
var dice_size = 2;
var dice_count = 1;
var increase_contrast_roll = roll_dice(dice_size, dice_count);
var increase_contrast;
alien_eyes_type = get_alien_eyes_type();
alien_eyes_intensity = get_alien_eyes_intensity();
alien_eyes_color = get_alien_eyes_color();
if (increase_contrast_roll == 1)
{
increase_contrast = true;
}
else
{
increase_contrast = false;
}
if (increase_contrast && alien_eyes_color == "grey")
{
if (alien_eyes_intensity == "pale")
{
alien_eyes_intensity = "snow";
alien_eyes_color = "white";
}
else if (alien_eyes_intensity == "dark")
{
alien_eyes_intensity = "pitch";
alien_eyes_color = "black";
}
}
alien_eyes = alien_eyes_intensity + " " + alien_eyes_color + ", " + alien_eyes_type;
return alien_eyes;
}
function get_alien_humanoid_head_structure()
{
var dice_size = 6;
var dice_count = 1;
var alien_humanoid_head_structure_roll = roll_dice(dice_size, dice_count);
var alien_humanoid_head_structure_text;
switch (alien_humanoid_head_structure_roll)
{
case 1:
alien_humanoid_head_structure_text = "antennae";
break;
case 2:
alien_humanoid_head_structure_text = "brow ridges";
break;
case 3:
alien_humanoid_head_structure_text = "cranial ridges";
break;
case 4:
alien_humanoid_head_structure_text = "horns";
break;
case 5:
alien_humanoid_head_structure_text = "pointed ears";
break;
case 6:
alien_humanoid_head_structure_text = "tentacles";
}
var alien_humanoid_head_structure = new Array();
alien_humanoid_head_structure['id'] = alien_humanoid_head_structure_roll;
alien_humanoid_head_structure['text'] = alien_humanoid_head_structure_text;
return alien_humanoid_head_structure;
}
function get_alien_humanoid_head_hair_intensity()
{
var alien_humanoid_head_hair_intensity;
var dice_size = 6;
var dice_count = 1;
var alien_humanoid_head_hair_intensity_roll = roll_dice(dice_size, dice_count);
switch (alien_humanoid_head_hair_intensity_roll)
{
case 1:
alien_humanoid_head_hair_intensity = "pale";
break;
case 2:
alien_humanoid_head_hair_intensity = "light";
break;
case 3:
alien_humanoid_head_hair_intensity = "medium";
break;
case 4:
alien_humanoid_head_hair_intensity = "deep";
break;
case 5:
alien_humanoid_head_hair_intensity = "dark";
break;
case 6:
alien_humanoid_head_hair_intensity = "bright";
}
return alien_humanoid_head_hair_intensity;
}
function get_alien_humanoid_head_hair_color()
{
var alien_humanoid_head_hair_color;
var dice_size = 6;
var dice_count = 1;
var alien_humanoid_head_hair_color_roll = roll_dice(dice_size, dice_count);
switch (alien_humanoid_head_hair_color_roll)
{
case 1:
alien_humanoid_head_hair_color = "blue";
break;
case 2:
alien_humanoid_head_hair_color = "brown";
break;
case 3:
alien_humanoid_head_hair_color = "green";
break;
case 4:
alien_humanoid_head_hair_color = "grey";
break;
case 5:
alien_humanoid_head_hair_color = "red";
break;
case 6:
alien_humanoid_head_hair_color = "yellow";
}
return alien_humanoid_head_hair_color;
}
function get_alien_humanoid_head_hair()
{
var alien_humanoid_head_hair;
var dice_size = 2;
var dice_count = 1;
var increase_contrast_roll = roll_dice(dice_size, dice_count);
var increase_contrast;
var alien_humanoid_head_hair_intensity = get_alien_humanoid_head_hair_intensity();
var alien_humanoid_head_hair_color = get_alien_humanoid_head_hair_color();
if (increase_contrast_roll == 1)
{
increase_contrast = true;
}
else
{
increase_contrast = false;
}
if (increase_contrast && alien_humanoid_head_hair_color == "grey")
{
if (alien_humanoid_head_hair_intensity == "pale")
{
alien_humanoid_head_hair_intensity = "snow";
alien_humanoid_head_hair_color = "white";
}
else if (alien_humanoid_head_hair_intensity == "dark")
{
alien_humanoid_head_hair_intensity = "pitch";
alien_humanoid_head_hair_color = "black";
}
}
alien_humanoid_head_hair = alien_humanoid_head_hair_intensity + " " + alien_humanoid_head_hair_color;
return alien_humanoid_head_hair;
}
function get_alien_humanoid_head_structure_count()
{
var alien_humanoid_head_structure_count;
dice_size = 3;
dice_count = 1;
var alien_humanoid_head_structure_roll = roll_dice(dice_size, dice_count);
alien_humanoid_head_structure_count = alien_humanoid_head_structure_roll - 1;
return alien_humanoid_head_structure_count;
}
function get_alien_humanoid_head_hair_exists()
{
var alien_humanoid_head_hair_exists;
var dice_size = 2;
var dice_count = 1;
var alien_humanoid_head_hair_roll = roll_dice(dice_size, dice_count);
switch (alien_humanoid_head_hair_roll)
{
case 1:
imperial_alien_id['hair'] = 0; // hairless
alien_humanoid_head_hair_exists = false;
break;
case 2:
imperial_alien_id['hair'] = 1; // hair
alien_humanoid_head_hair_exists = true;
break;
}
return alien_humanoid_head_hair_exists;
}
function get_alien_humanoid_head()
{
var alien_humanoid_head;
var alien_humanoid_head_hair;
var alien_humanoid_head_structure;
var alien_humanoid_head_structure_2;
var alien_humanoid_head_hair_exists = get_alien_humanoid_head_hair_exists();
var alien_humanoid_head_structure_count = get_alien_humanoid_head_structure_count();
if (imperial_alien_id['hair'] == 1)
{
alien_humanoid_head_hair = get_alien_humanoid_head_hair();
alien_humanoid_head_hair = alien_humanoid_head_hair + ' hair';
}
else
{
alien_humanoid_head_hair = 'hairless';
}
if (alien_humanoid_head_structure_count)
{
alien_humanoid_head_structure = get_alien_humanoid_head_structure();
imperial_alien_id['head_structure'][0] = alien_humanoid_head_structure['id'];
alien_humanoid_head_structure = alien_humanoid_head_structure['text'] + ', ';
}
else
{
imperial_alien_id['head_structure'][0] = 0;
alien_humanoid_head_structure = '';
}
if (alien_humanoid_head_structure_count == 2)
{
imperial_alien_id['head_structure'][1] = imperial_alien_id['head_structure'][0];
while (imperial_alien_id['head_structure'][1] == imperial_alien_id['head_structure'][0])
{
alien_humanoid_head_structure_2 = get_alien_humanoid_head_structure();
imperial_alien_id['head_structure'][1] = alien_humanoid_head_structure_2['id'];
}
alien_humanoid_head_structure += alien_humanoid_head_structure_2['text'] + ', ';
}
alien_humanoid_head = alien_humanoid_head_structure + alien_humanoid_head_hair;
return alien_humanoid_head;
}
function generate_alien()
{
var random_alien = '';
var alien_species = '<strong>Species:</strong> ' + generate_alien_species();
var alien_type = get_alien_type();
if (imperial_alien_id['organic'] == 0)
{
alien_species = "<strong>Android:</strong> Model " + get_android_model();
}
var alien_skin = get_alien_skin();
var alien_eyes = get_alien_eyes();
var alien_humanoid_head = get_alien_humanoid_head();
random_alien = "<div class=\"sidebar_title\">Random Alien</div>\n";
random_alien += '<div class="sidebar_subtitle">' + alien_species + "</div>\n";
random_alien += '<div><strong>Type:</strong> ' + alien_type + "</div>\n";
if (imperial_alien_id['type'] < 10)
{
random_alien += '<div><strong>Skin:</strong> ' + alien_skin + "</div>\n";
random_alien += '<div><strong>Eyes:</strong> ' + alien_eyes + "</div>\n";
random_alien += '<div><strong>Head:</strong> ' + alien_humanoid_head + "</div>\n";
}
else
{
random_alien += '<div><strong>Coloring:</strong> ' + alien_skin + "</div>\n";
random_alien += '<div><strong>Eyes:</strong> ' + alien_eyes + "</div>\n";
}
document.getElementById("random_alien_output").innerHTML = random_alien;
}
//
// This code based on:
// Retro Alien Name Generator
// http://www.springhole.net/writing_roleplaying_randomators/retroaliennames.htm
//
var alien_vocab = new Array();
var intIncr
var intCat
intCat =0
intIncr=0
//The data stored is pretty simple. It works like this:
//
// The alien_vocab array has sub arrays that are named lists of data.
//
//alien_vocab[intCat]= new Array(); - The alien_vocab Array actually holds other arrays.
//alien_vocab[intCat][0]="FIRST" - This is the name of the list of data in this sub array. The name helps the program find the data.
//alien_vocab[intCat][1] = new Array() - Yep, ANOTHER array - this is the array that holds the actual data.
//alien_vocab[intCat][1][intIncr++]="First thing <SECOND>" // See that <SECOND> tag? Anything in brackets references another list.
//alien_vocab[intCat][1][intIncr++]="First thing <THIRD>"
//
// Unless it's the last entry, don't forget to increment and reset the counters!
//
//intCat++
//intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="FIRST"
alien_vocab[intCat][1] = new Array()
//alien_vocab[intCat][1][intIncr++]="<options>\n<options>\n<options>\n<options>\n<options>"
alien_vocab[intCat][1][intIncr++]="<options>"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="options"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstvowel><apos><midletters><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><ending><space><firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending><space><firstconsonant><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstvowel><apos><ending><space><firstconsonant><apos><vowel><apos><midletters><apos><ending>"
alien_vocab[intCat][1][intIncr++]="<firstconsonant><apos><vowel><apos><midletters><apos><ending><space><firstvowel><apos><ending>"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="firstvowel"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="A"
alien_vocab[intCat][1][intIncr++]="E"
alien_vocab[intCat][1][intIncr++]="I"
alien_vocab[intCat][1][intIncr++]="I<apos>a"
alien_vocab[intCat][1][intIncr++]="O"
alien_vocab[intCat][1][intIncr++]="U"
alien_vocab[intCat][1][intIncr++]="U<apos>a"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="firstconsonant"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="B"
alien_vocab[intCat][1][intIncr++]="B<apos>l"
alien_vocab[intCat][1][intIncr++]="B<apos>r"
alien_vocab[intCat][1][intIncr++]="D"
alien_vocab[intCat][1][intIncr++]="D<apos>r"
alien_vocab[intCat][1][intIncr++]="Ch"
alien_vocab[intCat][1][intIncr++]="F"
alien_vocab[intCat][1][intIncr++]="F<apos>l"
alien_vocab[intCat][1][intIncr++]="F<apos>r"
alien_vocab[intCat][1][intIncr++]="G"
alien_vocab[intCat][1][intIncr++]="G<apos>l"
alien_vocab[intCat][1][intIncr++]="G<apos>r"
alien_vocab[intCat][1][intIncr++]="H"
alien_vocab[intCat][1][intIncr++]="J"
alien_vocab[intCat][1][intIncr++]="K"
alien_vocab[intCat][1][intIncr++]="K<apos>h"
alien_vocab[intCat][1][intIncr++]="K<apos>l"
alien_vocab[intCat][1][intIncr++]="K<apos>r"
alien_vocab[intCat][1][intIncr++]="L"
alien_vocab[intCat][1][intIncr++]="M"
alien_vocab[intCat][1][intIncr++]="N"
alien_vocab[intCat][1][intIncr++]="P"
alien_vocab[intCat][1][intIncr++]="P<apos>l"
alien_vocab[intCat][1][intIncr++]="P<apos>r"
alien_vocab[intCat][1][intIncr++]="R"
alien_vocab[intCat][1][intIncr++]="S"
alien_vocab[intCat][1][intIncr++]="Sh"
alien_vocab[intCat][1][intIncr++]="S<apos>l"
alien_vocab[intCat][1][intIncr++]="S<apos>m"
alien_vocab[intCat][1][intIncr++]="S<apos>n"
alien_vocab[intCat][1][intIncr++]="S<apos>t"
alien_vocab[intCat][1][intIncr++]="T"
alien_vocab[intCat][1][intIncr++]="Th"
alien_vocab[intCat][1][intIncr++]="Th<apos>r"
alien_vocab[intCat][1][intIncr++]="T<apos>r"
alien_vocab[intCat][1][intIncr++]="V"
alien_vocab[intCat][1][intIncr++]="W"
alien_vocab[intCat][1][intIncr++]="X"
alien_vocab[intCat][1][intIncr++]="Y"
alien_vocab[intCat][1][intIncr++]="Z"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="vowel"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="a"
alien_vocab[intCat][1][intIncr++]="a<apos>a"
alien_vocab[intCat][1][intIncr++]="e"
alien_vocab[intCat][1][intIncr++]="e<apos>e"
alien_vocab[intCat][1][intIncr++]="i"
alien_vocab[intCat][1][intIncr++]="o"
alien_vocab[intCat][1][intIncr++]="o<apos>o"
alien_vocab[intCat][1][intIncr++]="u"
alien_vocab[intCat][1][intIncr++]="u<apos>u"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="midletters"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="b"
alien_vocab[intCat][1][intIncr++]="b<apos>l"
alien_vocab[intCat][1][intIncr++]="b<apos>r"
alien_vocab[intCat][1][intIncr++]="ch"
alien_vocab[intCat][1][intIncr++]="d"
alien_vocab[intCat][1][intIncr++]="d<apos>r"
alien_vocab[intCat][1][intIncr++]="f"
alien_vocab[intCat][1][intIncr++]="fr"
alien_vocab[intCat][1][intIncr++]="fl"
alien_vocab[intCat][1][intIncr++]="g"
alien_vocab[intCat][1][intIncr++]="g<apos>l"
alien_vocab[intCat][1][intIncr++]="g<apos>r"
alien_vocab[intCat][1][intIncr++]="h"
alien_vocab[intCat][1][intIncr++]="j"
alien_vocab[intCat][1][intIncr++]="k"
alien_vocab[intCat][1][intIncr++]="k<apos>l"
alien_vocab[intCat][1][intIncr++]="k<apos>s"
alien_vocab[intCat][1][intIncr++]="k<apos>r"
alien_vocab[intCat][1][intIncr++]="k<apos>t"
alien_vocab[intCat][1][intIncr++]="l"
alien_vocab[intCat][1][intIncr++]="l<apos>b"
alien_vocab[intCat][1][intIncr++]="l<apos>d"
alien_vocab[intCat][1][intIncr++]="l<apos>k"
alien_vocab[intCat][1][intIncr++]="l<apos>l"
alien_vocab[intCat][1][intIncr++]="l<apos>m"
alien_vocab[intCat][1][intIncr++]="l<apos>r"
alien_vocab[intCat][1][intIncr++]="l<apos>s"
alien_vocab[intCat][1][intIncr++]="l<apos>t"
alien_vocab[intCat][1][intIncr++]="m"
alien_vocab[intCat][1][intIncr++]="n"
alien_vocab[intCat][1][intIncr++]="n<apos>d"
alien_vocab[intCat][1][intIncr++]="n<apos>t"
alien_vocab[intCat][1][intIncr++]="p"
alien_vocab[intCat][1][intIncr++]="p<apos>k"
alien_vocab[intCat][1][intIncr++]="p<apos>l"
alien_vocab[intCat][1][intIncr++]="p<apos>r"
alien_vocab[intCat][1][intIncr++]="r"
alien_vocab[intCat][1][intIncr++]="r<apos>d"
alien_vocab[intCat][1][intIncr++]="r<apos>j"
alien_vocab[intCat][1][intIncr++]="r<apos>k"
alien_vocab[intCat][1][intIncr++]="r<apos>l"
alien_vocab[intCat][1][intIncr++]="r<apos>r"
alien_vocab[intCat][1][intIncr++]="r<apos>s"
alien_vocab[intCat][1][intIncr++]="r<apos>t"
alien_vocab[intCat][1][intIncr++]="s"
alien_vocab[intCat][1][intIncr++]="sh"
alien_vocab[intCat][1][intIncr++]="s<apos>l"
alien_vocab[intCat][1][intIncr++]="s<apos>n"
alien_vocab[intCat][1][intIncr++]="s<apos>m"
alien_vocab[intCat][1][intIncr++]="s<apos>t"
alien_vocab[intCat][1][intIncr++]="t"
alien_vocab[intCat][1][intIncr++]="th"
alien_vocab[intCat][1][intIncr++]="th<apos>r"
alien_vocab[intCat][1][intIncr++]="t<apos>r"
alien_vocab[intCat][1][intIncr++]="v"
alien_vocab[intCat][1][intIncr++]="x"
alien_vocab[intCat][1][intIncr++]="x<apos>x"
alien_vocab[intCat][1][intIncr++]="y"
alien_vocab[intCat][1][intIncr++]="z"
alien_vocab[intCat][1][intIncr++]="z<apos>g"
alien_vocab[intCat][1][intIncr++]="z<apos>l"
alien_vocab[intCat][1][intIncr++]="z<apos>n"
alien_vocab[intCat][1][intIncr++]="z<apos>m"
alien_vocab[intCat][1][intIncr++]="z<apos>t"
alien_vocab[intCat][1][intIncr++]="z<apos>z"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="ending"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="a"
alien_vocab[intCat][1][intIncr++]="ak"
alien_vocab[intCat][1][intIncr++]="ar"
alien_vocab[intCat][1][intIncr++]="ax"
alien_vocab[intCat][1][intIncr++]="an"
alien_vocab[intCat][1][intIncr++]="e<apos>a"
alien_vocab[intCat][1][intIncr++]="e<apos>e"
alien_vocab[intCat][1][intIncr++]="ek"
alien_vocab[intCat][1][intIncr++]="i<apos>a"
alien_vocab[intCat][1][intIncr++]="ik"
alien_vocab[intCat][1][intIncr++]="in"
alien_vocab[intCat][1][intIncr++]="is"
alien_vocab[intCat][1][intIncr++]="ix"
alien_vocab[intCat][1][intIncr++]="ok"
alien_vocab[intCat][1][intIncr++]="on"
alien_vocab[intCat][1][intIncr++]="o<apos>o"
alien_vocab[intCat][1][intIncr++]="os"
alien_vocab[intCat][1][intIncr++]="ox"
alien_vocab[intCat][1][intIncr++]="oz"
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="apos"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]="'"
alien_vocab[intCat][1][intIncr++]=""
alien_vocab[intCat][1][intIncr++]=""
alien_vocab[intCat][1][intIncr++]=""
alien_vocab[intCat][1][intIncr++]=""
alien_vocab[intCat][1][intIncr++]=""
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]="space"
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]=" "
alien_vocab[intCat][1][intIncr++]=" "
alien_vocab[intCat][1][intIncr++]=" "
alien_vocab[intCat][1][intIncr++]="-"
// Leave to Copy!
intCat++
intIncr=0
alien_vocab[intCat]= new Array();
alien_vocab[intCat][0]=""
alien_vocab[intCat][1] = new Array()
alien_vocab[intCat][1][intIncr++]=""
function generate_alien_species_GenNumber(nRange)
{
var iNumGen
iNumGen = Math.round((Math.random() * nRange));
return iNumGen;
}
function generate_alien_species_GetFrom(aArray)
{
var undefined
var sReturn
sReturn = aArray[generate_alien_species_GenNumber(aArray.length)];
if (sReturn == undefined)
{
sReturn = generate_alien_species_GetFrom(aArray)
}
return sReturn
}
function generate_alien_species_GetArray(sArrayName)
{
for (var intLooper=0;intLooper <alien_vocab.length;intLooper++)
{
if (alien_vocab[intLooper][0]==sArrayName)
{
return alien_vocab[intLooper][1];
break;
}
}
}
function generate_alien_species_ScanLine(sLine)
{
var iTagStart, iTagEnd
var sKey
if (sLine.indexOf("<") > -1)
{
iTagStart = sLine.indexOf("<");
iTagEnd = sLine.indexOf(">");
sKey = sLine.substr(iTagStart+1, iTagEnd-(iTagStart+1));
sKey = generate_alien_species_GetFrom(generate_alien_species_GetArray(sKey))
sLine = sLine.substr(0, iTagStart) + sKey + sLine.substr(iTagEnd+1, (sLine.length - iTagEnd))
}
if (sLine.indexOf("<") > - 1)
{
sLine = generate_alien_species_ScanLine(sLine)
}
return sLine;
}
function generate_alien_species()
{
sLine = generate_alien_species_GetFrom(generate_alien_species_GetArray("FIRST"));
sLine = generate_alien_species_ScanLine(sLine)
return sLine;
}
//
// Inserts the HTML into the page
//
$(function () {
var random_alien_button = document.getElementById('random_alien_button');
random_alien_button.innerHTML = '<input type="button" value="Generate An Alien" onclick="generate_alien();" />';
random_alien_output.innerHTML = 'Click the button and generate a random alien.';
}());