A Simple Name Generator
Restructuring the Codex
We are currently moving articles around and changing the general structure of the Codex. Please come back later if you get lost!Tutorial: Random Generators (Part 1)
In this tutorial, we create a simple name generator that creates a first and last name and then combines them. At the end, we stick this generator into another template to generate 10 names each time it is rolled.
To create this simple random generator we will need to make two generators and two templates. The first generator selects the first name from a list and the second one chooses the last name. The first template is used to combine these two generators and in the second template, we will repeat the first template 10 times to get that many names each time and add a description and some BBCode styling to make it easy to use.
Generator: First Name (Female)
Create a generator on the first tab of the Random Generators Studio. This is the data that you can fill into each field. If you make any changes to the JSON Payload make sure that the syntax stays correct as it will fail otherwise!- Title: English First Names (Woman)
- Description: A short list of common English names for Women.
- Type: String
- State: Public
- Tags: #english,#names,#female,#example,#tutorial-1
- JSON Payload: Payload - Click to Expand
{ "values": { "val2": "Mary", "val3": "Patricia", "val4": "Jennifer", "val5": "Linda", "val6": "Elizabeth", "val7": "Barbara", "val8": "Susan", "val9": "Jessica", "val10": "Sarah", "val11": "Karen" } }
values. The system expects this text to be there, otherwise it will not find the values to roll on! The text "val2" to "val11" are just placeholders and can be whatevery you want with the following restrictions:
IMPORTANT: The first piece of text of the JSON Payload has to always be
After filling in all of the fields hit the Create Generator button. If everything is correct the generator will appear in the list directly below the creation form.
This is the generator list item. It displays the title, the description, the tags, and three buttons. The first button can be used to edit the generator, the second is used to
test it and the bin can be used to delete the generator. The delete button asks for confirmation before actually deleting the resource!
Make sure to hit the test button a few times to make sure that the generator works. Each time you roll the dice the result is displayed in the upper right corner of the browser window in a small green container.
- The first character has to be a letter a-z.
- Only use letters (a-z) and number (0-9).
- Do not use any special characters or accented characters.
Generator: Last Name
For the second generator follow the steps of the previous generator but use the list below to fill the fields.- Title: English Last Names
- Description: A short list of common English last names.
- Type: String
- State: Public
- Tags: #english,#names,#last,#example,#tutorial-1
- JSON Payload: Payload - Click to Expand
{ "values": { "val2": "Smith", "val3": "Jones", "val4": "Williams", "val5": "Brown", "val6": "Johnson", "val7": "Taylor", "val8": "Wilson", "val9": "Miller", "val10": "Davis", "val11": "Thomas" } }
Template: Full Name
To create a template switch to the template tab.
Best to open a second browser tab for this. While creating or editing a resource you should not switch the website tabs as all your text will be removed from your tabs. In the future, your resources will likely be available in the sidebar of the form for easy editing.
- Title: English Full Name (Woman)
- Description: A template to generate one English name for Women.
- Type: Simple
- State: Public
- Tags: #names,#female,#example,#tutorial-1
- Content: Do NOT copy this code into your template. It will work, but will use the example generators created by me (SoulLink). Instead use the steps below to copy each generator BBCode.
[generator:english-first-names-28woman29-soullink|{}|first-name] [generator:english-last-names-soullink|{}|last-name]
Template: Full Names (10)
In most cases when using a random name generator the generator always shows you more than one result on each roll. This second template will reuse the first template to do just that. We will also add some description and some BBCode to make it a bit nicer. In theory, it is possible to just edit the first template and make the changes directly there. However, it makes sense to create a new template, because we will reuse the first template in subsequent tutorials. Follow the same steps as before to fill in the template. Remember to replace the template BBCode in the content below with your own!- Title: Example Simple Name Generator
- Description: A small example on how to create a name generator.
- Type: Simple
- State: Public
- Tags: #names,#female,#example,#tutorial-1
- Content:
[aloud]This is a basic name generator based on simple English names. It is an example of the Codex Tutorial "A Simple Name Generator". The number of names is very limited and will not really work for any real use case.[/aloud] [center][quote][h2] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}][br] [template:english-full-name-28woman29-soullink|{}] [/h2][/quote][/center]
Comments