Introduction

Tutorial: Random Generators (Prelude)

Written by SoulLink
This feature is available to Grandmaster and Sage guild members.
 
WORK IN PROGRESS
  The goal of this tutorial is to give users a document to follow along and eventually create a simple character generator. Each article will detail one step and build on previous lessons. In most cases, it makes sense to read and follow them in order.
  This tutorial takes you from creating a simple generator that outputs one of several names each time you click it to (eventually) a full character article generator with a name, some sidebar information, and a background description. This tutorial is intended to teach you how to create the generators, routers, and templates and then combine them to achieve a simple random generator.   This tutorial is NOT intended to teach you how to design random generators or how to collect data to feed them with.   Each tutorial step introduces one or two new concepts. At the end of each tutorial is a finished and usable random generator. The public page for that result is linked at the top of each article.

Glossary

Some important terms used in this tutorial:  
  • Random Generator: This is the name for the feature as a whole. In some contexts, this is shortened to generators, but should not be confused with the generator.
  • Generator: A resource which takes a list of something and returns a random item from that list each time you roll it. One of the three basic building blocks for Random Generators.
  • Router: Takes the output from a generator and translates that result to something else depending on what the output of the generator is. The second basic building block for Random Generators.
  • Template: Combines generators, routers and other templates to create a result. This result is either displayed or can be copied as BBCode. Each template has a public page that can be shared with other people. This is the third building block of Random Generators.
  • Resource: A term used in this tutorial to refer to all three building blocks at the same time.
  • Generator Variables: The output of generator, router and templates is stored in a generator variable. This value can be reused in other parts of the template and are the input for routers.
  • Public Page: This refers to the page where the random generator can be used. This page can be shared with others as well.
  • JSON Payload: The content of generators and routers. In this tutorial, the JSON Payload will always be provided for each step. To create your own use a copy of this google sheet template. The sheet is created and maintained by Vertixico. In general, try to avoid editing JSON by hand as it is error-prone!
 

Frequently Asked Questions

A collection of questions which have been asked frequently (duh!):

Where can I find the generators?

The generators can be found in the Studio section of World Anvil. Each tab on that page deals with one type of building block that is used to create random generators. Each page has the creation editor at the top, a list of existing resources below it, and short documentation on the sidebar. The list can be filtered using the search bar. It searches the title and tags of each resource.  
Random Generator Interface Location

Can I use generator BBCode in articles?

No. Generators, routers, and templates are only executed when added to a template. The random generator can then be used with the top level templates public page. This public page is the only way to roll the random generator.

Is there a way to embed or link a random generator in an article?

Yes. You can use the URL BBCode to add a link to the public page of your random generator.
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!
9 Jun, 2021 04:49

Test my generator and it works great, but when I drop the bbcode and drop it in an article, the code shows up, but nothing to cause the generation. Is there formatting or something to make it work? It would be nice to know.

9 Jun, 2021 07:50

Generator BBCode is not intended to be used in articles. Create an article template to generate articles. And use the link or iframe to navigate to the public page or embed the public page in an article.   We are collecting use cases for a feature request down the line: https://github.com/Kordishal/generator-issues/issues/28

Check out my world World Behind the Veil!