|
|
Line 31: |
Line 31: |
| '''Example:''' | | '''Example:''' |
|
| |
|
| Broken: <code><nowiki>{{Recipe|building=BrickOven}}</nowiki></code> | | Broken: <code><nowiki>{{Recipe|building=Alchemists' Hut}}</nowiki></code> |
|
| |
|
| {{Recipe|building=BrickOven}} | | {{Recipe|building=Alchemists' Hut}} |
|
| |
|
| Fixed: <code><nowiki>{{Recipe|building=Brick Oven}}</nowiki></code> | | Fixed: <code><nowiki>{{Recipe|building=Alchemist's Hut}}</nowiki></code> |
|
| |
|
| {{Recipe|building=Brick Oven}} | | {{Recipe|building=Alchemist's Hut}} |
|
| |
|
| 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. | | 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. |
Revision as of 03:49, 6 November 2023
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.
Building | Ingredient #1 options | Ingredient #2 options | Ingredient #3 options | Product |
|
| | | 10 Tea |
|
|
| | 10 Wine |
|
| | | 2 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.
Building | Ingredient #1 options | Ingredient #2 options | Ingredient #3 options | Product |
|
| | | 2 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:
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.
Building | Ingredient #1 options | Ingredient #2 options | Ingredient #3 options | Product |
|
| | | 2 Crystalized Dew |
2. product only
{{Recipe|Pie}}
Yields:
Recipes for Pie.
Building | Ingredient #1 options | Ingredient #2 options | Ingredient #3 options | Product |
|
|
| | 10 Pie |
|
|
| | 10 Pie |
|
|
| | 10 Pie |
|
|
| | 10 Pie |
|
|
| | 10 Pie |
3. building only
{{Recipe|building=Scribe}}
Yields:
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.