help: new help article, tweaks ttcmd article

This commit is contained in:
Emmaline Autumn 2024-06-11 05:08:26 -06:00
parent 71bf62b622
commit e6880af3ee
3 changed files with 98 additions and 5 deletions

View File

@ -366,7 +366,7 @@ While in a Query Block Template, all resolvers will use the queried value as the
### Query Block ### Query Block
Similar to the Query Block Template, the query block passes the values of the query and passes it to the markdown inside of it. However, instead of rendering the whole block, it instead renders the markdown a single time. It has not been fully implemented yet Similar to the Query Block Template, the query block collects the values of the query and passes it to the markdown inside of it. However, instead of rendering the whole block, it instead renders the markdown a single time. It has not been fully implemented yet
Unlike the Query Block Template, it does not change the `_` variable to the queried value. For resolvers to work with the queried data, you need to access it with the `$$` variable. `$$` will be iterated over and will act similar to the Query Block Template, but on a per-line basis, meaning that if a line contains the `$$` variable, it will render that line of markdown for each result of the query. This is primarily useful for something like a List or a Table. Unlike the Query Block Template, it does not change the `_` variable to the queried value. For resolvers to work with the queried data, you need to access it with the `$$` variable. `$$` will be iterated over and will act similar to the Query Block Template, but on a per-line basis, meaning that if a line contains the `$$` variable, it will render that line of markdown for each result of the query. This is primarily useful for something like a List or a Table.

View File

@ -0,0 +1,82 @@
---
title: THe basics of schemas and objects
author: Emmaline Autumn
date: June 11th, 2024
updated: June 11th, 2024
---
# Table of Contents
- [Table of Contents](#table-of-contents)
- [What is a schema?](#what-is-a-schema)
- [Schema Templates](#schema-templates)
- [Schema and Type Fields](#schema-and-type-fields)
- [Schema Types](#schema-types)
- [Default Types](#default-types)
- [Special Types](#special-types)
- [How to make a schema](#how-to-make-a-schema)
---
# What is a schema?
A schema is a representation of the structure of a collection of data. In TTC, a schema is how we define the structure of game objects. Schemas have three parts: a template, fields, and types.
Schemas are effectively describing a relationship of parent objects and child objects as a collection of key-value pairs.
## Schema Templates
The template is how the object will be represented when rendered in markdown. It works in a similar way to Query Block Templates, with access to the `_` root variable.
By default, there is a simple template that renders them out as a key-value pair. The default template looks like this:
[][][]
```
??<<_.!!>>[[
# ??<<_.key>> $${{_.value}}
]]
```
/[]
## Schema and Type Fields
Schema fields are the description of the parent-child structure. Fields are named and can be left blank or filled in at any point of a publication's lifecycle.
If a field is rendered, it checks if it has a value in the publication or not. If it does, it will render the type's template. If it does not have a value, it will render an appropriate input for the type of the field. The exception is "required" fields. These require that the base (first) publication using that schema is required to have a value.
Fields by default are limited to a maximum of 1 entry, but you can increase the limit or set it to unlimited.
## Schema Types
Schema types are almost like mini-schemas that go inside of a schema. A schema holds all objects related to a discipline inside the rules (e.g. a Codex in Warhammer 40k, or an expansion), but a type is used to describe the fields inside of that schema (e.g. a datasheet for a unit in Warhammer 40k).
Types can be made up of other types as well. For example, the built in table type is made up of table rows which are made up of table columns.These compound types allow you to make better, more complex schemas that can do more.
Types also have a template. By default, it uses the same template as the schema to just render all of its contents, but you can customize it to your needs using ttcMD.
### Default Types
There are 5 default schema field types: section, steps, image, list, and table. These types have basic templates that you can't change that help build more complex types or even just build quick and dirty layouts.
There are also type field types, such as text, number, long text, and checkbox.
Each type has different limitations that you can enforce in the publications. Number has a minimum and a maximum, text has a maximum length.
### Special Types
Special types have specific programmed behaviors. These include decks of cards, dice, select and any. I am trying to figure out a good way to make it possible for you to make your own behaviors, but that is not top priority at the moment.
# How to make a schema
1. Inside of a game system, you will click "create new schema." This will take you to the schema editor. The first thing to do is to give your schema a name. This should be unique in the context of the game system.
2. You will then either create your custom types or add fields to the schema below. Let's start by creating our own type by giving it an name and clicking "configure." We will move into an area of the editor that allows us to add fields. Let's give this type two fields, name them count and description.
3. For count, let's select a number for the field type and set the minimum to 0. Since we only want 1 count, let's set the Limit field to 1 and the Minimum field to 1.
4. For the description, let's make it constant. You'll notice that there is now an additional field that you can use to input a constant value, let's describe this type as "A sample schema type that holds a count."
5. Now that we've finished with this type, click "save type." It will be added to the list of Types in the schema viewer on the side where you can review.
6. Go up to the schema fields and let's add a field by typing the name for the field and clicking add. Let's call ours "Population"
7. In the list below, our new field has been added. We can now change the type of that field by typing it into the Type field. It will populate suggestions as you type.
8. Now you can set the limits of the field.
9. Lastly, and most importantly, click "Save Schema" at the top right.

View File

@ -1,4 +1,15 @@
| test | Table | header |
| ---- | ----- | ------ | 1. hello
| test | table | row | 2. everybody
| shorter | *row* | 3. my
4. name
5. is
6. welcome
- hello
- everybody
- yes you
- my
- name
- is
- welcome