Template:Recipe

From Against the Storm Official Wiki
Revision as of 03:49, 6 November 2023 by Aeredor (talk | contribs) (New example of punctuation mattering with Alchemist's Hut)


Generates recipe tables. Use this wherever you need to show how to use Goods or Buildings.

Overview

Create a concise, sortable table using game data to show in-game recipes. The table mimics the layout of the in-game recipe browser, with the building, efficiency of the recipe, number of ingredients, and the product.

Parameters

At least one of these is required. Depending on which parameters you provide, the table may ignore other parameters. If the names provided are not spelled correctly (including punctuation), matching their in-game names, the recipe will return an error.

Parameter Type Description
product string The name of the product associated with the recipe. Can be used in conjunction with building to display exactly one recipe.
building string The name of the building where the recipe is produced. Can be used in conjunction with product to display exactly one recipe.
ingredient string The name of an ingredient in a recipe. If you provide this parameter, the template does not filter the results further, but ignores the other parameters and returns a long table of all recipes where the ingredient could be used.

Errors

When a product, 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:RecipeData at line 274: No building found. Please check spelling and any punctuation like an apostrophe: Alchemists' Hut.


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

Recipes in the Alchemist's Hut.
BuildingIngredient #1 optionsIngredient #2 optionsIngredient #3 optionsProduct
Alchemist's HutAlchemist's Hut
★★
02:06
3Herbs Herbs
3Dye Dye
3Resin Resin
3Mushrooms Mushrooms
3Roots Roots
3Drizzle Water Drizzle Water
4Clearance Water Clearance Water
5Storm Water Storm Water
3Pottery Pottery
2Barrels Barrels
3Waterskins Waterskins
10 Tea Tea
Alchemist's HutAlchemist's Hut
★★
01:24
3Berries Berries
3Mushrooms Mushrooms
3Reed Reed
3Pottery Pottery
3Barrels Barrels
3Waterskins Waterskins
10 Wine Wine
Alchemist's HutAlchemist's Hut
★★
00:42
2Herbs Herbs
2Insects Insects
2Resin Resin
2Vegetables Vegetables
2Algae Algae
3Stone Stone
3Clay Clay
8Storm Water Storm Water
12Clearance Water Clearance Water
16Drizzle Water Drizzle Water
2 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, in one building:

{{Recipe|Crystalized Dew|Brickyard}}

Yields:

Recipe for Crystalized Dew in the Brickyard.
BuildingIngredient #1 optionsIngredient #2 optionsIngredient #3 optionsProduct
BrickyardBrickyard

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


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

Argument Examples Expected outcome
no parameters {{Recipe}} an error
product and building {{Recipe|Crystalized Dew|Brickyard}}
{{Recipe|product=Crystalized Dew|building=Brickyard}}
A table with exactly one row.
product only {{Recipe|Pie}}
{{Recipe|product=Pie}}
A table with several rows, one for each building in which Pie can be produced.
building only {{Recipe||Scribe}} (note the double pipe)
{{Recipe|building=Scribe}}
A table with several rows, one for each product that can be produced in the Scribe.

Ingredients

Unlike when specifying the product and/or building, when you specify the ingredient, you explicitly must name the parameter (with ingredient=...). When you do so, the template ignores the other parameters you may have provided. This can be confusing if, for example, you are looking for all of the recipes in the Brick Oven that use Herbs—this is not possible at this time. This may be fixed in the future if there are sufficient needs for further filtering.

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

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

Both result in:

Recipes that require Wine.
BuildingIngredient #1 optionsIngredient #2 optionsIngredient #3 optionsProduct
Lumber MillLumber Mill

01:24
4Leather Leather
4Plant Fiber Plant Fiber
10Wood Wood
3Dye Dye
3Wine Wine
8 Scrolls Scrolls
Rain MillRain Mill

01:24
4Leather Leather
4Plant Fiber Plant Fiber
10Wood Wood
3Dye Dye
3Wine Wine
8 Scrolls Scrolls
Flawless CooperageFlawless Cooperage
★★★
00:28
3Wine Wine
3Training Gear Training Gear
3Incense Incense
3Scrolls Scrolls
3Ale Ale
3Tea Tea
2 Pack of Luxury Goods Pack of Luxury Goods
PantryPantry
★★
00:42
4Wine Wine
4Training Gear Training Gear
4Incense Incense
4Scrolls Scrolls
4Ale Ale
4Tea Tea
2 Pack of Luxury Goods Pack of Luxury Goods
CarpenterCarpenter
★★
00:42
4Wine Wine
4Training Gear Training Gear
4Incense Incense
4Scrolls Scrolls
4Ale Ale
4Tea Tea
2 Pack of Luxury Goods Pack of Luxury Goods
CooperageCooperage

00:42
5Wine Wine
5Training Gear Training Gear
5Incense Incense
5Scrolls Scrolls
5Ale Ale
5Tea Tea
2 Pack of Luxury Goods Pack of Luxury Goods
ScribeScribe
★★★
01:03
2Leather Leather
2Plant Fiber Plant Fiber
6Wood Wood
1Dye Dye
1Wine Wine
8 Scrolls Scrolls
Flawless Rain MillFlawless Rain Mill
★★★
01:03
2Leather Leather
2Plant Fiber Plant Fiber
6Wood Wood
1Dye Dye
1Wine Wine
8 Scrolls Scrolls
ArtisanArtisan
★★
01:24
3Leather Leather
3Plant Fiber Plant Fiber
8Wood Wood
2Dye Dye
2Wine Wine
8 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:

Recipe for Crystalized Dew in the Brickyard.
BuildingIngredient #1 optionsIngredient #2 optionsIngredient #3 optionsProduct
BrickyardBrickyard

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


2. product only

{{Recipe|Pie}}

Yields:

Recipes for Pie.
BuildingIngredient #1 optionsIngredient #2 optionsIngredient #3 optionsProduct
SmelterSmelter

02:06
6Flour Flour
5Herbs Herbs
5Meat Meat
5Insects Insects
5Eggs Eggs
5Berries Berries
5Fish Fish
10 Pie Pie
Flawless SmelterFlawless Smelter
★★★
01:45
6Flour Flour
3Herbs Herbs
3Meat Meat
3Insects Insects
3Eggs Eggs
3Berries Berries
3Fish Fish
10 Pie Pie
PantryPantry
★★
02:06
6Flour Flour
4Herbs Herbs
4Meat Meat
4Insects Insects
4Eggs Eggs
4Berries Berries
4Fish Fish
10 Pie Pie
FurnaceFurnace
★★
02:06
6Flour Flour
4Herbs Herbs
4Meat Meat
4Insects Insects
4Eggs Eggs
4Berries Berries
4Fish Fish
10 Pie Pie
BakeryBakery
★★
02:06
6Flour Flour
4Herbs Herbs
4Meat Meat
4Insects Insects
4Eggs Eggs
4Berries Berries
4Fish Fish
10 Pie Pie


3. building only

{{Recipe|building=Scribe}}

Yields:

Recipes in the Scribe.
BuildingIngredient #1 optionsIngredient #2 optionsIngredient #3 optionsProduct
ScribeScribe

02:06
6Grain Grain
6Roots Roots
3Pottery Pottery
2Barrels Barrels
3Waterskins Waterskins
10 Ale Ale
ScribeScribe
★★★
01:03
2Leather Leather
2Plant Fiber Plant Fiber
6Wood Wood
1Dye Dye
1Wine Wine
8 Scrolls Scrolls
ScribeScribe
★★
00:42
6Dye Dye
6Oil Oil
4Flour Flour
4Pottery Pottery
4Barrels Barrels
4Waterskins Waterskins
2 Pack of Trade Goods Pack of Trade Goods


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

4. with no parameters

{{Recipe}}

Yields:

The Recipe template requires that you specify at least one of the following: product, building, or ingredient.


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

{{Recipe|Scribe}}

Yields:

Lua error in Module:RecipeData at line 143: No product found. Please check spelling and any punctuation like an apostrophe: Scribe.


6. asking for products or buildings with no recipes

{{Recipe|Market}}

Yields:

Lua error in Module:RecipeData at line 274: No building found. Please check spelling and any punctuation like an apostrophe: Market.