Writing and gaming generators since 5718.  
[ About ]     [ Contact ]     [ Links ]     [ Store ]     [ Unfinished Gens ]     [ Misc Resources ]     [ Leatherwork ]
Want to make a custom generator in the style of the ones on the site? This is the tool to do it. I don't claim that my code is the best way of making generators, but it's simple, it's easy to modify, and it works. This will give you javascript code, because PHP (what the other gens, including this one, are written in) requires a server or a special program.
Here's an example (new window) of what a generator made on this page looks like, including the code and the working generator itself. If any of the options below are confusing, check the example to see the finished product in action.

This tool can only make relatively simple generators, for now. If you wish to make more complex gens, take a look at w3schools, an excellent javascript resource.
Number of Categories:
Enter an integer in digit form, ie, 5.
If you desire subcategories for a particular category, fill in the number of subcategories required in the space to the right of the category name. Otherwise, leave that space blank, or enter a 0. In the final gen, rather than the main category showing, any one of the subcategories will be displayed in its place, and the random data will be chosen from that subcategory.
Category 1:



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.


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 delete the other two lines.
If you want one result, curved so that it is more likely to come from the center of your data, keep the line that says curve()and delete the other two.
If you want several results, delete both those lines, and keep the 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.

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. If you try to use a program like OpenOffice or Microsoft Word, it won't work, because those programs aren't made for writing code. 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>