A Gendered 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 2)

Written by SoulLink
This feature is available to Grandmaster and Sage guild members.
 
In this tutorial, we will create a random generator that creates a male or female variant of a name depending on which gender is picked.  
  This tutorial will reuse the two generators and the first template created in the previous template. For this tutorial you will first have to create two additional generators, first to generate a gender and second to pick a male first name. Then these generators are combined with a router and two more simple templates.    

Generator: First Name (Male)

First step is to add a new generator which adds male names. Follows the exact same pattern as the female first names.  
  • Title: English First Names (Men)
  • Description: A short list of common English names for Men.
  • Type: String
  • State: Public
  • Tags: #english,#names,#male,#example,#tutorial-2
  • JSON Payload: Payload - Click to Expand
    {
     "values": {
      "val2": "James",
      "val3": "Robert",
      "val4": "John",
      "val5": "Michael",
      "val6": "William",
      "val7": "David",
      "val8": "Richard",
      "val9": "Joseph",
      "val10": "Thomas",
      "val11": "Charles"
     }
    }
Do not forget to click the test button a few times after creating it to make sure everything is in order.

Generator: Gender

In the second step we add a generator for gender. This generator provides the variable for the router. It is important that the keys (colored in red) are exactly this.  
  • Title: Gender
  • Description: Generates male or female.
  • Type: String
  • State: Public
  • Tags: #gender,#example,#tutorial-2
  • JSON Payload: Payload - Click to Expand
    {
     "values": {
      "male": "male",
      "female": "female"
     }
    }
Do not forget to click the test button a few times after creating it to make sure everything is in order.  

Template: Full Name (Male)

Following the same steps as the
  • Title: English Full Name (Man)
  • Description: A template to generate one English name for Men.
  • Type: Simple
  • State: Public
  • Tags: #names,#male,#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. The second generator was created in the previous tutorial.
    [generator:english-first-names-28man29-soullink|{}|first-name] [generator:english-last-names-soullink|{}|last-name]
Do not forget to click the test button a few times after creating it to make sure everything is in order.  

Router: Gender to Name

Creating a router does not differ much from generators. It has less options but follows the same pattern. The important part here is to match the key to the key in the input  
 
  • Title: English Full Name (Gender)
  • Description: A router that selects a full name template based on gender.
  • Type: Template, Simple
  • State: Public
  • Tags: #example,#names,#tutorial-2
  • JSON Payload:
    Do NOT copy this code into your router directly. It will work, but will use the example templates created by me (SoulLink). Instead use the steps below to copy each template BBCode and adjust them. The second template (female) was created in the previous tutorial.
    {
     "source": {
      "male": "english-full-name-28man29-soullink",
      "female": "english-full-name-28woman29-soullink"
     }
    }
  Use the clipboard button on the template list to copy the English Full Name (Man) and the English Full Name (Woman) template BBCodes. Copy it into the green field and then remove the brackets at the start and the pipe, braces and bracket at the end of the template BBCode. This will leave you with the key of the template.   The red keys must match the keys found in the input generator. Which in this case is the Gender Generator above. There the keys are colored red as well. All values must be present in both lists otherwise it will fail.   The darksalmon text is used to tell the router which generator variable the router should listen to. It can be any text, but it makes it easier to always use the same value like source.

Template: Putting it Together

This last template will generate four lines of text and is what will be used as the Random Generator in this case.    
  • Title: English Character
  • Description: This templates creates a character with a gender and a fitting name.
  • Type: Template, Simple
  • State: Public
  • Tags: #example,#names,#tutorial-2
  • JSON Payload:
    Do NOT copy this code into your router directly. It will work, but will use the example templates created by me (SoulLink). Instead use the steps below to copy each template BBCode and adjust them. The second template (female) was created in the previous tutorial.
    --Gender::[generator:gender-soullink|{}|gender]--
    --Name::[router:english-full-name-28gender29-soullink|{"source":"gender"}|name]--
    
  This is where where everything comes together. The color codes are supposed to explain which parts have to fit together when writing it all up. The darksalmon source text must be the same as in the router definition above. The orange text represents the name of the generator variable. This tells the router to use the generator variable gender as the input for the router. You will have to write the colored part yourself after copy and pasting the router code from the list.   Make sure that you keep the syntax intact when you change something.   You can find the result here: Simple Character Template.
Reference
Random Generators
Generic article | Jan 23, 2024

The overview page for the random generators.



Cover image: Photo by Alex Chambers

Comments

Please Login in order to comment!