Template:Recipe/doc

From Against the Storm Official Wiki
< Template:Recipe
Revision as of 03:24, 31 October 2024 by Aeredor (talk | contribs) (Created to move documentation to a subpage)

Overview

Creates a detailed table showing one or more recipes.

Use whenever you need to show a wiki-linked, user-friendly, sortable, and always-up-to-date version of the in-game recipe book instead of a screenshot. You can get very specific and narrow down the table to only one recipe with the parameters.

The table mimics the in-game recipe book with the building, efficiency grade and production time, ingredients, and product or service.

The table is completely data-driven, based on the parameters. It validates input, retrieves all necessary data, and handles all formatting.

The normal usage for this template produces a large table that typically fills the width of the article. (In rare cases, the table can overrun into the margin. This is a known issue and steps have already been taken to reduce the width of the table.)

Parameters

Product, Building, or Ingredient

At least one of these is required, and combinations are allowed. All names provided must be spelled (and, for buildings, punctuated) correctly to match the in-game name. These names will be the same as the articles for those goods and buildings.

If you do not wish to write the code product= and building=, you may skip that. If you skip naming them, they must appear in that order, and you cannot skip the product name. The ingredient must always be named. In the future, because building names and resource names are mutually exclusive, this template may be made more flexible with the product and building parameter.

Parameter Type Description
product string The name of the product or service associated with the recipe. (If you specify a service, do not change the parameter name from product.) At least
one of these
is required.
building string The name of the building where the recipe is produced.
ingredient string The name of any ingredient in a recipe.
display "list" If you include display=list it overrides the table display into a bulleted list of products or buildings (depending on which you specified). Useful for populating larger tables or between paragraphs where displaying the entire recipe is excessive or irrelevant.

Errors

When a product, service, building, or ingredient is not spelled correctly or is not a valid name, the template returns an error message to help you locate the spelling or name mistake.

Example:

Broken: {{Recipe|building=Alchemists' Hut}}

Lua error in Module:RecipeController at line 160: You must specify a product, building, or ingredient. Please see the template documentation for how to use the parameters.


Fixed: {{Recipe|building=Alchemist's Hut}}

3 recipes in the Alchemist's Hut.
Building Grade Ingredient #1 Ingredient #2 Ingredient #3 Product
Alchemist's Hut
★★
1:24
3 Berries Berries
3 Mushrooms Mushrooms
3 Reed Reed
3 Pottery Pottery
3 Barrels Barrels
3 Waterskins Waterskins
10 Wine Wine
Alchemist's Hut
★★
2:06
3 Herbs Herbs
3 Dye Dye
3 Resin Resin
3 Mushrooms Mushrooms
3 Roots Roots
3 Drizzle Water Drizzle Water
4 Clearance Water Clearance Water
5 Storm Water Storm Water
3 Pottery Pottery
2 Barrels Barrels
3 Waterskins Waterskins
10 Tea Tea
Alchemist's Hut
★★
0:42
2 Herbs Herbs
2 Insects Insects
2 Resin Resin
2 Vegetables Vegetables
2 Algae Algae
3 Stone Stone
3 Clay Clay
8 Storm Water Storm Water
12 Clearance Water Clearance Water
16 Drizzle Water Drizzle Water
Crystalized Dew Crystalized Dew


There may be cases where the name you should use to look up a good or building is not the right name. Please post these to this template's discussion page.

Examples

Basic Usage for Products and Buildings

A standard use of the template to show exactly one recipe for a product or service, in one building:

{{Recipe|Crystalized Dew|Brickyard}}

Yields:

1 recipes for Crystalized Dew in the Brickyard.
Building Grade Ingredient #1 Ingredient #2 Ingredient #3 Product
Brickyard

0:42
3 Herbs Herbs
3 Insects Insects
3 Resin Resin
3 Vegetables Vegetables
3 Algae Algae
4 Stone Stone
4 Clay Clay
10 Storm Water Storm Water
14 Clearance Water Clearance Water
18 Drizzle Water Drizzle Water
Crystalized Dew


Alternatively, for a service building:

{{Recipe|Leisure|Tavern}}

Yields:

1 recipes for Leisure in the Tavern.
Building Grade Ingredient Product
Tavern

0:00
1 Ale Ale
Leisure


Here are several ways to call the template for products and buildings.

Parameter(s) Example(s) Expected outcome
no parameters {{Recipe}} an error
product (or service) and building {{Recipe|Crystalized Dew|Brickyard}}
{{Recipe|product=Crystalized Dew|building=Brickyard}}
A table with exactly one row.
product (or service) only {{Recipe|Pie}}
{{Recipe|product=Pie}}
A table with several rows, one for each building in which Pie can be produced.
building only {{Recipe||Market}} (note the double pipe)
{{Recipe|building=Market}}
A table with several rows, one for each service provided by the Market.
product (or service), but with output override {{Recipe|Crystalized Dew|display=list}} A short list of buildings and their efficiency stars that easily fit within another table:

Ingredients

Unlike when specifying the product (or service) and/or building, when you specify the ingredient, you explicitly must name the parameter with ingredient= in the template. Currently, you cannot select both a product and an ingredient (for example, all recipes where Berries are the ingredient and Pie is the product), because this is redundant with the product parameter by itself (since there is currently only one arrangement of ingredients and options that will make a product).

The results of specifying the ingredient without also filtering on a building can display a long table. But on a resource's page, this information is expected to be valuable.

{{Recipe|ingredient=Wine}}

Yields:

7 recipes using Wine.
Building Grade Ingredient #1 Ingredient #2 Product
Forum Forum
Tavern Tavern
Holy Guild House Holy Guild House
Guild House Guild House

0:00
1 Wine Wine
Luxury Luxury
Lumber Mill Lumber Mill
Rain Mill Rain Mill

1:24
4 Leather Leather
4 Plant Fiber Plant Fiber
10 Wood Wood
3 Dye Dye
3 Wine Wine
Scrolls Scrolls
Artisan Artisan
★★
1:24
3 Leather Leather
3 Plant Fiber Plant Fiber
8 Wood Wood
2 Dye Dye
2 Wine Wine
Scrolls Scrolls
Scribe Scribe
Flawless Rain Mill Flawless Rain Mill
★★★
1:03
2 Leather Leather
2 Plant Fiber Plant Fiber
6 Wood Wood
1 Dye Dye
1 Wine Wine
Scrolls Scrolls
Cooperage Cooperage

0:42
5 Wine Wine
5 Training Gear Training Gear
5 Incense Incense
5 Scrolls Scrolls
5 Ale Ale
5 Tea Tea
Pack of Luxury Goods Pack of Luxury Goods
Pantry Pantry
Carpenter Carpenter
★★
0:42
4 Wine Wine
4 Training Gear Training Gear
4 Incense Incense
4 Scrolls Scrolls
4 Ale Ale
4 Tea Tea
Pack of Luxury Goods Pack of Luxury Goods
Flawless Cooperage Flawless Cooperage
★★★
0:28
3 Wine Wine
3 Training Gear Training Gear
3 Incense Incense
3 Scrolls Scrolls
3 Ale Ale
3 Tea Tea
Pack of Luxury Goods Pack of Luxury Goods


{{Recipe|building=Lumber Mill|ingredient=Wine}}

Yields:

1 recipes using Wine in the Lumber Mill.
Building Grade Ingredient #1 Ingredient #2 Product
Lumber Mill

1:24
4 Leather Leather
4 Plant Fiber Plant Fiber
10 Wood Wood
3 Dye Dye
3 Wine Wine
Scrolls Scrolls


Further Examples and Errors

The following are generated by calling the template as shown in the parameter examples table above.

1. product and building:

{{Recipe|Crystalized Dew|Brickyard}}

Yields:

1 recipes for Crystalized Dew in the Brickyard.
Building Grade Ingredient #1 Ingredient #2 Ingredient #3 Product
Brickyard

0:42
3 Herbs Herbs
3 Insects Insects
3 Resin Resin
3 Vegetables Vegetables
3 Algae Algae
4 Stone Stone
4 Clay Clay
10 Storm Water Storm Water
14 Clearance Water Clearance Water
18 Drizzle Water Drizzle Water
Crystalized Dew


2. product only

{{Recipe|Pie}}

Yields:

3 recipes for Pie.
Building Grade Ingredient #1 Ingredient #2 Product
Smelter Smelter

2:06
6 Flour Flour
5 Herbs Herbs
5 Meat Meat
5 Insects Insects
5 Eggs Eggs
5 Berries Berries
5 Fish Fish
10 Pie
Pantry Pantry
Furnace Furnace
Bakery Bakery
★★
2:06
6 Flour Flour
4 Herbs Herbs
4 Meat Meat
4 Insects Insects
4 Eggs Eggs
4 Berries Berries
4 Fish Fish
10 Pie
Flawless Smelter Flawless Smelter
★★★
1:45
6 Flour Flour
3 Herbs Herbs
3 Meat Meat
3 Insects Insects
3 Eggs Eggs
3 Berries Berries
3 Fish Fish
10 Pie


3. building only

{{Recipe|building=Market}}

Yields:

2 recipes in the Market.
Building Grade Ingredient Product
Market

0:00
1 Ale Ale
Leisure Leisure
Market

0:00
1 Tea Tea
Treatment Treatment


4. with the output override

{{Recipe|Crystalized Dew|display=list}}

Yields:



5 with the output override but specifying a building

{{Recipe|building=Beanery|display=list}}

Yields:



The following are error states generated by calling the template incorrectly.

6. with no parameters

{{Recipe}}

Yields:

Lua error in Module:RecipeController at line 160: You must specify a product, building, or ingredient. Please see the template documentation for how to use the parameters.


7. using only one pipe and not specifying that the provided name is the building

{{Recipe|Scribe}}

Yields:

Lua error in Module:RecipeController at line 160: You must specify a product, building, or ingredient. Please see the template documentation for how to use the parameters.


8. asking for products or buildings with no recipes

{{Recipe|building=Small Warehouse}}

Yields:

0 recipes in the Small Warehouse.
No recipes.