# Roll Table Importer ![GitHub all releases](https://img.shields.io/github/downloads/jendave/roll-table-importer/total) [![Latest Version](https://img.shields.io/github/v/release/jendave/roll-table-importer?display_name=tag&sort=semver&label=Latest%20Version)](https://github.com/jendave/augmented-reality-foundry/releases/latest) ![Foundry Version](https://img.shields.io/endpoint?url=https://foundryshields.com/version?url=https%3A%2F%2Fraw.githubusercontent.com%2Fjendave%2Froll-table-importer%2Fmain%2Fsrc%2Fmodule.json) [![License](https://img.shields.io/github/license/jendave/roll-table-importer)](LICENSE) ## WARNING - Roll Table Compatibility * [Roll Table Importer](https://github.com/jendave/roll-table-importer) supports Foundry v13 and v14. * Roll tables created/edited on v13 and v14 *are not* compatible with v12. * Roll tables created/edited on v12 are compatible with v13 and v14. ## Features and Notes The `Roll Table Importer` module can create Foundry VTT roll tables from various kinds of text files. * Copy and paste data to be parsed (text, CSV, JSON). * Import text, CSV and JSON files. * Mutiple tables can be created from files located in folders and subfolders. * Tables can be created from files located on a Foundry server or a local computer. * Create tables with names, descriptions and ranges. ## Usage ![Screenshot](https://github.com/jendave/roll-table-importer/blob/main/docs/screenshot_button.jpg?raw=true) ![Screenshot](https://github.com/jendave/roll-table-importer/blob/main/docs/screenshot_dialog.jpg?raw=true) 1. Click `Import Tables` button in the `Rollable Tables` tab in the sidebar. 2. Paste text of a roll table via clipboard or choose a file or directory using the file-pickers. 1. Copy text you are trying to import and paste into the clipboard text area 2. Or use file/directory icons to choose a file/directory from the Foundry server or local filesystem. 3. Click `Okay` 4. Roll tables will appear in the `Rollable Tables` tab. ## Roll Table Formats Tables can be imported from a text, JSON, or CSV file. Each method is documented below. ### Text File A .txt file can be used to create a roll table. The filename will be used as the `table name`. The importer will just treat each new line as an item in the table. The `Roll Table Importer` tool comes with a text box where you can copy/paste tables. The first line will be used as the `table name`. The `description` field must be the next line and be marked with `###` at the beginning of the line. Newlines must be marked with `\n` as shown in the examples. Die-type (such as d6 or d100) and ranges can be specified. If the ranges are not stated, the importer will determine the table ranges based on the number of items in the table. The [Behind the Tables subreddit](https://www.reddit.com/r/BehindTheTables) is a good source for random tables in plain-text format. A simple single table can be created from a file. The filename will be the name of the table. `goods.txt`: ```txt Backpacks or sacks Baskets Bricks Books Cloth Rope ``` This example is pasted into the textbox. `Die Type`, `Table Name`, `Description` and `Ranges` can also be added. ```txt d100 This place is... ### Type of Location \n Has the location fallen into disrepair? 1-10 A stronghold. 11-20 A temple. 21-35 A tomb. 36-40 A prison. 41-55 A mine. 55-70 A lair. 71-75 A palace. 76-80 A storage vault. 81-90 A sewer. 91-100 A maze. ``` And descriptions can be added by using `###` as a delimiter. ```txt d100 This place is... (with descriptions) ### Type of Location \n Has the location fallen into disrepair? 1-10 Stronghold ### A stronghold description. 11-20 Temple ### A temple description. 21-35 Tomb ### A tomb description. 36-40 Prison ### A prison description. 41-55 Mine ### A mine description. 55-70 Lair ### A lair description. 71-75 Palace ### A palace description. 76-80 Vault ### A storage vault description. 81-90 Sewer ### A sewer description. 91-100 Maze ### A maze description. ``` Multiple tables can be part of a collection and will be placed in a folder. Put the name of the folder separately on the first line and paste into the textbox. ```txt Random Dungeons d12 The place is currently occupied by... ### Location is filled with enemies \n Roll multiple times on this table Outlaw ### A dangerous outlaw. Lord ### An elemental lord. Vampire ### A vampire. Lich ### A lich. Demon ### A demon. A devil. An orc warlord. A hobgoblin commander. An aberrant presence. A witch. A giant. A dragon. d12 This place was built by... An ancient dwarvish clan. An ancient elf prince. A powerful wizard. A dark sorceress. A foreign empire. An ambitious queen of old. Prosperous merchants. A powerful noble family. Religious zealots. An ancient race of giants. A tyrannical king of old. No one; it's a natural cave. d100 This place is located... 1-8 Beneath a cold mountain. 9-16 Beneath a fiery mountain. 17-24 Near a well-traveled mountain pass. 25-32 Deep within a forest. 33-40 Deep within a desert. 41-48 Beside the sea. 49-56 On an island. 57-64 Beneath a bustling city. 65-72 Beneath the ruin of an ancient city. 73-80 Beneath a well-known castle or monastery. 81-88 Beneath a the ruin of an old castle or monastery. 89-94 Beneath a body of water. 95-100 In a place reachable only by magic. ``` ### JSON For JSON, both files/directories and pasted text can be used by the importer. The [Foundry VTT Tables Repository](https://github.com/foundry-vtt-community/tables) is a good source for random tables in JSON format. A structure similar to Foundry's interface for tables is valid. ```json { "name": "Goods", "formula": "1d12", "description": "List of equipment \n Non-magical", "results": [ { "range": [1, 4], "text": "Backpacks or sacks" }, { "range": [5, 6], "text": "Baskets" }, { "range": [7, 8], "text": "Bricks" }, { "range": [9, 10], "text": "Books" }, { "range": [11, 11], "text": "Cloth" }, { "range": [12, 12], "text": "Rope" } ] } ``` Descriptions can also be included. ```json { "name": "Goods v13", "formula": "1d12", "description": "List of equipment \n Non-magical", "results": [ { "range": [1, 4], "name": "Backpacks or sacks", "description": "A backpack or sack is for carrying gear." }, { "range": [5, 6], "name": "Baskets", "description": "A basket is for carrying items." }, { "range": [7, 8], "name": "Bricks", "description": "A brick is a building material." }, { "range": [9, 10], "name": "Books", "description": "A book is a written work." }, { "range": [11, 11], "name": "Cloth", "description": "Cloth is a material for making clothing." }, { "range": [12, 12], "name": "Rope", "description": "Rope is good for dungeon-crawling." } ] } ``` Or a simpler structure can be passed and the formula and ranges will be automatically calculated and evenly distributed. ```json { "name": "Goods - Simple", "description": "List of equipment \n Non-magical", "results": [ "Backpacks or sacks", "Baskets", "Bricks", "Books", "Cloth", "Rope" ] } ``` ### CSV Text in CSV format can be used for a roll table. The pipe (|) symbol is used as the delimiter since commas are common in tables. For a .csv file, the file name will be used for the `table name`. If the csv text was pasted into the textbox, the table will named `CSV Imported Table`. The CSV text cannot contain the `table name`. `goods.csv` ```csv 01-04|Backpacks or sacks ### Backpack description 05-06|Baskets ### Basket description 07-08|Bricks 09-10|Books 11|Cloth 12|Rope ``` ## Support For questions, feature requests or bug reports, please open an [issue](https://github.com/jendave/roll-table-importer/issues). [Pull requests](https://github.com/jendave/roll-table-importer/pulls) are welcome. Please include a reason for the request or create an issue before starting one. ## Contact * [Ironsworn/Starforged Discord Server - FoundryVTT Channel](https://discord.com/channels/437120373436186625/867434336201605160) (jendave) * [FoundryVTT Discord Server - Module Discussion Channel](https://discord.com/channels/170995199584108546/513918036919713802) (jendave) * [VOID Affiliate Network Discord Server - Game Hacks Channel](https://discord.com/channels/1222986351272787990/1222986351792619687) (jendave) * [GitHub Repository](https://github.com/jendave/roll-table-importer) * [Itch.io](https://jendave.itch.io/) ## Credits Module by David Hudson and licensed for use under the [MIT license](https://opensource.org/license/mit/). This project is based on [foundryvtt-importer](https://github.com/EthanJWright/foundryvtt-importer) by [Ethan J Wright](https://github.com/EthanJWright). ## FoundryVTT Modules and Other Resources Please check out my other modules and resources for Ironsworn, Ironsworn: Starforged and other systems. ### [FoundryVTT](https://foundryvtt.com/community/david-hudson/packages) Modules * [Starforged Custom Compendiums](https://foundryvtt.com/packages/starforged-custom-oracles) * [Starsmith Compendiums for Ironsworn: Starforged](https://foundryvtt.com/packages/starsmith-expanded-oracles) * [Ironsmith Expanded Oracles for Ironsworn](https://foundryvtt.com/packages/ironsmith-expanded-oracles) * [Augmented Reality Cyberpunk City Kit](https://foundryvtt.com/packages/augmented-reality-foundry) * [Token Note Hover](https://github.com/jendave/token-note-hover) * [Token Action HUD Ironsworn](https://foundryvtt.com/packages/token-action-hud-ironsworn) * [VOID 1680 AM for FoundryVTT](https://foundryvtt.com/packages/void-1680-am) * [Ancient Wonders](https://foundryvtt.com/packages/ancient-wonders) * [Rise & Shiningstar - An Adventure for Ironsworn: Starforged](https://foundryvtt.com/packages/rise-and-shining-star) * [Roll Table Importer](https://foundryvtt.com/packages/roll-table-importer) * [Ironsworn Impacts](https://foundryvtt.com/packages/ironsworn-impacts) ### [Itch.io](https://jendave.itch.io/) Resources * [The City on the Breeze - Cyberpunk-inspired Oracle arrays](https://jendave.itch.io/the-city-on-the-breeze) * [I'll Be Home for Life Day! - Star Wars Life Day Oracle](https://jendave.itch.io/ill-be-home-for-life-day) * [Critical Success Oracles](https://jendave.itch.io/critical-success-oracles) * [I Owe My Soul to the Company Planet Oracles](https://jendave.itch.io/i-owe-my-soul-to-the-company-planet) * [Creature Rank Generator](https://jendave.itch.io/creature-rank-generator)