MediaWiki:Zerospace EN.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(195 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/ | var zerospace_alien_id = new Array(); | ||
* | zerospace_alien_id['head_structure'] = new Array(); | ||
zerospace_alien_id['skin_tone'] = new Array(); | |||
zerospace_alien_id['skin_color'] = new Array(); | |||
zerospace_alien_id['traits'] = new Array(); | |||
// zerospace_alien_id['organic'] | |||
// 0 = android | |||
// 1 = organic | |||
// 2 = synthetic | |||
// zerospace_alien_id['subtype_artifical'] | |||
// 1 = obvious | |||
// 2 = lifelike | |||
// zerospace_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 | |||
// zerospace_alien_id['subtype_animal'] | |||
// 0 = none | |||
// 1 = avian | |||
// 2 = canine | |||
// 3 = cephalopod | |||
// 4 = feline | |||
// 5 = mustelid | |||
// 6 = reptilian | |||
// zerospace_alien_id['symmetry'] | |||
// 1 = humanoid bilateral | |||
// 2 = dendriform bilateral | |||
// 3 = globular bilateral | |||
// 4 = serpentine bilateral | |||
// 5 = dendriform radial | |||
// 6 = globular radial | |||
// 7 = serpentine radial | |||
// zerospace_alien_id['hair'] | |||
// 0 = hairless | |||
// 1 = hair | |||
// 2 = feathers | |||
// 3 = scales | |||
// 4 = spines | |||
// zerospace_alien_id['head_structure'][0] | |||
// zerospace_alien_id['head_structure'][1] | |||
// 0 = none | |||
// 1 = antennae | |||
// 2 = brow ridges | |||
// 3 = cranial ridges | |||
// 4 = horns | |||
// 5 = pointed ears | |||
// 6 = tentacles | |||
// zerospace_alien_id['skin_tone'][0] | |||
// zerospace_alien_id['skin_tone'][1] | |||
// 1 = colorless | |||
// 2 = pale | |||
// 3 = light | |||
// 4 = medium | |||
// 5 = deep | |||
// 6 = dark | |||
// 9 = absolute | |||
// zerospace_alien_id['skin_color'][0] | |||
// zerospace_alien_id['skin_color'][1] | |||
// 1 = white | |||
// 2 = red | |||
// 3 = brown | |||
// 4 = yellow | |||
// 5 = green | |||
// 6 = blue | |||
// 9 = grey | |||
// 10 = black | |||
// zerospace_alien_id['eye_type'] | |||
// 0 = NA | |||
// 1 = circular pupil | |||
// 2 = horizontally slit pupil | |||
// 3 = vertically slit pupil | |||
// 4 = pupilless | |||
// 5 = solid color | |||
// 6 = compound | |||
// zerospace_alien_id['traits'][0] | |||
// zerospace_alien_id['traits'][1] | |||
// zerospace_alien_id['traits'][...] | |||
function print_r(printthis, returnoutput) | |||
{ | |||
var output = ''; | |||
if ($.isArray(printthis) || typeof(printthis) == 'object') | |||
{ | |||
for(var i in printthis) | |||
{ | |||
output += i + ' : ' + print_r(printthis[i], true) + '\n'; | |||
} | |||
} | |||
else | |||
{ | |||
output += printthis; | |||
} | |||
if (returnoutput && returnoutput == true) | |||
{ | |||
return output; | |||
} | |||
else | |||
{ | |||
alert(output); | |||
} | |||
} | |||
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(is_android) | |||
{ | |||
is_android = typeof is_android !== 'undefined' ? is_android : false; | |||
var exotic_alien_symmetry; | |||
var organism_type = 'organism'; | |||
var dice_size = 6; | |||
var dice_count = 1; | |||
var exotic_alien_symmetry_roll = roll_dice(dice_size, dice_count); | |||
if (is_android) | |||
{ | |||
organism_type = 'android'; | |||
} | |||
switch (exotic_alien_symmetry_roll) | |||
{ | |||
case 1: | |||
zerospace_alien_id['symmetry'] = 2; // dendriform bilateral | |||
exotic_alien_symmetry = 'dendriform ' + organism_type + ' with bilateral symmetry'; | |||
break; | |||
case 2: | |||
zerospace_alien_id['symmetry'] = 5; // dendriform radial | |||
exotic_alien_symmetry = 'dendriform ' + organism_type + ' with radial symmetry'; | |||
break; | |||
case 3: | |||
zerospace_alien_id['symmetry'] = 3; // globular bilateral | |||
exotic_alien_symmetry = 'globular ' + organism_type + ' with bilateral symmetry'; | |||
break; | |||
case 4: | |||
zerospace_alien_id['symmetry'] = 6; // globular radial | |||
exotic_alien_symmetry = 'globular ' + organism_type + ' with radial symmetry'; | |||
break; | |||
case 5: | |||
zerospace_alien_id['symmetry'] = 4; // serpentine bilateral | |||
exotic_alien_symmetry = 'serpentine ' + organism_type + ' with bilateral symmetry'; | |||
break; | |||
case 6: | |||
zerospace_alien_id['symmetry'] = 7; // 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: | |||
zerospace_alien_id['subtype_animal'] = 1; | |||
exotic_alien_animal = "avian"; | |||
break; | |||
case 2: | |||
zerospace_alien_id['subtype_animal'] = 2; | |||
exotic_alien_animal = "canine"; | |||
break; | |||
case 3: | |||
zerospace_alien_id['subtype_animal'] = 3; | |||
exotic_alien_animal = "cephalopod"; | |||
break; | |||
case 4: | |||
zerospace_alien_id['subtype_animal'] = 4; | |||
exotic_alien_animal = "feline"; | |||
break; | |||
case 5: | |||
zerospace_alien_id['subtype_animal'] = 5; | |||
exotic_alien_animal = "mustelid"; | |||
break; | |||
case 6: | |||
zerospace_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; | |||
// set defaults | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
switch (exotic_alien_weird_biology_roll) | |||
{ | |||
case 1: | |||
zerospace_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: | |||
zerospace_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: | |||
zerospace_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: | |||
zerospace_alien_id['type'] = 14; // gaseous | |||
exotic_alien_weird_biology = "gaseous alien"; | |||
break; | |||
case 5: | |||
zerospace_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: | |||
zerospace_alien_id['type'] = 16; // viscous fluid | |||
exotic_alien_weird_biology = "viscous fluid alien"; | |||
} | |||
return exotic_alien_weird_biology; | |||
} | |||
function get_exotic_alien_type(is_android) | |||
{ | |||
is_android = typeof is_android !== 'undefined' ? is_android : false; | |||
var exotic_alien_type; | |||
var dice_size = 6; | |||
var dice_count = 1; | |||
if (is_android) | |||
{ | |||
dice_size = 5; | |||
} | |||
var exotic_alien_type_roll = roll_dice(dice_size, dice_count); | |||
var exotic_alien_animal; | |||
var exotic_alien_symmetry; | |||
// set defaults | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
switch (exotic_alien_type_roll) | |||
{ | |||
case 1: | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
exotic_alien_animal = get_exotic_alien_animal(); | |||
exotic_alien_type = exotic_alien_animal + "-headed humanoid"; | |||
if (is_android) | |||
{ | |||
exotic_alien_type += ' android'; | |||
} | |||
else | |||
{ | |||
exotic_alien_type += ' organism'; | |||
} | |||
break; | |||
case 2: | |||
zerospace_alien_id['type'] = 2; // anthropomorphic animal | |||
exotic_alien_animal = get_exotic_alien_animal(); | |||
exotic_alien_type = "anthropomorphic " + exotic_alien_animal; | |||
if (is_android) | |||
{ | |||
exotic_alien_type += ' android'; | |||
} | |||
break; | |||
case 3: | |||
zerospace_alien_id['type'] = 3; // anthropomorphic plant | |||
exotic_alien_type = "anthropomorphic plant"; | |||
if (is_android) | |||
{ | |||
exotic_alien_type += ' android'; | |||
} | |||
break; | |||
case 4: | |||
zerospace_alien_id['type'] = 4; // insectoid | |||
exotic_alien_type = "insectoid"; | |||
if (is_android) | |||
{ | |||
exotic_alien_type += ' android'; | |||
} | |||
else | |||
{ | |||
exotic_alien_type += ' organism'; | |||
} | |||
break; | |||
case 5: | |||
zerospace_alien_id['type'] = 10; // uncommon | |||
exotic_alien_symmetry = get_exotic_alien_symmetry(is_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; | |||
// set defaults | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
zerospace_alien_id['organic'] = 1; // organic | |||
zerospace_alien_id['subtype_animal'] = 0; // NA | |||
zerospace_alien_id['subtype_artifical'] = 0; // NA | |||
zerospace_alien_id['symmetry'] = 1; // humanoid bilateral | |||
if (alien_type_roll <= 13) | |||
{ | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
zerospace_alien_id['organic'] = 1; // organic | |||
alien_type = 'humanoid organism'; | |||
} | |||
else if (alien_type_roll <= 15) | |||
{ | |||
zerospace_alien_id['organic'] = 0; // android | |||
zerospace_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) | |||
{ | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
alien_type = 'humanoid android'; | |||
} | |||
else if (android_type_roll <= 55) | |||
{ | |||
zerospace_alien_id['type'] = 1; // humanoid | |||
zerospace_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 | |||
{ | |||
zerospace_alien_id['subtype_artifical'] = 2; // lifelike | |||
exotic_alien_type = get_exotic_alien_type(true); | |||
alien_type = 'lifelike ' + exotic_alien_type; | |||
} | |||
} | |||
else | |||
{ | |||
zerospace_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() | |||
{ | |||
var alien_skin_intensity; | |||
var dice_size = 5; | |||
var dice_count = 1; | |||
var alien_skin_intensity_roll = roll_dice(dice_size, dice_count); | |||
var zerospace_index = typeof zerospace_alien_id['skin_tone'][0] === 'undefined' ? 0 : 1; | |||
switch (alien_skin_intensity_roll) | |||
{ | |||
case 1: | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 2; // pale | |||
alien_skin_intensity = "pale"; | |||
break; | |||
case 2: | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 3; // light | |||
alien_skin_intensity = "light"; | |||
break; | |||
case 3: | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 4; // medium | |||
alien_skin_intensity = "medium"; | |||
break; | |||
case 4: | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 5; // deep | |||
alien_skin_intensity = "deep"; | |||
break; | |||
case 5: | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 6; // dark | |||
alien_skin_intensity = "dark"; | |||
break; | |||
} | |||
return alien_skin_intensity; | |||
} | |||
function get_alien_skin_color(is_obvious_android) | |||
{ | |||
is_obvious_android = typeof is_obvious_android !== 'undefined' ? is_obvious_android : 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 zerospace_index = typeof zerospace_alien_id['skin_color'][0] === 'undefined' ? 0 : 1; | |||
if (!is_obvious_android) | |||
{ | |||
switch (alien_skin_color_roll) | |||
{ | |||
case 1: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 6; // blue | |||
alien_skin_color = "blue"; | |||
break; | |||
case 2: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 3; // brown | |||
alien_skin_color = "brown"; | |||
break; | |||
case 3: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 5; // green | |||
alien_skin_color = "green"; | |||
break; | |||
case 4: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 9; // grey | |||
alien_skin_color = "grey"; | |||
break; | |||
case 5: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 2; // red | |||
alien_skin_color = "red"; | |||
break; | |||
case 6: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 4; // yellow | |||
alien_skin_color = "yellow"; | |||
} | |||
} | |||
else | |||
{ | |||
dice_size = 10; | |||
dice_count = 1; | |||
var android_color_roll = roll_dice(dice_size, dice_count); | |||
switch (android_color_roll) | |||
{ | |||
case 1: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 2; // red | |||
alien_skin_color = "red"; | |||
break; | |||
case 2: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 3; // orange | |||
alien_skin_color = "orange"; | |||
break; | |||
case 3: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 4; // yellow | |||
alien_skin_color = "yellow"; | |||
break; | |||
case 4: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 5; // green | |||
alien_skin_color = "green"; | |||
break; | |||
case 5: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 6; // blue | |||
alien_skin_color = "blue"; | |||
break; | |||
case 6: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 7; // purple | |||
alien_skin_color = "purple"; | |||
break; | |||
default: | |||
zerospace_alien_id['skin_color'][zerospace_index] = 9; // grey | |||
alien_skin_color = "grey"; | |||
} | |||
} | |||
return alien_skin_color; | |||
} | |||
function get_alien_skin_combo(is_obvious_android) | |||
{ | |||
is_obvious_android = typeof is_obvious_android !== 'undefined' ? is_obvious_android : false; | |||
var alien_skin_combo; | |||
var dice_size = 4; | |||
var dice_count = 1; | |||
var increase_contrast_roll = roll_dice(dice_size, dice_count); | |||
var increase_contrast = false; | |||
var alien_skin_intensity = get_alien_skin_intensity(); | |||
var alien_skin_color = get_alien_skin_color(is_obvious_android); | |||
var android_finish = ''; | |||
var zerospace_index = typeof zerospace_alien_id['skin_color'][0] === 'undefined' ? 0 : 1; | |||
if (increase_contrast_roll == 1) | |||
{ | |||
increase_contrast = true; | |||
} | |||
if (increase_contrast && alien_skin_color == "grey") | |||
{ | |||
if (alien_skin_intensity == "pale") | |||
{ | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 1; // colorless | |||
alien_skin_intensity = "snow"; | |||
zerospace_alien_id['skin_color'][zerospace_index] = 1; | |||
alien_skin_color = "white"; | |||
} | |||
else if (alien_skin_intensity == "dark") | |||
{ | |||
zerospace_alien_id['skin_tone'][zerospace_index] = 10; // absolute | |||
alien_skin_intensity = "pitch"; | |||
zerospace_alien_id['skin_color'][zerospace_index] = 10; | |||
alien_skin_color = "black"; | |||
} | |||
} | |||
if (is_obvious_android) | |||
{ | |||
dice_size = 6; | |||
dice_count = 1; | |||
var android_finish_roll = roll_dice(dice_size, dice_count); | |||
switch (android_finish_roll) | |||
{ | |||
case 1: | |||
android_finish = "flat "; | |||
break; | |||
case 2: | |||
android_finish = "glossy "; | |||
break; | |||
case 3: | |||
android_finish = "glossy "; | |||
break; | |||
default: | |||
android_finish = "metallic "; | |||
} | |||
} | |||
alien_skin_combo = alien_skin_intensity + " " + android_finish + alien_skin_color; | |||
return alien_skin_combo; | |||
} | |||
function get_alien_skin(is_obvious_android) | |||
{ | |||
is_obvious_android = typeof is_obvious_android !== 'undefined' ? is_obvious_android : false; | |||
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(is_obvious_android); | |||
alien_skin_2 = alien_skin; | |||
while (alien_skin_2 == alien_skin) | |||
{ | |||
alien_skin_2 = get_alien_skin_combo(is_obvious_android); | |||
} | |||
alien_skin += " and " + alien_skin_2; | |||
} | |||
else | |||
{ | |||
alien_skin = get_alien_skin_combo(is_obvious_android); | |||
} | |||
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: | |||
zerospace_alien_id['eye_type'] = 1; // circular pupil | |||
alien_eyes_type = "circular pupil"; | |||
break; | |||
case 2: | |||
zerospace_alien_id['eye_type'] = 2; // horizontally slit pupil | |||
alien_eyes_type = "horizontally slit pupil"; | |||
break; | |||
case 3: | |||
zerospace_alien_id['eye_type'] = 3; // vertically slit pupil | |||
alien_eyes_type = "vertically slit pupil"; | |||
break; | |||
case 4: | |||
zerospace_alien_id['eye_type'] = 4; // pupilless | |||
alien_eyes_type = "pupilless"; | |||
break; | |||
case 5: | |||
zerospace_alien_id['eye_type'] = 5; // solid color | |||
alien_eyes_type = "solid color"; | |||
break; | |||
case 6: | |||
zerospace_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(is_lifelike_humanoid) | |||
{ | |||
is_lifelike_humanoid = typeof is_lifelike_humanoid !== 'undefined' ? is_lifelike_humanoid : true; | |||
// set defaults | |||
zerospace_alien_id['eye_type'] = 0; | |||
var alien_eyes; | |||
var dice_size = 2; | |||
var dice_count = 1; | |||
var increase_contrast_roll = roll_dice(dice_size, dice_count); | |||
var increase_contrast; | |||
var alien_eyes_intensity = get_alien_eyes_intensity(); | |||
var alien_eyes_color = get_alien_eyes_color(); | |||
var alien_eyes_type = ''; | |||
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"; | |||
} | |||
} | |||
if (is_lifelike_humanoid) | |||
{ | |||
alien_eyes_type = ", " + get_alien_eyes_type(); | |||
} | |||
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); | |||
if(zerospace_alien_id['subtype_animal'] == 1) // avian | |||
{ | |||
zerospace_alien_id['hair'] = 2; // feathers | |||
alien_humanoid_head_hair_exists = true; | |||
} | |||
else | |||
{ | |||
switch (alien_humanoid_head_hair_roll) | |||
{ | |||
case 1: | |||
if(zerospace_alien_id['subtype_animal'] == 6) // reptilian | |||
{ | |||
zerospace_alien_id['hair'] = 3; // scales | |||
alien_humanoid_head_hair_exists = true; | |||
} | |||
else | |||
{ | |||
zerospace_alien_id['hair'] = 0; // hairless | |||
alien_humanoid_head_hair_exists = false; | |||
} | |||
break; | |||
case 2: | |||
if(zerospace_alien_id['subtype_animal'] == 6) // reptilian | |||
{ | |||
zerospace_alien_id['hair'] = 4; // spines | |||
alien_humanoid_head_hair_exists = true; | |||
} | |||
else | |||
{ | |||
zerospace_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(); | |||
switch (zerospace_alien_id['hair']) | |||
{ | |||
case 0: | |||
alien_humanoid_head_hair = 'hairless'; | |||
break; | |||
case 1: | |||
alien_humanoid_head_hair = get_alien_humanoid_head_hair(); | |||
alien_humanoid_head_hair = alien_humanoid_head_hair + ' hair'; | |||
break; | |||
case 2: | |||
alien_humanoid_head_hair = get_alien_humanoid_head_hair(); | |||
alien_humanoid_head_hair = alien_humanoid_head_hair + ' feathers'; | |||
break; | |||
case 3: | |||
alien_humanoid_head_hair = get_alien_humanoid_head_hair(); | |||
alien_humanoid_head_hair = alien_humanoid_head_hair + ' scales'; | |||
break; | |||
case 4: | |||
alien_humanoid_head_hair = get_alien_humanoid_head_hair(); | |||
alien_humanoid_head_hair = alien_humanoid_head_hair + ' spines'; | |||
break; | |||
} | |||
if (alien_humanoid_head_structure_count) | |||
{ | |||
alien_humanoid_head_structure = get_alien_humanoid_head_structure(); | |||
zerospace_alien_id['head_structure'][0] = alien_humanoid_head_structure['id']; | |||
alien_humanoid_head_structure = alien_humanoid_head_structure['text'] + ', '; | |||
} | |||
else | |||
{ | |||
zerospace_alien_id['head_structure'][0] = 0; | |||
alien_humanoid_head_structure = ''; | |||
} | |||
if (alien_humanoid_head_structure_count == 2) | |||
{ | |||
zerospace_alien_id['head_structure'][1] = zerospace_alien_id['head_structure'][0]; | |||
while (zerospace_alien_id['head_structure'][1] == zerospace_alien_id['head_structure'][0]) | |||
{ | |||
alien_humanoid_head_structure_2 = get_alien_humanoid_head_structure(); | |||
zerospace_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 get_alien_head(is_lifelike_humanoid) | |||
{ | |||
is_lifelike_humanoid = typeof is_lifelike_humanoid !== 'undefined' ? is_lifelike_humanoid : true; | |||
var alien_head = ''; | |||
// set defaults | |||
zerospace_alien_id['head_structure'] = []; | |||
zerospace_alien_id['head_structure'][0] = 0; | |||
if (is_lifelike_humanoid) | |||
{ | |||
alien_head = get_alien_humanoid_head(); | |||
} | |||
return alien_head; | |||
} | |||
function get_alien_species(is_android) | |||
{ | |||
var alien_species; | |||
if (is_android) | |||
{ | |||
alien_species = get_android_model(); | |||
} | |||
else | |||
{ | |||
alien_species = generate_alien_species(); | |||
} | |||
return alien_species; | |||
} | |||
function get_alien_traits(is_android) | |||
{ | |||
is_android = typeof is_android !== 'undefined' ? is_android : false; | |||
var alien_traits = new Array(); | |||
var alien_traits_list = new Array(); | |||
var alien_traits_taken = new Array(); | |||
var alien_traits_count = 0; | |||
var alien_traits_total = 0; | |||
var dice_size = 6; | |||
var dice_count = 1; | |||
var alien_traits_total_roll; | |||
var alien_traits_total_roll; | |||
var alien_trait_found; // -1 means not found | |||
// set defaults | |||
zerospace_alien_id['traits'] = []; | |||
alien_traits_list[1] = '360° Vision'; | |||
alien_traits_list[2] = 'Aerial'; | |||
alien_traits_list[3] = 'Aquatic'; | |||
alien_traits_list[4] = 'Camouflage'; | |||
alien_traits_list[5] = 'Clinging'; | |||
alien_traits_list[6] = 'Data Jack'; | |||
alien_traits_list[7] = 'Energy Shield'; | |||
alien_traits_list[8] = 'Fascinating'; | |||
alien_traits_list[9] = 'Frigian'; | |||
alien_traits_list[10] = 'Gelatinous'; | |||
alien_traits_list[11] = 'Healing'; | |||
alien_traits_list[12] = 'Heavyworlder'; | |||
alien_traits_list[13] = 'Hyperacuity'; | |||
alien_traits_list[14] = 'Huge'; | |||
alien_traits_list[15] = 'Immortality'; | |||
alien_traits_list[16] = 'Immunity To Poison'; | |||
alien_traits_list[17] = 'Immunity To Suffocation'; | |||
alien_traits_list[18] = 'Infernal'; | |||
alien_traits_list[19] = 'Intangibility'; | |||
alien_traits_list[20] = 'Life Drain'; | |||
alien_traits_list[21] = 'Linguist'; | |||
alien_traits_list[22] = 'Mental Calculator'; | |||
alien_traits_list[23] = 'Mental Resistance'; | |||
alien_traits_list[24] = 'Multitasking'; | |||
alien_traits_list[25] = 'Natural Armor'; | |||
alien_traits_list[26] = 'Natural Weaponry'; | |||
alien_traits_list[27] = 'Night Vision'; | |||
alien_traits_list[28] = 'Perfect Recall'; | |||
alien_traits_list[29] = 'Regeneration'; | |||
alien_traits_list[30] = 'Self-sustaining'; | |||
alien_traits_list[31] = 'Shapeshifter'; | |||
alien_traits_list[32] = 'Shock'; | |||
alien_traits_list[33] = 'Subterranean'; | |||
alien_traits_list[34] = 'Telepathy'; | |||
alien_traits_list[35] = 'Tiny'; | |||
alien_traits_list[36] = 'Alteration Resistance'; | |||
if (is_android) | |||
{ | |||
alien_traits_count = 2; | |||
alien_traits_total = 2; | |||
alien_traits[0] = 'Immunity To Poison'; | |||
zerospace_alien_id['traits'][0] = 17; | |||
alien_traits[1] = 'Immunity To Suffocation'; | |||
zerospace_alien_id['traits'][1] = 18; | |||
} | |||
alien_traits_total_roll = roll_dice(dice_size, dice_count); | |||
switch (alien_traits_total_roll) | |||
{ | |||
case 1: | |||
alien_traits_total += 1; | |||
break; | |||
case 6: | |||
alien_traits_total += 3; | |||
break; | |||
default: | |||
alien_traits_total += 2; | |||
break; | |||
} | |||
dice_size = 36; | |||
dice_count = 1; | |||
while (alien_traits_count < alien_traits_total) | |||
{ | |||
alien_traits_roll = roll_dice(dice_size, dice_count); | |||
alien_trait_found = alien_traits.indexOf(alien_traits_list[alien_traits_roll]); | |||
if (alien_trait_found === -1) | |||
{ | |||
alien_traits[alien_traits_count] = alien_traits_list[alien_traits_roll]; | |||
zerospace_alien_id['traits'][alien_traits_count] = alien_traits_roll; | |||
alien_traits_count++; | |||
} | |||
} | |||
zerospace_alien_id['traits'].sort; | |||
alien_traits.sort(); | |||
return alien_traits; | |||
} | |||
function get_zerospace_catalog_id(zerospace_alien_id) | |||
{ | |||
var zerospace_catalog_id; | |||
zerospace_alien_id['head_structure'].sort(function (a, b) { return a - b; }); | |||
zerospace_alien_id['traits'].sort(function (a, b) { return a - b; }); | |||
zerospace_catalog_id = zerospace_alien_id['organic'] + '-'; | |||
zerospace_catalog_id += zerospace_alien_id['subtype_artifical'] + '-'; | |||
zerospace_catalog_id += zerospace_alien_id['type'] + '-'; | |||
zerospace_catalog_id += zerospace_alien_id['subtype_animal'] + '-'; | |||
zerospace_catalog_id += zerospace_alien_id['symmetry'] + '-{'; | |||
zerospace_catalog_id += zerospace_alien_id['head_structure'].join('|'); | |||
zerospace_catalog_id += '}-'; | |||
zerospace_catalog_id += zerospace_alien_id['eye_type'] + '-{'; | |||
zerospace_catalog_id += zerospace_alien_id['traits'].join('|'); | |||
zerospace_catalog_id += '}'; | |||
return zerospace_catalog_id; | |||
} | |||
function is_obvious_android() | |||
{ | |||
var is_obvious_android = false; | |||
if (zerospace_alien_id['organic'] == 0) | |||
{ | |||
if (zerospace_alien_id['subtype_artifical'] == 1) | |||
{ | |||
is_obvious_android = true; | |||
} | |||
} | |||
return is_obvious_android; | |||
} | |||
function is_lifelike_humanoid() | |||
{ | |||
var is_lifelike_humanoid = true; | |||
// is obvious android OR is exotic alien | |||
if (is_obvious_android() || zerospace_alien_id['type'] >= 10) | |||
{ | |||
is_lifelike_humanoid = false; | |||
} | |||
return is_lifelike_humanoid; | |||
} | |||
function format_zerospace_alien_id(zerospace_alien_id) | |||
{ | |||
var formatted_zerospace_alien_id; | |||
formatted_zerospace_alien_id = "<pre>BSSCID: "; | |||
formatted_zerospace_alien_id += get_zerospace_catalog_id(zerospace_alien_id); | |||
formatted_zerospace_alien_id += "</pre>"; | |||
return formatted_zerospace_alien_id; | |||
} | |||
function format_alien_output(alien_output) | |||
{ | |||
var formatted_alien_output; | |||
formatted_alien_output = "<div class=\"sidebar_title\">Barlowe Sentient Species Catalog</div>\n"; | |||
formatted_alien_output += '<div class="sidebar_subtitle">'; | |||
if (!zerospace_alien_id['organic']) | |||
{ | |||
formatted_alien_output += "<strong>Android:</strong> Model " + alien_output['species']; | |||
} | |||
else | |||
{ | |||
formatted_alien_output += '<strong>Species:</strong> ' + alien_output['species']; | |||
} | |||
formatted_alien_output += "</div>\n"; | |||
formatted_alien_output += '<div><strong>Type:</strong> ' + alien_output['type'] + "</div>\n"; | |||
if (is_lifelike_humanoid()) | |||
{ | |||
formatted_alien_output += '<div><strong>Head:</strong> ' + alien_output['head'] + "</div>\n"; | |||
} | |||
if (is_lifelike_humanoid()) | |||
{ | |||
formatted_alien_output += '<div><strong>Skin:</strong> ' + alien_output['skin'] + "</div>\n"; | |||
} | |||
else | |||
{ | |||
formatted_alien_output += '<div><strong>Coloring:</strong> ' + alien_output['skin'] + "</div>\n"; | |||
} | |||
formatted_alien_output += '<div><strong>Eyes:</strong> ' + alien_output['eyes'] + "</div>\n"; | |||
formatted_alien_output += '<div><strong>Traits:</strong>'; | |||
formatted_alien_output += "<ul>\n"; | |||
var alien_traits_count = alien_output['traits'].length; | |||
for (var i = 0; i < alien_traits_count; i++) | |||
{ | |||
formatted_alien_output += '<li>' + alien_output['traits'][i] + "</li>\n"; | |||
} | |||
formatted_alien_output += "</ul>\n"; | |||
formatted_alien_output += "</div>\n"; | |||
formatted_alien_output += format_zerospace_alien_id(zerospace_alien_id) | |||
return formatted_alien_output; | |||
} | |||
function generate_alien() | function generate_alien() | ||
{ | { | ||
var alien_output = new Array(); | |||
alien_output['traits'] = new Array(); | |||
alien_output['type'] = get_alien_type(); | |||
alien_output['species'] = get_alien_species(!zerospace_alien_id['organic']); | |||
alien_output['head'] = get_alien_head(is_lifelike_humanoid()); | |||
alien_output['skin'] = get_alien_skin(is_obvious_android()); | |||
alien_output['eyes'] = get_alien_eyes(is_lifelike_humanoid()); | |||
alien_output['traits'] = get_alien_traits(!zerospace_alien_id['organic']); | |||
document.getElementById("random_alien_output_EN").innerHTML = format_alien_output(alien_output); | |||
} | } | ||
function | // | ||
// 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_EN = document.getElementById('random_alien_button_EN'); | |||
if (random_alien_button_EN != null) | |||
{ | |||
var formatted_alien_output; | |||
formatted_alien_output = "<div class=\"sidebar_title\">Barlowe Sentient Species Catalog</div>\n"; | |||
formatted_alien_output += '<div class="sidebar_subtitle">'; | |||
formatted_alien_output += 'Click the button to display an entry from the Barlowe Sentient Species Catalog, the most comprehensive index of sentient species in the known universe.'; | |||
formatted_alien_output += '</div>'; | |||
random_alien_button_EN.innerHTML = '<input type="button" value="Species Search..." onclick="generate_alien();" />'; | |||
random_alien_output_EN.innerHTML = formatted_alien_output; | |||
} | |||
}()); | }()); |
Latest revision as of 09:50, 18 August 2022
var zerospace_alien_id = new Array();
zerospace_alien_id['head_structure'] = new Array();
zerospace_alien_id['skin_tone'] = new Array();
zerospace_alien_id['skin_color'] = new Array();
zerospace_alien_id['traits'] = new Array();
// zerospace_alien_id['organic']
// 0 = android
// 1 = organic
// 2 = synthetic
// zerospace_alien_id['subtype_artifical']
// 1 = obvious
// 2 = lifelike
// zerospace_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
// zerospace_alien_id['subtype_animal']
// 0 = none
// 1 = avian
// 2 = canine
// 3 = cephalopod
// 4 = feline
// 5 = mustelid
// 6 = reptilian
// zerospace_alien_id['symmetry']
// 1 = humanoid bilateral
// 2 = dendriform bilateral
// 3 = globular bilateral
// 4 = serpentine bilateral
// 5 = dendriform radial
// 6 = globular radial
// 7 = serpentine radial
// zerospace_alien_id['hair']
// 0 = hairless
// 1 = hair
// 2 = feathers
// 3 = scales
// 4 = spines
// zerospace_alien_id['head_structure'][0]
// zerospace_alien_id['head_structure'][1]
// 0 = none
// 1 = antennae
// 2 = brow ridges
// 3 = cranial ridges
// 4 = horns
// 5 = pointed ears
// 6 = tentacles
// zerospace_alien_id['skin_tone'][0]
// zerospace_alien_id['skin_tone'][1]
// 1 = colorless
// 2 = pale
// 3 = light
// 4 = medium
// 5 = deep
// 6 = dark
// 9 = absolute
// zerospace_alien_id['skin_color'][0]
// zerospace_alien_id['skin_color'][1]
// 1 = white
// 2 = red
// 3 = brown
// 4 = yellow
// 5 = green
// 6 = blue
// 9 = grey
// 10 = black
// zerospace_alien_id['eye_type']
// 0 = NA
// 1 = circular pupil
// 2 = horizontally slit pupil
// 3 = vertically slit pupil
// 4 = pupilless
// 5 = solid color
// 6 = compound
// zerospace_alien_id['traits'][0]
// zerospace_alien_id['traits'][1]
// zerospace_alien_id['traits'][...]
function print_r(printthis, returnoutput)
{
var output = '';
if ($.isArray(printthis) || typeof(printthis) == 'object')
{
for(var i in printthis)
{
output += i + ' : ' + print_r(printthis[i], true) + '\n';
}
}
else
{
output += printthis;
}
if (returnoutput && returnoutput == true)
{
return output;
}
else
{
alert(output);
}
}
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(is_android)
{
is_android = typeof is_android !== 'undefined' ? is_android : false;
var exotic_alien_symmetry;
var organism_type = 'organism';
var dice_size = 6;
var dice_count = 1;
var exotic_alien_symmetry_roll = roll_dice(dice_size, dice_count);
if (is_android)
{
organism_type = 'android';
}
switch (exotic_alien_symmetry_roll)
{
case 1:
zerospace_alien_id['symmetry'] = 2; // dendriform bilateral
exotic_alien_symmetry = 'dendriform ' + organism_type + ' with bilateral symmetry';
break;
case 2:
zerospace_alien_id['symmetry'] = 5; // dendriform radial
exotic_alien_symmetry = 'dendriform ' + organism_type + ' with radial symmetry';
break;
case 3:
zerospace_alien_id['symmetry'] = 3; // globular bilateral
exotic_alien_symmetry = 'globular ' + organism_type + ' with bilateral symmetry';
break;
case 4:
zerospace_alien_id['symmetry'] = 6; // globular radial
exotic_alien_symmetry = 'globular ' + organism_type + ' with radial symmetry';
break;
case 5:
zerospace_alien_id['symmetry'] = 4; // serpentine bilateral
exotic_alien_symmetry = 'serpentine ' + organism_type + ' with bilateral symmetry';
break;
case 6:
zerospace_alien_id['symmetry'] = 7; // 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:
zerospace_alien_id['subtype_animal'] = 1;
exotic_alien_animal = "avian";
break;
case 2:
zerospace_alien_id['subtype_animal'] = 2;
exotic_alien_animal = "canine";
break;
case 3:
zerospace_alien_id['subtype_animal'] = 3;
exotic_alien_animal = "cephalopod";
break;
case 4:
zerospace_alien_id['subtype_animal'] = 4;
exotic_alien_animal = "feline";
break;
case 5:
zerospace_alien_id['subtype_animal'] = 5;
exotic_alien_animal = "mustelid";
break;
case 6:
zerospace_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;
// set defaults
zerospace_alien_id['type'] = 1; // humanoid
switch (exotic_alien_weird_biology_roll)
{
case 1:
zerospace_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:
zerospace_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:
zerospace_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:
zerospace_alien_id['type'] = 14; // gaseous
exotic_alien_weird_biology = "gaseous alien";
break;
case 5:
zerospace_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:
zerospace_alien_id['type'] = 16; // viscous fluid
exotic_alien_weird_biology = "viscous fluid alien";
}
return exotic_alien_weird_biology;
}
function get_exotic_alien_type(is_android)
{
is_android = typeof is_android !== 'undefined' ? is_android : false;
var exotic_alien_type;
var dice_size = 6;
var dice_count = 1;
if (is_android)
{
dice_size = 5;
}
var exotic_alien_type_roll = roll_dice(dice_size, dice_count);
var exotic_alien_animal;
var exotic_alien_symmetry;
// set defaults
zerospace_alien_id['type'] = 1; // humanoid
switch (exotic_alien_type_roll)
{
case 1:
zerospace_alien_id['type'] = 1; // humanoid
exotic_alien_animal = get_exotic_alien_animal();
exotic_alien_type = exotic_alien_animal + "-headed humanoid";
if (is_android)
{
exotic_alien_type += ' android';
}
else
{
exotic_alien_type += ' organism';
}
break;
case 2:
zerospace_alien_id['type'] = 2; // anthropomorphic animal
exotic_alien_animal = get_exotic_alien_animal();
exotic_alien_type = "anthropomorphic " + exotic_alien_animal;
if (is_android)
{
exotic_alien_type += ' android';
}
break;
case 3:
zerospace_alien_id['type'] = 3; // anthropomorphic plant
exotic_alien_type = "anthropomorphic plant";
if (is_android)
{
exotic_alien_type += ' android';
}
break;
case 4:
zerospace_alien_id['type'] = 4; // insectoid
exotic_alien_type = "insectoid";
if (is_android)
{
exotic_alien_type += ' android';
}
else
{
exotic_alien_type += ' organism';
}
break;
case 5:
zerospace_alien_id['type'] = 10; // uncommon
exotic_alien_symmetry = get_exotic_alien_symmetry(is_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;
// set defaults
zerospace_alien_id['type'] = 1; // humanoid
zerospace_alien_id['organic'] = 1; // organic
zerospace_alien_id['subtype_animal'] = 0; // NA
zerospace_alien_id['subtype_artifical'] = 0; // NA
zerospace_alien_id['symmetry'] = 1; // humanoid bilateral
if (alien_type_roll <= 13)
{
zerospace_alien_id['type'] = 1; // humanoid
zerospace_alien_id['organic'] = 1; // organic
alien_type = 'humanoid organism';
}
else if (alien_type_roll <= 15)
{
zerospace_alien_id['organic'] = 0; // android
zerospace_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)
{
zerospace_alien_id['type'] = 1; // humanoid
alien_type = 'humanoid android';
}
else if (android_type_roll <= 55)
{
zerospace_alien_id['type'] = 1; // humanoid
zerospace_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
{
zerospace_alien_id['subtype_artifical'] = 2; // lifelike
exotic_alien_type = get_exotic_alien_type(true);
alien_type = 'lifelike ' + exotic_alien_type;
}
}
else
{
zerospace_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()
{
var alien_skin_intensity;
var dice_size = 5;
var dice_count = 1;
var alien_skin_intensity_roll = roll_dice(dice_size, dice_count);
var zerospace_index = typeof zerospace_alien_id['skin_tone'][0] === 'undefined' ? 0 : 1;
switch (alien_skin_intensity_roll)
{
case 1:
zerospace_alien_id['skin_tone'][zerospace_index] = 2; // pale
alien_skin_intensity = "pale";
break;
case 2:
zerospace_alien_id['skin_tone'][zerospace_index] = 3; // light
alien_skin_intensity = "light";
break;
case 3:
zerospace_alien_id['skin_tone'][zerospace_index] = 4; // medium
alien_skin_intensity = "medium";
break;
case 4:
zerospace_alien_id['skin_tone'][zerospace_index] = 5; // deep
alien_skin_intensity = "deep";
break;
case 5:
zerospace_alien_id['skin_tone'][zerospace_index] = 6; // dark
alien_skin_intensity = "dark";
break;
}
return alien_skin_intensity;
}
function get_alien_skin_color(is_obvious_android)
{
is_obvious_android = typeof is_obvious_android !== 'undefined' ? is_obvious_android : 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 zerospace_index = typeof zerospace_alien_id['skin_color'][0] === 'undefined' ? 0 : 1;
if (!is_obvious_android)
{
switch (alien_skin_color_roll)
{
case 1:
zerospace_alien_id['skin_color'][zerospace_index] = 6; // blue
alien_skin_color = "blue";
break;
case 2:
zerospace_alien_id['skin_color'][zerospace_index] = 3; // brown
alien_skin_color = "brown";
break;
case 3:
zerospace_alien_id['skin_color'][zerospace_index] = 5; // green
alien_skin_color = "green";
break;
case 4:
zerospace_alien_id['skin_color'][zerospace_index] = 9; // grey
alien_skin_color = "grey";
break;
case 5:
zerospace_alien_id['skin_color'][zerospace_index] = 2; // red
alien_skin_color = "red";
break;
case 6:
zerospace_alien_id['skin_color'][zerospace_index] = 4; // yellow
alien_skin_color = "yellow";
}
}
else
{
dice_size = 10;
dice_count = 1;
var android_color_roll = roll_dice(dice_size, dice_count);
switch (android_color_roll)
{
case 1:
zerospace_alien_id['skin_color'][zerospace_index] = 2; // red
alien_skin_color = "red";
break;
case 2:
zerospace_alien_id['skin_color'][zerospace_index] = 3; // orange
alien_skin_color = "orange";
break;
case 3:
zerospace_alien_id['skin_color'][zerospace_index] = 4; // yellow
alien_skin_color = "yellow";
break;
case 4:
zerospace_alien_id['skin_color'][zerospace_index] = 5; // green
alien_skin_color = "green";
break;
case 5:
zerospace_alien_id['skin_color'][zerospace_index] = 6; // blue
alien_skin_color = "blue";
break;
case 6:
zerospace_alien_id['skin_color'][zerospace_index] = 7; // purple
alien_skin_color = "purple";
break;
default:
zerospace_alien_id['skin_color'][zerospace_index] = 9; // grey
alien_skin_color = "grey";
}
}
return alien_skin_color;
}
function get_alien_skin_combo(is_obvious_android)
{
is_obvious_android = typeof is_obvious_android !== 'undefined' ? is_obvious_android : false;
var alien_skin_combo;
var dice_size = 4;
var dice_count = 1;
var increase_contrast_roll = roll_dice(dice_size, dice_count);
var increase_contrast = false;
var alien_skin_intensity = get_alien_skin_intensity();
var alien_skin_color = get_alien_skin_color(is_obvious_android);
var android_finish = '';
var zerospace_index = typeof zerospace_alien_id['skin_color'][0] === 'undefined' ? 0 : 1;
if (increase_contrast_roll == 1)
{
increase_contrast = true;
}
if (increase_contrast && alien_skin_color == "grey")
{
if (alien_skin_intensity == "pale")
{
zerospace_alien_id['skin_tone'][zerospace_index] = 1; // colorless
alien_skin_intensity = "snow";
zerospace_alien_id['skin_color'][zerospace_index] = 1;
alien_skin_color = "white";
}
else if (alien_skin_intensity == "dark")
{
zerospace_alien_id['skin_tone'][zerospace_index] = 10; // absolute
alien_skin_intensity = "pitch";
zerospace_alien_id['skin_color'][zerospace_index] = 10;
alien_skin_color = "black";
}
}
if (is_obvious_android)
{
dice_size = 6;
dice_count = 1;
var android_finish_roll = roll_dice(dice_size, dice_count);
switch (android_finish_roll)
{
case 1:
android_finish = "flat ";
break;
case 2:
android_finish = "glossy ";
break;
case 3:
android_finish = "glossy ";
break;
default:
android_finish = "metallic ";
}
}
alien_skin_combo = alien_skin_intensity + " " + android_finish + alien_skin_color;
return alien_skin_combo;
}
function get_alien_skin(is_obvious_android)
{
is_obvious_android = typeof is_obvious_android !== 'undefined' ? is_obvious_android : false;
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(is_obvious_android);
alien_skin_2 = alien_skin;
while (alien_skin_2 == alien_skin)
{
alien_skin_2 = get_alien_skin_combo(is_obvious_android);
}
alien_skin += " and " + alien_skin_2;
}
else
{
alien_skin = get_alien_skin_combo(is_obvious_android);
}
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:
zerospace_alien_id['eye_type'] = 1; // circular pupil
alien_eyes_type = "circular pupil";
break;
case 2:
zerospace_alien_id['eye_type'] = 2; // horizontally slit pupil
alien_eyes_type = "horizontally slit pupil";
break;
case 3:
zerospace_alien_id['eye_type'] = 3; // vertically slit pupil
alien_eyes_type = "vertically slit pupil";
break;
case 4:
zerospace_alien_id['eye_type'] = 4; // pupilless
alien_eyes_type = "pupilless";
break;
case 5:
zerospace_alien_id['eye_type'] = 5; // solid color
alien_eyes_type = "solid color";
break;
case 6:
zerospace_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(is_lifelike_humanoid)
{
is_lifelike_humanoid = typeof is_lifelike_humanoid !== 'undefined' ? is_lifelike_humanoid : true;
// set defaults
zerospace_alien_id['eye_type'] = 0;
var alien_eyes;
var dice_size = 2;
var dice_count = 1;
var increase_contrast_roll = roll_dice(dice_size, dice_count);
var increase_contrast;
var alien_eyes_intensity = get_alien_eyes_intensity();
var alien_eyes_color = get_alien_eyes_color();
var alien_eyes_type = '';
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";
}
}
if (is_lifelike_humanoid)
{
alien_eyes_type = ", " + get_alien_eyes_type();
}
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);
if(zerospace_alien_id['subtype_animal'] == 1) // avian
{
zerospace_alien_id['hair'] = 2; // feathers
alien_humanoid_head_hair_exists = true;
}
else
{
switch (alien_humanoid_head_hair_roll)
{
case 1:
if(zerospace_alien_id['subtype_animal'] == 6) // reptilian
{
zerospace_alien_id['hair'] = 3; // scales
alien_humanoid_head_hair_exists = true;
}
else
{
zerospace_alien_id['hair'] = 0; // hairless
alien_humanoid_head_hair_exists = false;
}
break;
case 2:
if(zerospace_alien_id['subtype_animal'] == 6) // reptilian
{
zerospace_alien_id['hair'] = 4; // spines
alien_humanoid_head_hair_exists = true;
}
else
{
zerospace_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();
switch (zerospace_alien_id['hair'])
{
case 0:
alien_humanoid_head_hair = 'hairless';
break;
case 1:
alien_humanoid_head_hair = get_alien_humanoid_head_hair();
alien_humanoid_head_hair = alien_humanoid_head_hair + ' hair';
break;
case 2:
alien_humanoid_head_hair = get_alien_humanoid_head_hair();
alien_humanoid_head_hair = alien_humanoid_head_hair + ' feathers';
break;
case 3:
alien_humanoid_head_hair = get_alien_humanoid_head_hair();
alien_humanoid_head_hair = alien_humanoid_head_hair + ' scales';
break;
case 4:
alien_humanoid_head_hair = get_alien_humanoid_head_hair();
alien_humanoid_head_hair = alien_humanoid_head_hair + ' spines';
break;
}
if (alien_humanoid_head_structure_count)
{
alien_humanoid_head_structure = get_alien_humanoid_head_structure();
zerospace_alien_id['head_structure'][0] = alien_humanoid_head_structure['id'];
alien_humanoid_head_structure = alien_humanoid_head_structure['text'] + ', ';
}
else
{
zerospace_alien_id['head_structure'][0] = 0;
alien_humanoid_head_structure = '';
}
if (alien_humanoid_head_structure_count == 2)
{
zerospace_alien_id['head_structure'][1] = zerospace_alien_id['head_structure'][0];
while (zerospace_alien_id['head_structure'][1] == zerospace_alien_id['head_structure'][0])
{
alien_humanoid_head_structure_2 = get_alien_humanoid_head_structure();
zerospace_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 get_alien_head(is_lifelike_humanoid)
{
is_lifelike_humanoid = typeof is_lifelike_humanoid !== 'undefined' ? is_lifelike_humanoid : true;
var alien_head = '';
// set defaults
zerospace_alien_id['head_structure'] = [];
zerospace_alien_id['head_structure'][0] = 0;
if (is_lifelike_humanoid)
{
alien_head = get_alien_humanoid_head();
}
return alien_head;
}
function get_alien_species(is_android)
{
var alien_species;
if (is_android)
{
alien_species = get_android_model();
}
else
{
alien_species = generate_alien_species();
}
return alien_species;
}
function get_alien_traits(is_android)
{
is_android = typeof is_android !== 'undefined' ? is_android : false;
var alien_traits = new Array();
var alien_traits_list = new Array();
var alien_traits_taken = new Array();
var alien_traits_count = 0;
var alien_traits_total = 0;
var dice_size = 6;
var dice_count = 1;
var alien_traits_total_roll;
var alien_traits_total_roll;
var alien_trait_found; // -1 means not found
// set defaults
zerospace_alien_id['traits'] = [];
alien_traits_list[1] = '360° Vision';
alien_traits_list[2] = 'Aerial';
alien_traits_list[3] = 'Aquatic';
alien_traits_list[4] = 'Camouflage';
alien_traits_list[5] = 'Clinging';
alien_traits_list[6] = 'Data Jack';
alien_traits_list[7] = 'Energy Shield';
alien_traits_list[8] = 'Fascinating';
alien_traits_list[9] = 'Frigian';
alien_traits_list[10] = 'Gelatinous';
alien_traits_list[11] = 'Healing';
alien_traits_list[12] = 'Heavyworlder';
alien_traits_list[13] = 'Hyperacuity';
alien_traits_list[14] = 'Huge';
alien_traits_list[15] = 'Immortality';
alien_traits_list[16] = 'Immunity To Poison';
alien_traits_list[17] = 'Immunity To Suffocation';
alien_traits_list[18] = 'Infernal';
alien_traits_list[19] = 'Intangibility';
alien_traits_list[20] = 'Life Drain';
alien_traits_list[21] = 'Linguist';
alien_traits_list[22] = 'Mental Calculator';
alien_traits_list[23] = 'Mental Resistance';
alien_traits_list[24] = 'Multitasking';
alien_traits_list[25] = 'Natural Armor';
alien_traits_list[26] = 'Natural Weaponry';
alien_traits_list[27] = 'Night Vision';
alien_traits_list[28] = 'Perfect Recall';
alien_traits_list[29] = 'Regeneration';
alien_traits_list[30] = 'Self-sustaining';
alien_traits_list[31] = 'Shapeshifter';
alien_traits_list[32] = 'Shock';
alien_traits_list[33] = 'Subterranean';
alien_traits_list[34] = 'Telepathy';
alien_traits_list[35] = 'Tiny';
alien_traits_list[36] = 'Alteration Resistance';
if (is_android)
{
alien_traits_count = 2;
alien_traits_total = 2;
alien_traits[0] = 'Immunity To Poison';
zerospace_alien_id['traits'][0] = 17;
alien_traits[1] = 'Immunity To Suffocation';
zerospace_alien_id['traits'][1] = 18;
}
alien_traits_total_roll = roll_dice(dice_size, dice_count);
switch (alien_traits_total_roll)
{
case 1:
alien_traits_total += 1;
break;
case 6:
alien_traits_total += 3;
break;
default:
alien_traits_total += 2;
break;
}
dice_size = 36;
dice_count = 1;
while (alien_traits_count < alien_traits_total)
{
alien_traits_roll = roll_dice(dice_size, dice_count);
alien_trait_found = alien_traits.indexOf(alien_traits_list[alien_traits_roll]);
if (alien_trait_found === -1)
{
alien_traits[alien_traits_count] = alien_traits_list[alien_traits_roll];
zerospace_alien_id['traits'][alien_traits_count] = alien_traits_roll;
alien_traits_count++;
}
}
zerospace_alien_id['traits'].sort;
alien_traits.sort();
return alien_traits;
}
function get_zerospace_catalog_id(zerospace_alien_id)
{
var zerospace_catalog_id;
zerospace_alien_id['head_structure'].sort(function (a, b) { return a - b; });
zerospace_alien_id['traits'].sort(function (a, b) { return a - b; });
zerospace_catalog_id = zerospace_alien_id['organic'] + '-';
zerospace_catalog_id += zerospace_alien_id['subtype_artifical'] + '-';
zerospace_catalog_id += zerospace_alien_id['type'] + '-';
zerospace_catalog_id += zerospace_alien_id['subtype_animal'] + '-';
zerospace_catalog_id += zerospace_alien_id['symmetry'] + '-{';
zerospace_catalog_id += zerospace_alien_id['head_structure'].join('|');
zerospace_catalog_id += '}-';
zerospace_catalog_id += zerospace_alien_id['eye_type'] + '-{';
zerospace_catalog_id += zerospace_alien_id['traits'].join('|');
zerospace_catalog_id += '}';
return zerospace_catalog_id;
}
function is_obvious_android()
{
var is_obvious_android = false;
if (zerospace_alien_id['organic'] == 0)
{
if (zerospace_alien_id['subtype_artifical'] == 1)
{
is_obvious_android = true;
}
}
return is_obvious_android;
}
function is_lifelike_humanoid()
{
var is_lifelike_humanoid = true;
// is obvious android OR is exotic alien
if (is_obvious_android() || zerospace_alien_id['type'] >= 10)
{
is_lifelike_humanoid = false;
}
return is_lifelike_humanoid;
}
function format_zerospace_alien_id(zerospace_alien_id)
{
var formatted_zerospace_alien_id;
formatted_zerospace_alien_id = "<pre>BSSCID: ";
formatted_zerospace_alien_id += get_zerospace_catalog_id(zerospace_alien_id);
formatted_zerospace_alien_id += "</pre>";
return formatted_zerospace_alien_id;
}
function format_alien_output(alien_output)
{
var formatted_alien_output;
formatted_alien_output = "<div class=\"sidebar_title\">Barlowe Sentient Species Catalog</div>\n";
formatted_alien_output += '<div class="sidebar_subtitle">';
if (!zerospace_alien_id['organic'])
{
formatted_alien_output += "<strong>Android:</strong> Model " + alien_output['species'];
}
else
{
formatted_alien_output += '<strong>Species:</strong> ' + alien_output['species'];
}
formatted_alien_output += "</div>\n";
formatted_alien_output += '<div><strong>Type:</strong> ' + alien_output['type'] + "</div>\n";
if (is_lifelike_humanoid())
{
formatted_alien_output += '<div><strong>Head:</strong> ' + alien_output['head'] + "</div>\n";
}
if (is_lifelike_humanoid())
{
formatted_alien_output += '<div><strong>Skin:</strong> ' + alien_output['skin'] + "</div>\n";
}
else
{
formatted_alien_output += '<div><strong>Coloring:</strong> ' + alien_output['skin'] + "</div>\n";
}
formatted_alien_output += '<div><strong>Eyes:</strong> ' + alien_output['eyes'] + "</div>\n";
formatted_alien_output += '<div><strong>Traits:</strong>';
formatted_alien_output += "<ul>\n";
var alien_traits_count = alien_output['traits'].length;
for (var i = 0; i < alien_traits_count; i++)
{
formatted_alien_output += '<li>' + alien_output['traits'][i] + "</li>\n";
}
formatted_alien_output += "</ul>\n";
formatted_alien_output += "</div>\n";
formatted_alien_output += format_zerospace_alien_id(zerospace_alien_id)
return formatted_alien_output;
}
function generate_alien()
{
var alien_output = new Array();
alien_output['traits'] = new Array();
alien_output['type'] = get_alien_type();
alien_output['species'] = get_alien_species(!zerospace_alien_id['organic']);
alien_output['head'] = get_alien_head(is_lifelike_humanoid());
alien_output['skin'] = get_alien_skin(is_obvious_android());
alien_output['eyes'] = get_alien_eyes(is_lifelike_humanoid());
alien_output['traits'] = get_alien_traits(!zerospace_alien_id['organic']);
document.getElementById("random_alien_output_EN").innerHTML = format_alien_output(alien_output);
}
//
// 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_EN = document.getElementById('random_alien_button_EN');
if (random_alien_button_EN != null)
{
var formatted_alien_output;
formatted_alien_output = "<div class=\"sidebar_title\">Barlowe Sentient Species Catalog</div>\n";
formatted_alien_output += '<div class="sidebar_subtitle">';
formatted_alien_output += 'Click the button to display an entry from the Barlowe Sentient Species Catalog, the most comprehensive index of sentient species in the known universe.';
formatted_alien_output += '</div>';
random_alien_button_EN.innerHTML = '<input type="button" value="Species Search..." onclick="generate_alien();" />';
random_alien_output_EN.innerHTML = formatted_alien_output;
}
}());