RPG Desk: creating sheets and reference. The Creating sheets and Reference sections of the RPG Desk documentation: everything used to write sheets and room tables in HTML, CSS and JavaScript with rpgdesk.js.
# Creating sheets
> Room sheets and tables made with HTML, CSS and JavaScript, by hand or with help from an AI.
Page: https://docs.rpgdesk.com/en/fichas/
In RPG Desk, a sheet is a web page: **HTML** for the fields, **CSS** for the looks and, if needed, **JavaScript** for the math. **rpgdesk.js**, RPG Desk’s library, connects the page to the room:
- what the player writes is kept in the room and shows up right away for the game master;
- roll buttons roll in the chat, with the 3D dice, for everyone;
- only the sheet’s owner and the game masters write; others only read, and rpgdesk.js locks the fields by itself;
- parts of the sheet can be for the game master only, and they never even reach the players.
The sheet below is working. Type in the fields and click **Roll Strength**:
*Working example:* [Minimal sheet](https://docs.rpgdesk.com/exemplos/en/minimal-sheet.html)
It does not have a single line of JavaScript: each field has a `data-field` attribute, and each roll button, a `data-roll`.
## Three ways to make one
**With an AI**
Copy RPG Desk’s guide to the AI (ChatGPT, Claude, Gemini…), describe the sheet and install the file it gives back. See [Create with an AI](https://docs.rpgdesk.com/en/fichas/com-ia/).
**By hand, in one file**
One `.html` file, with the manifest inside and the two rpgdesk.js lines. Start with the [tutorial](https://docs.rpgdesk.com/en/fichas/primeira-ficha/).
**In a package**
Several files (HTML, CSS, JavaScript, images, fonts) in a `.zip`, with more than one sheet or table. See [Packages with several files](https://docs.rpgdesk.com/en/fichas/pacotes/).
## From file to room
1. **Test it in the browser:** open the sheet’s file (double-click it). Outside RPG Desk, rpgdesk.js enters **test mode**, with the data in the browser and a band in the corner to switch roles.
2. **Install it in the room:** as game master, in **Room settings → Plugins → Install plugin…**, choose the `.html` (or the `.zip`). RPG Desk checks the file and tells you what to fix, if anything.
3. **Use it:** the sheet shows up in **New sheet…**, in the library.
> **Tip**
>
> Sheets and tables are the same thing inside. A **room table** (an NPC list, a calendar) is the same kind of page, which sits below the library for the whole room. See [Room tables](https://docs.rpgdesk.com/en/fichas/tabelas/).
## In this section
[Your first sheet](https://docs.rpgdesk.com/en/fichas/primeira-ficha/): The tutorial: from an empty file to the sheet installed in the room.
[Create with an AI](https://docs.rpgdesk.com/en/fichas/com-ia/): The guide for the AI, the request and how to fix what comes back wrong.
[Fields, lists and tabs](https://docs.rpgdesk.com/en/fichas/campos/): Everything you do with HTML attributes alone.
[JavaScript on the sheet](https://docs.rpgdesk.com/en/fichas/javascript/): The document, computed fields and lists from code.
[Rolls, chat and card](https://docs.rpgdesk.com/en/fichas/rolagens-e-chat/): Rolling, talking in the chat and filling in the player's bars.
[Private parts](https://docs.rpgdesk.com/en/fichas/partes-privadas/): What only the game master or only the owner sees.
[Room tables](https://docs.rpgdesk.com/en/fichas/tabelas/): Pages for the whole room: NPCs, initiative, travel maps.
[Looks](https://docs.rpgdesk.com/en/fichas/visual/): rpgdesk.css, the theme colors and narrow screens.
[Packages with several files](https://docs.rpgdesk.com/en/fichas/pacotes/): The .zip with manifest.json, images and fonts.
[Test and develop](https://docs.rpgdesk.com/en/fichas/desenvolvimento/): Test mode, development mode and page errors.
[Webhooks on the sheet](https://docs.rpgdesk.com/en/fichas/webhooks/): Sending data to Zapier, Make or IFTTT.
[New versions](https://docs.rpgdesk.com/en/fichas/versoes/): Updating the sheet without losing the players' data.
[Examples](https://docs.rpgdesk.com/en/fichas/exemplos/): Ready-made sheets and a table, to use and study.
For details, the [Reference](https://docs.rpgdesk.com/en/referencia/) has the manifest, the attributes, the rpgdesk.js API, the verifier and the limits.
# Your first sheet
> The tutorial: from an empty file to a sheet with fields, rolls, a list and a computed field, tested in the browser and installed in the room.
Page: https://docs.rpgdesk.com/en/fichas/primeira-ficha/
In this tutorial you make a simple sheet, for the game “Quick Adventure”: name, level, two attributes with a computed modifier, a roll button for each and a gear list. All you need is a text editor (Notepad will do; VS Code is better) and the browser.
## 1. The skeleton
Create a file called `my-sheet.html` with this:
`my-sheet.html`
```html
Hero
```
Three parts:
- **The manifest**, the `
```
`doc.compute` saves `str_mod` whenever `strength` changes. It is the right way to keep computed values: see [JavaScript on the sheet](https://docs.rpgdesk.com/en/fichas/javascript/#computed-fields).
## 6. A list
For the gear, a list where each item has its own fields:
```html
Gear
```
The `` is the mold for each item. Inside it, `data-field="name"` is the **item’s** name, not the character’s. `data-list-add` adds an empty item; `data-list-remove` removes its item.
## 7. Done
Putting it all together, the sheet looks like this:
*Working example:* [Quick Adventure](https://docs.rpgdesk.com/exemplos/en/first-sheet.html)
`my-sheet.html`
```html
Hero
Attributes
Modifier:
Modifier:
Gear
```
## 8. Install it in the room
1. Enter your room as game master and open **Room settings → Plugins**.
2. **Install plugin…** and choose `my-sheet.html`.
3. RPG Desk checks the file. If a problem shows up, the dialog says how to fix it (see [The verifier](https://docs.rpgdesk.com/en/referencia/verificador/)). With no errors, click **Install**.
4. In the library, **New item → New sheet…** shows the **Hero** system, from **Quick Adventure**.
Changed the sheet? Bump the `version` in the manifest (`1.0.1`) and install it again: RPG Desk updates the plugin, and the sheets already created keep their data. See [New versions](https://docs.rpgdesk.com/en/fichas/versoes/).
> **What next?**
>
> - Tabs, images, checkboxes and richer lists: [Fields, lists and tabs](https://docs.rpgdesk.com/en/fichas/campos/).
> - Health on the player’s card: [Rolls, chat and card](https://docs.rpgdesk.com/en/fichas/rolagens-e-chat/#the-players-card).
> - Notes only the game master sees: [Private parts](https://docs.rpgdesk.com/en/fichas/partes-privadas/).
# Create with an AI
> Making the sheet for your system with help from an AI: RPG Desk's guide, the request, testing and how to fix what comes back wrong.
Page: https://docs.rpgdesk.com/en/fichas/com-ia/
You do not need to know how to code to have a sheet for your system. A chat AI (ChatGPT, Claude, Gemini…) writes the whole sheet, if it knows RPG Desk’s rules. Those rules are in the **AI guide**: you paste the guide at the start of the conversation and describe the sheet.
## The AI guide
Two ways to get the guide:
- **In RPG Desk:** inside your room, as game master, in **Room settings → Plugins**, click **Copy instructions for AI**. The guide goes to the clipboard, in RPG Desk’s language and with your server’s rpgdesk.js address.
- **Here on the site:** [download the guide in English](https://docs.rpgdesk.com/_sdk/1/ai-guide.md) or [in Portuguese](https://docs.rpgdesk.com/_sdk/1/guia-ia.md), and paste the file’s content.
*Screenshot:* The Install plugin and Copy instructions for AI buttons, in Settings, Plugins.
The guide explains to the AI the file format, the environment’s rules (no internet, libraries only inside the package), the attributes and the rpgdesk.js API, and includes a complete example.
## The documentation for the AI
The guide sums up the rules. For the AI to look up the details (every attribute, the rpgdesk.js API, the verifier codes), this documentation also comes in text files made for AI, following the [llms.txt](https://llmstxt.org) standard:
- [`llms-fichas.txt`](https://docs.rpgdesk.com/en/llms-fichas.txt): the Creating sheets and Reference sections in a single file. It is what helps most to write sheets: if the AI accepts files, attach it to the conversation along with the guide.
- [`llms-full.txt`](https://docs.rpgdesk.com/en/llms-full.txt): the whole documentation.
- [`llms.txt`](https://docs.rpgdesk.com/en/llms.txt): the index, with a link to every page. If the AI can open web addresses, send it this one: it finds the rest from there.
Every page of the site also comes in Markdown: replace the slash at the end of the address with `.md` (`/en/fichas/campos/` becomes `/en/fichas/campos.md`).
## Ask for the sheet
1. Open a new conversation with the AI.
2. Paste the guide and, right after it, describe the sheet. The more concrete, the better:
```text
Make the sheet for my system, "Blades of the Backlands".
- Identity: name, origin, trade, level (1 to 10) and a portrait.
- Attributes: Strength, Agility, Mind and Courage, from 1 to 5. Each one with a
button that rolls 2d6 + the attribute.
- Health: current and maximum (maximum = 10 + Strength x 2, computed). Health
goes to bar 1 on the player's card.
- Skills: a list with name and bonus, and a button that rolls 2d6 + bonus.
- Inventory: a list with item and quantity.
- A "GM" tab, for game masters only, with notes.
Colors: sand and leather tones. It has to fit a narrow space.
```
3. Ask for **the whole `.html` file**. Save the answer in a file with the `.html` extension (`backlands.html`).
## Test it
Open the file in the browser (double-click it). Outside RPG Desk, the sheet enters **test mode**: fill in the fields, click the roll buttons and look at the **Log**, on the band in the corner. Switch the **Role** to **Another player** and check that the fields lock. See [Test and develop](https://docs.rpgdesk.com/en/fichas/desenvolvimento/).
Something wrong or missing? Tell the AI what happened, in detail (“the Agility button rolls 1d20, not 2d6”; “the portrait does not show up”), and ask for the whole file again.
## Install and fix
Install it in **Room settings → Plugins → Install plugin…**. RPG Desk checks the file first:
*Screenshot:* The install dialog with two errors and a warning, each with how to fix it, and the Copy report button.
- If problems show up, click **Copy report** and paste it in the conversation with the AI: the report says what is wrong, on which line and how to fix it, in a text the AI understands.
- Once installed, if the sheet shows a **Page errors** badge (the triangle in the corner), click it, then **Copy errors**, and paste that in the conversation too.
*Screenshot:* A sheet with the Page errors panel open, showing a TypeError, and the Copy errors and Clear buttons.
> **Tips**
>
> - Ask for one thing at a time: first the basic sheet, then the tabs, then the math.
> - Remind the AI to bump the `version` with each change (`1.0.0`, `1.0.1`…): that way RPG Desk knows it is an update. See [New versions](https://docs.rpgdesk.com/en/fichas/versoes/).
> - If the conversation got long and the AI started forgetting the rules, open another conversation, paste the guide and the current file, and carry on from where you stopped.
> - The AI does not see the screen. A screenshot of the problem, when the AI accepts images, helps a lot.
# Fields, lists and tabs
> Everything you do with HTML attributes alone: fields of every kind, computed texts, images, lists, tabs and what each role sees.
Page: https://docs.rpgdesk.com/en/fichas/campos/
rpgdesk.js connects the page’s `data-…` attributes by itself, including on elements that show up later (the items of a list, for example). A whole sheet can be made without JavaScript. The complete table is in [HTML attributes](https://docs.rpgdesk.com/en/referencia/atributos/).
The sheet below uses almost everything on this page: the portrait, the fields, the computed modifiers, the tabs, the inventory list and the GM tab. Switch the **Role** on the band in the corner to see what each person sees.
*Working example:* [Generic D20](https://docs.rpgdesk.com/exemplos/en/generic-d20.html)
## The document and paths
Each sheet has a **document**: its fields and their values, kept in the room. Each field has a **path**:
- `name`, `level`, `strength`: standalone fields;
- `attributes.strength`, `hp.current`, `hp.max`: fields inside a group, separated by periods.
The naming rules:
- **unaccented** letters, numbers and `_`, starting with a letter or `_`;
- case does not matter: `Strength` and `strength` are the same field;
- up to 64 characters per name and 12 levels of groups;
- names that start with `_rpgdesk` belong to RPG Desk.
The verifier flags a wrong name before installing. See [The verifier](https://docs.rpgdesk.com/en/referencia/verificador/).
## Fields: `data-field`
It goes on an ``, `