Template:Recipe: Difference between revisions

From Against the Storm Official Wiki
(adding more description)
m (fixing the display on the template page with the special argument)
Line 40: Line 40:


{{Recipe}}
{{Recipe}}


<code><nowiki>{{Recipe|Crystalized Dew|Brickyard}}</nowiki></code> yields:
<code><nowiki>{{Recipe|Crystalized Dew|Brickyard}}</nowiki></code> yields:

Revision as of 22:01, 12 February 2023

Lua error in Module:RenderRecipe at line 120: attempt to call field 'getRecipeForProduct' (a nil value).

This template calls renderRecipe in Module:RenderRecipe to get recipes for a product and/or a building. This will generate a new wikitable full of content from the game: buildings, stars of efficiency, ingredients, and products.

This template standardizes the display of recipes throughout this wiki and greatly simplifies the amount of writing that is necessary when adding new content pages, especially for resources and buildings.


Usage

The table will contain exactly one recipe if the template is given both a product and building. The table will (usually) contain more than one row if the template is given either a product or a building. If nothing is provided, for example {{Recipe}}, an error will appear instead.

Here are ways to call the template, as they would be written in the article calling the template:

Argument Examples Expected outcome
None {{Recipe}} An error
Product and building {{Recipe|Crystalized Dew|Brickyard}}
{{Recipe|product=Crystalized Dew|building=Brickyard}}
A table with 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.


Examples

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

{{Recipe}} yields:

Lua error in Module:RenderRecipe at line 120: attempt to call field 'getRecipeForProduct' (a nil value).


{{Recipe|Crystalized Dew|Brickyard}} yields:

Lua error in Module:RenderRecipe at line 106: attempt to call field 'getRecipeAtBuilding' (a nil value).


{{Recipe|Pie}} yields:

Lua error in Module:RenderRecipe at line 120: attempt to call field 'getRecipeForProduct' (a nil value).


{{Recipe||Scribe}} yields:

Lua error in Module:RenderRecipe at line 142: attempt to call field 'getBuildingsRecipes' (a nil value).