Character generator
How do I make an character generator?
What is a character generator? How do you make a character generator? This script and codes were developed by Khalkeus on 11 November 2022, Friday.
Character generator - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>character generator</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- Click or hit space to generate a new character. -->
<div class = "t" id = "t"></div> <script src="js/index.js"></script>
</body>
</html>
Character generator - Script Codes CSS Codes
.t{ margin-top: 30px; margin-bottom: 15px; font-size: 2.4em; font-weight: 400; color: #555555; font-family: sans-serif; text-align: center; margin:auto; width: 50%; position:fixed; top:20%; bottom:0; left:0; right:0; }
Character generator - Script Codes JS Codes
window.onload = function(){ refresh();
}
window.onclick = function(){ refresh();
}
window.onkeydown = function(a){ if(32===a.keyCode){ refresh(); }
}
function randomFromList(list){ return list[Math.floor(Math.random() * list.length)];
}
var wordLookup = { 'adj': ['tall', 'short', 'average looking', 'able','abnormal','absent-minded','above average','adventurous','affectionate','agile','agreeable','alert','amazing','ambitious','amiable','amusing','analytical','angelic','apathetic','apprehensive','ardent','artificial','artistic','assertive','attentive','average','awesome','awful','balanced','beautiful','below average','beneficent','blue','blunt','boisterous','brave','bright','brilliant','buff','callous','candid','cantankerous','capable','careful','careless','caustic','cautious','charming','childish','childlike','cheerful','chic','churlish','circumspect','civil','clean','clever','clumsy','coherent','cold','competent','composed','conceited','condescending','confident','confused','conscientious','considerate','content','cool','cool-headed','cooperative','cordial','courageous','cowardly','crabby','crafty','cranky','crass','critical','cruel','curious','cynical','dainty','decisive','deep','deferential','deft','delicate','demonic','dependent','delightful','demure','depressed','devoted','dextrous','diligent','direct','dirty','disagreeable','discerning','discreet','disruptive','distant','distraught','distrustful','dowdy','dramatic','dreary','drowsy','drugged','drunk','dull','dutiful','eager','earnest','easy-going','efficient','egotistical','elfin','emotional','energetic','enterprising','enthusiastic','evasive','even-tempered','exacting','excellent','excitable','experienced','fabulous','fastidious','ferocious','fervent','fiery','flabby','flaky','flashy','frank','friendly','funny','fussy','generous','gentle','gloomy','glutinous','good','grave','great','groggy','grouchy','guarded','hateful','hearty','helpful','hesitant','hot-headed','hypercritical','hysterical','idiotic','idle','illogical','imaginative','immature','immodest','impatient','imperturbable','impetuous','impractical','impressionable','impressive','impulsive','inactive','incisive','incompetent','inconsiderate','inconsistent','independent','indiscreet','indolent','indefatigable','industrious','inexperienced','insensitive','inspiring','intelligent','interesting','intolerant','inventive','irascible','irritable','irritating','jocular','jovial','joyous','judgmental','keen','kind','lame','lazy','lean','leery','lethargic','level-headed','listless','lithe','lively','local','logical','long-winded','lovable','love-lorn','lovely','maternal','mature','mean','meddlesome','mercurial','methodical','meticulous','mild','miserable','modest','moronic','morose','motivated','musical','naive','nasty','natural','naughty','negative','nervous','noisy','normal','nosy','numb','obliging','obnoxious','old-fashioned','one-sided','orderly','ostentatious','outgoing','outspoken','passionate','passive','paternal','paternalistic','patient','peaceful','peevish','pensive','persevering','persnickety','petulant','picky','plain','plain-speaking','playful','pleasant','plucky','polite','popular','positive','powerful','practical','prejudiced','pretty','proficient','proud','provocative','prudent','punctual','quarrelsome','querulous','quick','quick-tempered','quiet','realistic','reassuring','reclusive','reliable','reluctant','resentful','reserved','resigned','resourceful','respected','respectful','responsible','restless','revered','ridiculous','sad','sassy','saucy','sedate','self-assured','selfish','sensible','sensitive','sentimental','serene','serious','sharp','short-tempered','shrewd','shy','silly','sincere','sleepy','slight','sloppy','slothful','slovenly','slow','smart','snazzy','sneering','snobby','somber','sober','sophisticated','soulful','soulless','sour','spirited','spiteful','stable','staid','steady','stern','stoic','striking','strong','stupid','sturdy','subtle','sullen','sulky','supercilious','superficial','surly','suspicious','sweet','tactful','tactless','talented','testy','thinking','thoughtful','thoughtless','timid','tired','tolerant','touchy','tranquil','ugly','unaffected','unbalanced','uncertain','uncooperative','undependable','unemotional','unfriendly','unguarded','unhelpful','unimaginative','unmotivated','unpleasant','unpopular','unreliable','unsophisticated','unstable','unsure','unthinking','unwilling','venal','versatile','vigilant','warm','warmhearted','wary','watchful','weak','well-behaved','well-developed','well-intentioned','well-respected','well-rounded','willing','wonderful','volcanic','vulnerable','zealous', 'ethereal', 'uncanny', 'unnerving', 'odd', 'immortal', 'old','spry','curious','angry','destructive','displeased','grumpy','strict','sad','calm','awkward','interesting','interested','incredulous','credulous','scared','brave','excitable','worried','dubious','unlucky','lucky','irritable','joyful','fast', 'inhuman'], 'person': ['woman', 'man', 'person of indeterminate gender', 'individual', 'human', 'being', 'mortal', 'character', 'creature'], 'title': ['judge','soldier','hunter','wanderer','demon','spirit','sprite','scientist','artist','trucker','superhero','villain','hero','supervillain','werewolf','witch','monster','school child','teenager','grandmother','detective','cashier','bartender','detective','mercenary','thief','chef','dead man','doctor','bodyguard','gravedigger','student','alchemist','shapeshifter','treasure hunter','bounty hunter'], 'cloth': ['a scarf','a hat','a dress','a suit','a flak jacket','a leather jacket','a scarf','a hat','a dress','a set of heavy armor','jeans','a pair of ripped jeans','a necklace','a bracelet','a heavy coat','a hat','a curious ornament','boots', 'combat boots', 'a heavy pair of boots','a set of lingere','a sweatshirt','a tank top','dogtags', 'a set of dogtags','a pair of sneakers','a shawl','a cloak','a pair of shorts', 'blue','red','green','grey','orange','tan','gold','yellow','warm green','warm red','cool red','green','cool green','warm purple','cool purple','green blue','red blue','purple','black'], 'thing': ['sword','skull','computer','broom','bag','backpack','knife','gun','heart','lamp','sawed off','shotgun','tail','shovel','detached body part','pet','tree','mushroom','book','machine of some sort','notebook','axe','adze','coin purse','wallet','purse','water bottle','mug','mask','net','bone','tattoo'], 'assoc': ['blue','red','green','grey','orange','tan','gold','yellow','warm green','warm red','cool red','green','cool green','warm purple','cool purple','green blue','red blue','purple','black', 'motherhood', 'children', 'godhood', 'fear', 'ice', 'fire', 'the earth', 'water', 'air', 'wind', 'iron', 'gold', 'life', 'death', 'silver', 'tin', 'lead', 'bismuth', 'the sun', 'the moon', 'the spirit', 'the body', 'the hunt', 'the shield', 'the sword', 'the cup', 'the stars'],
}
var intros = [ 'The $person$ is a $title$.', 'The $person$ is $adj$.'
];
var appelations = [ 'They are $adj$.', 'They are $adj$ and $adj$.', 'They wear $cloth$ and $cloth$.', 'They wear $cloth$.', 'They have a $thing$ and a $thing$.', 'They have a $thing$.', 'They are associated with $assoc$ and $assoc$.', 'They are associated with $assoc$.',
];
function replaceVariables(s){ // Madlibs the input string while(s.indexOf('$') > -1){ var start = s.indexOf('$'); var end = s.indexOf('$', start + 1); var lookup = s.slice(start + 1, end); s = s.replace(('$' + lookup + '$'), randomFromList(wordLookup[lookup])); } // Take care of a vs an var startInd = 0; while(s.indexOf(' a ', startInd) != -1){ var start = s.indexOf(' a ', startInd); var end = start + 3; if('aeiou'.indexOf(s.charAt(end)) > -1){ s = s.slice(0, end - 1) + 'n ' + s.slice(end); } startInd = end + 2; } return s;
}
function refresh(){ var base = randomFromList(intros); for(var i = 0; i < Math.random() * 4; i++){ base += ' ' + randomFromList(appelations); } document.getElementById('t').innerHTML = replaceVariables(base);
}
refresh();
Developer | Khalkeus |
Username | khalkeus |
Uploaded | November 11, 2022 |
Rating | 3 |
Size | 4,840 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Boids ii | 3,358 Kb |
Cannon.js test | 2,524 Kb |
City generator | 2,750 Kb |
Fish pond | 3,799 Kb |
Square loading icons | 2,249 Kb |
Boids iii | 2,947 Kb |
Particle smoke | 2,887 Kb |
Random walkers | 2,512 Kb |
Warpspeed | 2,409 Kb |
Flowers | 2,588 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Videogular - Overlay Play Plugin | 2fdevs | 2,432 Kb |
Practice using Wixel | Emnk | 3,057 Kb |
Google Chrome Icon using Pure CSS in one DIV | Grssam | 3,627 Kb |
CSS3 Diamond | Rendro | 1,960 Kb |
Slider css only | Armandobau | 2,161 Kb |
NeeilTimer | Neeilan | 2,836 Kb |
Social.svg.min | Larsenwork | 13,849 Kb |
Vue.js Lazy Loading | Kjbrum | 3,620 Kb |
CSS3 Latte Art Logo | Esambino | 2,036 Kb |
Modal Dialog | Gigaleet | 2,251 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!