Writing and gaming generators since 3551.  
[ About ]     [ Contact ]     [ Links ]     [ Store ]     [ Unfinished Gens ]     [ Misc Resources ]     [ Leatherwork ]
This gen builder is slightly more complicated to use than the first one. Rather than simply coming up with a list of traits of whatever traits are entered, it generates complete sentences. The structure of the generated sentences are very simple, however, with some relatively easy modifications to the code, the generated results can become more complex. Here is an example (new window) of the sort of thing this gen can make.

Some category names, such as 'class,' will break the script, because the code interprets it as something else. Try to avoid category names that might be things the code would use for something else, such as 'var' or 'string.' Don't use the same category name twice.
Other things that can break the code include symbols, such as ~ or ; in category names, or starting a category name with a digit (ie 2nd_category). When in doubt, stick to text. The same goes for the text in between the category names. Also, preface " and ' with a backslash \.

Number of Categories:
Enter an integer in digit form, ie, 5.
Category 1:


Format of the sentence that will be generated: (feel free to leave blanks)


Number of sentences to generate:

This code goes in the header of the page. (Between the <head> and </head> tags.) Do not alter it unless you have some idea what you are doing.

This code goes in the body of the page. Ways in which it can/should be modified are below.


The data you want to enter for each category goes in the ''s. If you need more, simply add more; ie [20], [21], etc.Delete any empty extras. Be sure to put backslashes \ before marks such as " or ' within the data, or the code will not work.

If you want only one result from a category, generated at complete random, keep the line that says single() and you're set.
If you want one result, curved so that it is more likely to come from the center of your data, replace that line with a line that says curve()
If you want several results, replace the single() line with a line that says multiple(,MAX,MIN) and replace MAX with the highest possible number of results you want, and MIN with the lowest possible number. If you're using this, you'll want to have a lot more data than you have max, so as to get varied results.

If you want to modify the structure of the sentence beyond what is possible with the gen builder's interface, look at the code at the very bottom of the textarea - you should see some familiar bits of sentence. Changing the order and contents of the document.write("") tags will change the generated sentences. If you would like to have more than one possible sentence syntax, use the following code:

This code will randomly pick one of the sentence structures to display. If you want more than different sentence structures, simply add more case statements, and change the number at the top (after Math.random) to your total. If you would like fewer possible sentences, simply remove the extra case statements and lower the total number. Copy and paste the document.write() tags from the original code in between the case and break statements, and modify them however necessary. Then replace that entire chunk of code in the original (everything inside the brackets of the loop) with the resulting code from here.

Remember to save the file with the code as a .html file in NotePad or a similar program. (You may need to select 'all files' from the dropdown so the program doesn't add .txt after the .html.) Then simply view your new generator in IE, FireFox, or any other browser (with javascript enabled) - the one you're using now should work just fine, provided the rest of the site works for you.)

For those of you who don't know any HTML, your finished code should look like this:
<html>
<head>
Header code from the first textarea above.
</head>
<body>
Body code from the second textarea above.
</body>
</html>