A Simple Name Generator

Tutorial: Random Generators (Part 1)

Written by SoulLink
This feature is available to Grandmaster and Sage guild members.
 
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.
Create Generator for English Female First Names
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"
     }
    }
  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.
Generator List Entry
  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.  

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"
     }
    }
  Like the first generator make sure to hit the dice a few times to see if it works as it should. In theory, you could now already use these two generators to make some names for yourself. However, you'd have to combine them yourself and type them from memory. This is where templates come in.

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.
English Full Name Template
  • 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]
  To copy the Generator BBCode switch to a new browser tab and open up the generator list. On the list item, there is a small, grey clipboard icon after the title. Click that icon and then paste the code into the CONTENT text area of the template editor. Do so for both of the generators.   Now press the Create Template button. A short moment later the template should appear in the list.  
Template List Item
  The list item for templates is very similar to the list item for generators but has an additional field and an additional button. The field displays the full content of the template and is changed to show the output when the button is pressed. and are the edit and delete buttons respectively. The button opens the public page of the template in a new tab. There you can test the template as well. This is the page that you can share with other people to show off your creations!

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]
    
  The additional BBCode is added to make it a bit more presentable. The h2 header serves to increase the font size of the name. This makes it easier to read them at a glance.   Follow the link Simple Example Template to the public page of this template.
Reference
Random Generators
Generic article | Jun 13, 2021

The overview page for the random generators.



Cover image: Photo by Alex Chambers

Comments

Please Login in order to comment!