v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Reaction"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Clarify description)
(there's no point in listing invalid inputs, because there are infinitely many (and besides, Jeweler wasn't the only one anyways - there was also Mechanics, Butcher, Fishery, Loom, and Dyer))
 
(125 intermediate revisions by 25 users not shown)
Line 1: Line 1:
{{Quality|Superior|19:56, 28 August 2013 (UTC)}}
+
{{Quality|Superior}}
 
{{av}}
 
{{av}}
 +
{{Modding}}
  
Reactions are modular, editable formulas that take specific ingredients, or reagents, and use them to produce a desired item.  A lot of reactions are hardcoded—building beds or creating glass, for example—but a few are freely editable, and it's (sometimes) quite simple to add additional ones. There is a separate page with custom [[reaction examples]].
+
'''Reactions''' are modular, editable formulas that take specific ingredients, or reagents, and use them to produce a desired item.  A lot of reactions are hardcoded—building beds or creating glass, for example—but a few are freely editable, and it's (sometimes) quite simple to add additional ones. There is a separate page with custom [[reaction examples]].
  
 
== Reaction differences between modes ==
 
== Reaction differences between modes ==
 +
{{migrated section}}
  
 
In [[fortress mode]], reactions are linked to specific buildings, and must be added to a civilization's [[entity token|entity file]] to be usable by that civilization. This has the useful effect of limiting new items and materials (such as special [[wood]] or [[metal]]) to civilizations that have the requisite reaction — so that if you give your custom civilization a reaction to produce "star metal" or some other custom material, only they will be able to use it.
 
In [[fortress mode]], reactions are linked to specific buildings, and must be added to a civilization's [[entity token|entity file]] to be usable by that civilization. This has the useful effect of limiting new items and materials (such as special [[wood]] or [[metal]]) to civilizations that have the requisite reaction — so that if you give your custom civilization a reaction to produce "star metal" or some other custom material, only they will be able to use it.
Line 11: Line 13:
  
 
== Anatomy of a reaction ==
 
== Anatomy of a reaction ==
 +
Reactions are found within reaction_x files (such as reaction_smelter or reaction_other).  All reaction files must begin with the file name, followed by the <code>[OBJECT:REACTION]</code> token that tells the game that the file contains reaction definitions.
  
Reactions are found within reaction_x files (such as reaction_smelter or reaction_other).  Generally speaking they adhere to the following structure:
+
The reactions themselves generally adhere to the following structure:
  
 
   [REACTION:<identifier>]
 
   [REACTION:<identifier>]
Line 21: Line 24:
 
       [FUEL]  
 
       [FUEL]  
 
       [SKILL:<SKILL TOKEN>]
 
       [SKILL:<SKILL TOKEN>]
 +
      [MAX_MULTIPLIER:<multiplier>]
 
       [AUTOMATIC]
 
       [AUTOMATIC]
 
       [ADVENTURE_MODE_ENABLED]
 
       [ADVENTURE_MODE_ENABLED]
 +
      [DESCRIPTION:<description>]
 +
 
* ''[[#Reaction identifier|identifier]]'': The internal ID of the reaction.
 
* ''[[#Reaction identifier|identifier]]'': The internal ID of the reaction.
 
* ''[[#Reaction name|name]]'': The name of the reaction, visible to the player in the Fortress mode or Adventure mode menus.
 
* ''[[#Reaction name|name]]'': The name of the reaction, visible to the player in the Fortress mode or Adventure mode menus.
Line 28: Line 34:
 
* ''[[#Reagents|...reagents...]]'': Zero or more reagents (ingredients) that are required to be in stock for the reaction to be possible.
 
* ''[[#Reagents|...reagents...]]'': Zero or more reagents (ingredients) that are required to be in stock for the reaction to be possible.
 
* ''[[#Products|...products...]]'': Zero or more products that are created from the reaction.
 
* ''[[#Products|...products...]]'': Zero or more products that are created from the reaction.
* ''[[#fuel|fuel]]'': (optional) If present, the reaction requires charcoal, coke or a magma-powered workshop.
+
* ''[[#Fuel|fuel]]'': (optional) If present, the reaction requires charcoal, coke or a magma-powered workshop.
* ''[[#skill|skill]]'': (optional) The skill required and trained by the reaction.
+
* ''[[#Skill|skill]]'': (optional) The skill required and trained by the reaction.
* ''[[#automatic|automatic]]'': (optional) If present, the reaction will automatically be enqueued whenever it can possibly be performed.
+
* ''[[#Max multiplier|multiplier]]'': (optional) If present, the reaction will only be done the specified number of times per job; used to limit the output of reactions that accept stacks of items as reagents.
* ''[[#adventure mode|adventure mode]]'': (optional) If present, the reaction is used by the player in Adventure mode instead.
+
* ''[[#Automatic|automatic]]'': (optional) If present, the reaction will automatically be enqueued whenever it can possibly be performed.
 +
* ''[[#Adventure mode enabled|adventure mode enabled]]'': (optional) If present, the reaction can be used by the player in Adventure mode.
 +
* ''[[#Description|description]]'': (optional) If present, shows pop-up description when the reaction is selected in workshop (not working in v50).
  
 
=== Reaction identifier ===
 
=== Reaction identifier ===
 +
The REACTION token assigns a unique ID to your reaction.
 +
    [REACTION:<reaction identifier>]
  
The reaction identifier may be anything, so long as it is unique within the raw data files. A good habit to get into is to append a short prefix or suffix to each name related to the name of your mod, to ensure nobody else is going to make an identical reaction and thereby mess up the game if their mod is run alongside yours.
+
The ''reaction identifier'' may be anything, so long as it is unique within the raw data files. A good habit to get into is to append a short prefix or suffix to each name related to the name of your mod, to ensure nobody else is going to make an identical reaction and thereby mess up the game if their mod is run alongside yours.  This is referenced in an entity definition via [[Entity_token#PERMITTED_REACTION|PERMITTED_REACTION]] to allow that entity to use the reaction.
  
 
=== Reaction name ===
 
=== Reaction name ===
 +
The REACTION_NAME token assigns a descriptive name to your reaction in-game.
 +
    [REACTION_NAME:<name>]
  
This can be anything at all, and is usually used to describe the reaction. '''Tan a hide''', for example, is the name of the default leather-producing reaction. Generally this should be written as a small descriptive verb phrase, with the first letter capitalized, for consistency with the existing reactions.
+
==== Name ====
 +
This can be anything at all, and is how the reaction will appear in the job list of the building it is assigned to, and so should describe the reaction. '''Tan a hide''', for example, is the name of the default leather-producing reaction. Generally this should be written as a small descriptive verb phrase, with the first letter capitalized, for consistency with the existing reactions.
  
 
=== Building ===
 
=== Building ===
 +
The BUILDING token assigns the reaction to a building.  Adding multiple BUILDING tokens will cause the reaction to be available at all of the specified buildings.  Omitting the BUILDING token entirely will make the reaction unusable in Fortress mode (often used to restrict certain reactions to [[Reaction#Adventure_Mode_enabled|Adventure mode]]).
  
     [BUILDING:<BUILDING NAME>:<BUILDING KEY>]
+
     [BUILDING:<building name>:<building key>]
* ''name'': The ID (that is the internal TOKEN each building can be referred to into reactions) of the building where this reaction will appear in the tasks menu.
+
* [[#Building name|''building name:'']] The ID of the building the reaction appears in.
* ''key'': The keyboard shortcut used to queue up the reaction.
+
* [[#Building key|''building key:'']] The hotkey to queue up the reaction in the specified building.
  
The BUILDING NAME is the name of the building that will house this reaction, and the building key is the keyboard shortcut that will queue up the reaction. If two reactions have the same key, then one of them will be assigned a different key, the first alphabetically available at the building.
+
==== Building name ====
 +
This is the ID of the building where the reaction will be carried out.  Valid building names are as follows:
  
Valid buildings TOKENS are as follows:
+
* ASHERY - [[Ashery]]
 +
* BOWYER - [[Bowyer's workshop]]
 +
* CARPENTER - [[Carpenter's workshop]]
 +
* CLOTHES - [[Clothier's shop]]
 +
* CRAFTSMAN - [[Craftsdwarf's workshop]]
 +
* FARMER - [[Farmer's workshop]]
 +
* GLASS - [[Glass furnace]]
 
* KILN - [[Kiln]] and [[Magma kiln]]
 
* KILN - [[Kiln]] and [[Magma kiln]]
* SMELTER - [[Smelter]] and [[Magma smelter]]
 
* TANNER - [[Tanner's shop]]
 
 
* KITCHEN - [[Kitchen]]
 
* KITCHEN - [[Kitchen]]
 +
* LEATHER - [[Leather works]]
 +
* MASON - [[Stoneworker's workshop]]
 +
* METALSMITH - [[Metalsmith's forge]]
 +
* MILLSTONE - [[Millstone]]
 
* QUERN - [[Quern]]
 
* QUERN - [[Quern]]
* MILLSTONE - [[Millstone]]
+
* SIEGE - [[Siege workshop]]
 +
* SMELTER - [[Smelter]] and [[Magma smelter]]
 
* STILL - [[Still]]
 
* STILL - [[Still]]
* FARMER - [[Farmer's workshop]]
+
* TANNER - [[Tanner's shop]]
* CRAFTSMAN - [[Craftsdwarf's workshop]]
+
* WOOD - [[Wood furnace]]
* GLASS{{version|0.42.01}} - [[Glass furnace]]
+
* Any custom (raw-defined) building, such as:
* WOOD{{version|0.42.01}} - [[Wood furnace]]
 
* MASON{{version|0.42.01}} - [[Mason's workshop]]
 
* ASHERY{{version|0.42.01}} - [[Ashery]]
 
* LEATHER{{version|0.42.01}} - [[Leather works]]
 
* BOWYER{{version|0.42.01}} - [[Bowyer's workshop]]
 
* SIEGE{{version|0.42.01}} - [[Siege workshop]]
 
* CLOTHES{{version|0.42.01}} - [[Clothier's shop]]
 
* METALSMITH{{version|0.42.01}} - [[Metalsmith's forge]]
 
* CARPENTER{{version|0.42.01}} - [[Carpenter's workshop]]
 
* Any custom (raw-defined) building type, such as:
 
 
** SOAP_MAKER - [[Soap maker's workshop]]
 
** SOAP_MAKER - [[Soap maker's workshop]]
 
** SCREW_PRESS - [[Screw press]]
 
** SCREW_PRESS - [[Screw press]]
  
Specifying multiple BUILDING tokens will cause the reaction to be available at all of the specified buildings.
+
==== Building key ====
 +
This defines the shortcut key(s) used to queue up the reaction in the workshop during gameplay in Classic mode only.  It can be NONE for no shortcut, or take the format of CUSTOM_X, where X can be: any uppercase letter, which shows as a lowercase letter in the building UI, eg. "CUSTOM_A" creates the shortcut {{k|a}}; or a valid modifier key (ALT, CTRL, or SHIFT) followed by an uppercase letter, eg. CUSTOM_SHIFT_A.
  
 
=== Category ===
 
=== Category ===
 
{{new in v0.42}}
 
  
 
Categories are custom submenus for buildings' reaction menus. A reaction doesn't require a category, but if you have a lot of reactions, categories can be invaluable for organizing and presenting those reactions to players.
 
Categories are custom submenus for buildings' reaction menus. A reaction doesn't require a category, but if you have a lot of reactions, categories can be invaluable for organizing and presenting those reactions to players.
  
 
Categories can be nested indefinitely—you can have a category within a category within a category within a category within a category within... but as a practical matter, nesting categories more than 2 deep is not recommended.
 
Categories can be nested indefinitely—you can have a category within a category within a category within a category within a category within... but as a practical matter, nesting categories more than 2 deep is not recommended.
 +
 +
Categories will be displayed in alphabetical order, first off the file name and then off the category name. 
  
 
Categories currently have no effect on adventure mode reactions.
 
Categories currently have no effect on adventure mode reactions.
Line 95: Line 110:
 
! Description
 
! Description
 
|-
 
|-
| CATEGORY || Category ID || The category ID is a unique identifier for the category. It is only used in the raws, and will not appear in the game.
+
| style="vertical-align: top"| CATEGORY || style="vertical-align: top"| Category ID || The category ID is a unique identifier for the category. It is only used in the raws, and will not appear in the game.
  
 
If you're defining multiple categories within the same reaction - for example, if you intend the reaction to be nested two deep, and haven't yet defined the super-category - the ''last'' CATEGORY token within the reaction definition is the one that the reaction will appear in.
 
If you're defining multiple categories within the same reaction - for example, if you intend the reaction to be nested two deep, and haven't yet defined the super-category - the ''last'' CATEGORY token within the reaction definition is the one that the reaction will appear in.
 
|-
 
|-
| CATEGORY_NAME || String || The name of the category as displayed in-game.
+
| style="vertical-align: top"| CATEGORY_NAME || style="vertical-align: top"| String || The name of the category as displayed in-game.
 
|-
 
|-
| CATEGORY_DESCRIPTION || String || Optional. If present, when the category is highlighted in a building menu, this string will be displayed in the Helpful Hint box.
+
| style="vertical-align: top"| CATEGORY_DESCRIPTION || style="vertical-align: top"| String || Optional. If present, when the category is highlighted in a building menu, this string will be displayed in the Helpful Hint box.
 
|-
 
|-
| CATEGORY_PARENT || Category ID || Optional. If present, this category will be a submenu of the indicated category, rather than a submenu of the reaction's building.
+
| style="vertical-align: top"| CATEGORY_PARENT || style="vertical-align: top"| Category ID || Optional. If present, this category will be a submenu of the indicated category, rather than a submenu of the reaction's building.
 
|-
 
|-
| CATEGORY_KEY || [[interface.txt|Hotkey token]] || Optional. If present, this category can be selected from its parent menu (whether a building or a parent category) using the given hotkey.
+
| style="vertical-align: top"| CATEGORY_KEY || style="vertical-align: top"| Hotkey token || Optional. If present, this category can be selected from its parent menu (whether a building or a parent category) using the given hotkey.  Uses the same format as the BUILDING KEY described above.
 
|}
 
|}
  
Line 119: Line 134:
  
 
     [REAGENT:<name>:<quantity>:<item token>:<material token>][...modifiers...]
 
     [REAGENT:<name>:<quantity>:<item token>:<material token>][...modifiers...]
* ''[[#name|name]]'': The name of the reagent, local to the reaction.
+
* ''[[#Reagent name|name]]'': The name of the reagent, local to the reaction.
* ''[[#quantity|quantity]]'': The amount of the item that will be used in the reaction.
+
* ''[[#Quantity|quantity]]'': The amount of the item that will be used in the reaction.
* ''[[#item_token|item token]]'': The type (and subtype) of the item you require.
+
* ''[[#Item_token|item token]]'': The type (and subtype) of the item you require.
* ''[[#material_token|material token]]'': The material the item should be made of.
+
* ''[[#Material_token|material token]]'': The material the item should be made of.
 
* ''[[#Modifiers|...modifiers...]]'': Zero or more tokens which further clarify the acceptable types when the item type and material types are insufficient to distinguish them.
 
* ''[[#Modifiers|...modifiers...]]'': Zero or more tokens which further clarify the acceptable types when the item type and material types are insufficient to distinguish them.
  
==== name ====
+
==== <span id="Reagent name">Name</span> ====
  
 
The name field is a small string used to identify the reagent within the reaction. The name is not visible to the player. It is local to the reaction and does not need to be unique across all of the reactions, so you can reuse the same names over and over, although each reagent within the same individual reaction must have a different name.
 
The name field is a small string used to identify the reagent within the reaction. The name is not visible to the player. It is local to the reaction and does not need to be unique across all of the reactions, so you can reuse the same names over and over, although each reagent within the same individual reaction must have a different name.
  
Most reagents are simply named '''A''', '''B''', and so forth in default reactions, although names such as '''TOOLSTONE''' or '''FLUX''' will also work equally well. The PRODUCT may make reference to this name &ndash; for instance, if a container '''B''' is specified as a reagent, PRODUCT_TO_CONTAINER:B specifies that container.
+
Most reagents are simply named '''A''', '''B''', and so forth in default reactions, although names such as '''TOOLSTONE''', '''FLUX''', or '''seeds''' will also work equally well. The PRODUCT may make reference to this name &ndash; for instance, if a container '''B''' is specified as a reagent, PRODUCT_TO_CONTAINER:B specifies that container.
  
==== quantity ====
+
==== Quantity ====
  
The quantity differs between item types. Generally speaking, cloth, thread, powder, bars, liquids and globs use numbers representing the size of material within one item, and everything else uses a static quantity. While REAGENT:A:'''''10''''':'''''THREAD''''':NONE:NONE:NONE thread is an extremely tiny portion of a random spool of thread, REAGENT:A:'''''10''''':'''''TOY''''':NONE:NONE:NONE is ten unique, solid toy items.
+
How many or how much of this reagent the reaction requires.  For most item types this is just the number of them required. However, some other item types─specifically bars, cloth, thread, globs, liquids, powder, and sheets of paper or parchment─instead use numbers representing the size of the material within one (or more) of these items. For example, while REAGENT:A:'''''10''''':'''''TOY''''':NONE:NONE:NONE is ten unique, solid toy items, REAGENT:A:'''''10''''':'''''THREAD''''':NONE:NONE:NONE is an extremely tiny portion of a random spool of thread. One can see which items have what size quantities in the description of the [[Reaction#PRODUCT_DIMENSION|PRODUCT_DIMENSION]] token.
  
If one of the reagents is in a stack, the reaction will use the entire stack and multiply the product--for example, using only 1 BAR instead of 150 BAR will multiply the product quantity by 150. One can see which items have what quantities in the description of the [[Reaction#PRODUCT_DIMENSION]] token.
+
If one of the reagents is in a stack, or the reaction is only using a fraction of the amount of a sized item, the reaction will consume the entire stack, or as much of the sized item as possible, and multiply the product accordingly. This behaviour can be controlled using the [[Reaction#MAX_MULTIPLIER|MAX_MULTIPLIER]] token.
  
==== item token ====
+
==== Item token ====
  
 
[[Item token]]s are of the form ITEM_TYPE:ITEM_SUBTYPE.
 
[[Item token]]s are of the form ITEM_TYPE:ITEM_SUBTYPE.
  
The item type is the sort of item you require; WEAPON, TOY or SKIN_TANNED, for example. A [[item token|full list]] is available.
+
The ITEM_TYPE is the category of item you require; WEAPON, TOY or SKIN_TANNED, for example.
 +
 
 +
The ITEM_SUBTYPE is name of the exact item that you require. Examples are ITEM_WEAPON_SPEAR or ITEM_TOY_PUZZLEBOX. Some items, like quivers or backpacks, or chunks of stone or metal, have no subtype and only require the item token to be filled in; so if you're asking for those you should set the subtype to NONE. Subtypes are defined within the local raw data files and their exact names can be referenced by looking at the corresponding file.
  
 
For reagents, the item token can also be set to ANY_RAW_MATERIAL:NONE (to permit BAR, BOULDER, POWDER_MISC, or GLOB) or ANY_CRAFT:NONE (to permit FIGURINE, AMULET, SCEPTER, CROWN, RING, EARRING, or BRACELET). Internally, these special values are both converted to NONE:NONE and merely set special modifiers (similar to [BUILDMAT])—they cannot be used in any other context.
 
For reagents, the item token can also be set to ANY_RAW_MATERIAL:NONE (to permit BAR, BOULDER, POWDER_MISC, or GLOB) or ANY_CRAFT:NONE (to permit FIGURINE, AMULET, SCEPTER, CROWN, RING, EARRING, or BRACELET). Internally, these special values are both converted to NONE:NONE and merely set special modifiers (similar to [BUILDMAT])—they cannot be used in any other context.
  
The item subtype is name of the exact item that you require. Examples are ITEM_WEAPON_SPEAR or ITEM_TOY_PUZZLEBOX. Some items, like quivers or backpacks, or chunks of stone or metal, only require the item token to be filled in, so if you're asking for those you should set the subtype to NONE. Subtypes are defined within the local raw data files and their exact names can be referenced by looking at the corresponding file.
+
For backwards compatibility, reagents can also accept "METAL_ORE:metal_id" in place of both the item and material tokens—this is equivalent to using the reagent BOULDER:NONE:NONE:NONE with the modifier [METAL_ORE:metal_id] (see below).
  
For backwards compatibility, reagents can also accept "METAL_ORE:metal_id" in place of both the item and material tokens—this is equivalent to using the reagent BOULDER:NONE:NONE:NONE with the modifier [METAL_ORE:metal_id] (see below).
+
==== Material token ====
  
==== material token ====
+
[[Material token]]s come in several forms. For most reagents, this will typically be INORGANIC:MATERIAL_ID or NONE:NONE (to allow multiple materials using other modifier tokens).
  
[[Material token]]s come in several forms. For most reagents, this will typically be INORGANIC:MATERIAL_ID or NONE:NONE (to allow multiple materials using other filters).
+
Some reactions will allow the player to select specific materials after creating the job (or in [[Reaction#material_token_2|some cases]], armor size from the product), by clicking on the magnifying glass icon next to the job in the workshop queue. To permit this behaviour in your reaction, the reagent materials must be specified as follows:
 +
{| {{prettytable}}
 +
|- bgcolor="#dddddd"
 +
! Item Type
 +
! Material
 +
! Notes
 +
|-
 +
| style="vertical-align: top"| BAR<br>BLOCKS<br>BOULDER<br>ROUGH<br>SMALLGEM || style="vertical-align: top"| INORGANIC:NONE || style="vertical-align: top"| These all appear as "stone" in the material selection menu, and list all inorganic materials regardless of any material modifier tokens, eg. [ITEMS_METAL]. BAR and BLOCKS made of organic materials, and BOULDER made of clay, are excluded.
 +
|-
 +
| style="vertical-align: top"| SKIN_TANNED or WOOD || style="vertical-align: top"| NONE:NONE ||
 +
|-
 +
| style="vertical-align: top"| Other Item Types || style="vertical-align: top"| NONE:NONE || style="vertical-align: top"| These will appear if a material modifier token other than [ANY_LEATHER_MATERIAL] is included.  
 +
|}
  
 
==== Modifiers ====
 
==== Modifiers ====
  
Reagents may also have extra tokens added on afterwards, placed just after the REAGENT tag.
+
Reagents may also have extra tokens added on, following the REAGENT token, in order to modify their behaviour.
  
Generally speaking, if you set a field in a reagent to NONE, the reaction won't discriminate when it comes to that particular field. For example, if you require a BOULDER reagent but leave the material as NONE:NONE, it will grab any available BOULDER-type item regardless of material.
+
Generally speaking, if you set a field in a reagent to NONE, the reaction won't discriminate when it comes to that particular field. For example, if you require a BOULDER reagent but leave the material as NONE:NONE, it will grab any available BOULDER-type item regardless of material. Modifiers can then be used to restrict this to only certain broad classes of materials.
  
A list of them follows:
+
The following is a list of all known reagent modifiers:
  
 
{| {{prettytable}}
 
{| {{prettytable}}
 
|- bgcolor="#dddddd"
 
|- bgcolor="#dddddd"
 
! Token
 
! Token
! Meaning
+
! Arguments
 +
! Description
 
|-
 
|-
| [REACTION_CLASS:X]
+
| style="vertical-align: top"| ANY_BONE_MATERIAL
| Reagent material must have the specified reaction class - see below for more details.
+
|
 +
| Reagent material must have the [BONE] token.
 
|-
 
|-
| [HAS_MATERIAL_REACTION_PRODUCT:X]
+
| style="vertical-align: top"| ANY_GEM_MATERIAL
| Reagent material must have the specified material reaction product - see below for more details.
+
|
 +
| Reagent material must have the [IS_GEM] token.
 
|-
 
|-
| [HAS_ITEM_REACTION_PRODUCT:X]
+
| style="vertical-align: top"| ANY_HORN_MATERIAL
| Reagent material must have the specified item reaction product - see below for more details. This can be used interchangeably with HAS_MATERIAL_REACTION_PRODUCT.
+
|
 +
| Reagent material must have the [HORN] token.
 
|-
 
|-
| [CONTAINS:X]
+
| style="vertical-align: top"| ANY_LEATHER_MATERIAL
| Reagent is a container that holds the specified reagent (where ''X'' is the [[#name|name]] of the reagent).
+
|
 +
| Reagent material must have the [LEATHER] token.
 
|-
 
|-
| [UNROTTEN]
+
| style="vertical-align: top"| ANY_PEARL_MATERIAL
| Reagent must not be rotten, mainly for organic materials.
+
|
 +
| Reagent material must have the [PEARL] token.
 
|-
 
|-
| style="vertical-align: top"| [CONTAINS_LYE]
+
| style="vertical-align: top"| ANY_PLANT_MATERIAL
| Reagent must be a BARREL or TOOL which contains at least one item of type LIQUID_MISC made of LYE. Use of this token is discouraged, as it does not work with buckets (instead, use [CONTAINS:lye] &mdash; note the colon &mdash; and a corresponding lye reagent [REAGENT:lye:150:LIQUID_MISC:NONE:LYE]).
+
|
 +
| Reagent material must be subordinate to a PLANT object.
 
|-
 
|-
| [POTASHABLE] (Deprecated)
+
| style="vertical-align: top"| ANY_SHELL_MATERIAL
| Alias for [CONTAINS_LYE].
+
|
 +
| Reagent material must have the [SHELL] token.
 
|-
 
|-
| [NOT_WEB]
+
| style="vertical-align: top"| ANY_SILK_MATERIAL
| Reagent must be collected (to distinguish silk thread from webs). Only makes sense for items of type THREAD.
+
|
 +
| Reagent material must have the [SILK] token.
 
|-
 
|-
| [WEB_ONLY]
+
| style="vertical-align: top"| ANY_SOAP_MATERIAL
| Reagent must be undisturbed (to distinguish silk thread from webs). Only makes sense for items of type THREAD.
+
|
 +
| Reagent material must have the [SOAP] token.
 
|-
 
|-
| [EMPTY]
+
| style="vertical-align: top"| ANY_STONE_MATERIAL
| If the reagent is a container, it must be empty.
+
|
 +
| Reagent material must have the [IS_STONE] token.
 
|-
 
|-
| [NOT_CONTAIN_BARREL_ITEM]
+
| style="vertical-align: top"| ANY_STRAND_TISSUE
| If the reagent is a container, it must not contain [[lye]] or [[milk]]. Not necessary if specifying [EMPTY].
+
|
 +
| Reagent is made of a tissue having TISSUE_SHAPE:STRANDS, intended for matching hair and wool. Must be used with USE_BODY_COMPONENT.
 
|-
 
|-
| [BAG]
+
| style="vertical-align: top"| ANY_TOOTH_MATERIAL
| Reagent must be a bag - that is, a BOX made of plant fiber, silk, yarn, or leather.
+
|
 +
| Reagent material must have the [TOOTH] token.
 
|-
 
|-
| [GLASS_MATERIAL]
+
| style="vertical-align: top"| ANY_WOOD_MATERIAL
| Reagent material must have the [IS_GLASS] token. All 3 types of [[glass]] have this token hardcoded.
+
|
 +
| Reagent material must have the [WOOD] token.
 
|-
 
|-
| [BUILDMAT]
+
| style="vertical-align: top"| ANY_YARN_MATERIAL
 +
|
 +
| Reagent material must have the [YARN] token.
 +
|-
 +
| style="vertical-align: top"| BUILDMAT
 +
|
 
| Reagent must be a general [[building material]] - BAR, BLOCKS, BOULDER, or WOOD.
 
| Reagent must be a general [[building material]] - BAR, BLOCKS, BOULDER, or WOOD.
 
|-
 
|-
| [FIRE_BUILD_SAFE]
+
| style="vertical-align: top"| CAN_USE_ARTIFACT
| Reagent material must be solid and stable at temperatures approaching 11000. Only works with items of type BAR, BLOCKS, BOULDER, WOOD, and ANVIL - all others are considered unsafe.
+
|
 +
| Reagent can be an Artifact. Using [PRESERVE_REAGENT] with this is strongly advised.
 +
|-
 +
| style="vertical-align: top"| CONTAINS
 +
| style="vertical-align: top"|
 +
* [[#Reagent name|Reagent name]]
 +
| Reagent is a container that holds the specified reagent (where ''Reagent name'' is the locally-defined name of the reagent).
 
|-
 
|-
| [MAGMA_BUILD_SAFE]
+
| style="vertical-align: top"| CONTAINS_LYE
| Reagent material must be solid and stable at temperatures approaching 12000. Only works with items of type BAR, BLOCKS, BOULDER, WOOD, and ANVIL - all others are considered unsafe.
+
|
 +
| Reagent must be a BARREL or TOOL which contains at least one item of type LIQUID_MISC made of LYE. Use of this token is discouraged, as it does not work with buckets (instead, use [CONTAINS:lye] &mdash; note the colon &mdash; and a corresponding lye reagent [REAGENT:lye:150:LIQUID_MISC:NONE:LYE]).
 
|-
 
|-
| [CAN_USE_ARTIFACT]
+
| style="vertical-align: top"| DOES_NOT_ABSORB
| Reagent can be an Artifact. Using [PRESERVE_REAGENT] with this is strongly advised.
+
|
 +
| Reagent material must have ABSORPTION:0
 
|-
 
|-
| [WORTHLESS_STONE_ONLY]
+
| style="vertical-align: top"| DOES_NOT_DETERMINE_PRODUCT_AMOUNT
| Reagent material must be non-[[economic]].
+
|
 +
| Reagent quantity is ignored for the purposes of producing extra outputs. Typically used for containers so that [[stack]]s of reagents will correctly produce additional outputs.
 
|-
 
|-
| [ANY_PLANT_MATERIAL]
+
| style="vertical-align: top"| EMPTY
| Reagent material must be subordinate to a PLANT object.
+
|
 +
| If the reagent is a container, it must be empty.
 
|-
 
|-
| [ANY_SILK_MATERIAL]
+
| style="vertical-align: top"| FIRE_BUILD_SAFE
| Reagent material must have the [SILK] token.
+
|
 +
| Reagent material must be solid and stable at temperatures approaching 11000. Only works with items of type BAR, BLOCKS, BOULDER, WOOD, and ANVIL - all others are considered unsafe.
 
|-
 
|-
| [ANY_YARN_MATERIAL]
+
| style="vertical-align: top"| FOOD_STORAGE_CONTAINER
| Reagent material must have the [YARN] token.
+
|
 +
| Reagent is either a BARREL or a TOOL with the FOOD_STORAGE use.
 
|-
 
|-
| [ANY_SOAP_MATERIAL]
+
| style="vertical-align: top"| GLASS_MATERIAL
| Reagent material must have the [SOAP] token.
+
|
 +
| Reagent material must have the IS_GLASS token. All 3 types of [[glass]] have this token hardcoded.
 
|-
 
|-
| [ANY_LEATHER_MATERIAL]
+
| style="vertical-align: top"| HARD_ITEM_MATERIAL
| Reagent material must have the [LEATHER] token.
+
|
 +
| Reagent material must have the [ITEMS_HARD] token.
 
|-
 
|-
| [ANY_BONE_MATERIAL]
+
| style="vertical-align: top"| HAS_EDGE
| Reagent material must have the [BONE] token.
+
|
 +
| Reagent must have an edge.
 
|-
 
|-
| [ANY_STRAND_TISSUE]
+
| style="vertical-align: top"| HAS_ITEM_REACTION_PRODUCT
| Reagent is made of a tissue having [TISSUE_SHAPE:STRANDS], intended for matching hair and wool. Must be used with [USE_BODY_COMPONENT].
+
| style="vertical-align: top"|
 +
* PRODUCT_ID
 +
| Reagent material must have the item reaction product specified by PRODUCT_ID - [[Reaction#Item_reaction_products|see below]] for more details. This can be used interchangeably with HAS_MATERIAL_REACTION_PRODUCT.
 
|-
 
|-
| [ANY_SHELL_MATERIAL]
+
| style="vertical-align: top"| HAS_MATERIAL_REACTION_PRODUCT
| Reagent material must have the [SHELL] token.
+
| style="vertical-align: top"|
 +
* PRODUCT_ID
 +
| Reagent material must have the material reaction product specified by PRODUCT_ID - [[Reaction#Material_reaction_products|see below]] for more details.
 
|-
 
|-
| [ANY_TOOTH_MATERIAL]
+
| style="vertical-align: top"| HAS_TOOL_USE
| Reagent material must have the [TOOTH] token.
+
| style="vertical-align: top"|
 +
* [[Tool token#TOOL_USE|TOOL_USE]] value
 +
| Reagent must be a [[tool]] with the specific TOOL_USE value. The reagent's item type must be TOOL:NONE for this to make any sense.
 
|-
 
|-
| [ANY_HORN_MATERIAL]
+
| style="vertical-align: top"| IS_CRAFTED_ARTIFACT{{verify}}
| Reagent material must have the [HORN] token.
+
|
 +
| Reagent item must be an artifact.
 
|-
 
|-
| [ANY_PEARL_MATERIAL]
+
| style="vertical-align: top"| IS_DIVINE_MATERIAL
| Reagent material must have the [PEARL] token.
+
|
 +
| Reagent material must have the [DIVINE] token.
 
|-
 
|-
| [IS_SAND_MATERIAL]
+
| style="vertical-align: top"| IS_SAND_MATERIAL
 +
|
 
| Reagent material must have the [SOIL_SAND] token.
 
| Reagent material must have the [SOIL_SAND] token.
 
|-
 
|-
| [USE_BODY_COMPONENT]
+
| style="vertical-align: top"| MAGMA_BUILD_SAFE
| Reagent must be a body part (CORPSE or CORPSEPIECE). Must be used even if your reagent item type is CORPSE or CORPSEPIECE, otherwise it will match any item.
+
|
 +
| Reagent material must be solid and stable at temperatures approaching 12000. Only works with items of type BAR, BLOCKS, BOULDER, WOOD, and ANVIL - all others are considered unsafe.
 +
|-
 +
| style="vertical-align: top"| METAL_ITEM_MATERIAL
 +
|
 +
| Reagent material must have the [ITEMS_METAL] token.
 +
|-
 +
| style="vertical-align: top"| METAL_ORE
 +
| style="vertical-align: top"|
 +
* Metal ID
 +
| Reagent material must be an ore of the specified metal.
 +
|-
 +
| style="vertical-align: top"| MIN_DIMENSION
 +
| style="vertical-align: top"|
 +
* Integer
 +
| Reagent's item size must be at least as large as ''Integer''. The reagent's item type must be BAR, POWDER_MISC, LIQUID_MISC, DRINK, THREAD, CLOTH, or GLOB for this to work.  See [[Reaction#PRODUCT_DIMENSION|PRODUCT_DIMENSION]] below.
 
|-
 
|-
| [NO_EDGE_ALLOWED]
+
| style="vertical-align: top"| NO_EDGE_ALLOWED
| Reagent must not have an edge - excludes sharp stones (produced using knapping) and most types of weapon/ammo.
+
|
 +
| Reagent must not have an edge, so must be blunt. Sharp stones (produced using knapping) and most types of weapon/ammo can not be used with this token.
 
|-
 
|-
| [HAS_EDGE]{{version|0.42.01}}
+
| style="vertical-align: top"| NOT_ARTIFACT{{verify}}
| Reagent must have an edge.
+
|
 +
| Reagent item must not be an artifact.
 +
|-
 +
| style="vertical-align: top"| NOT_CONTAIN_BARREL_ITEM
 +
|
 +
| If the reagent is a container, it must not contain [[lye]] or [[milk]]. Not necessary if specifying [EMPTY].
 
|-
 
|-
| [NOT_ENGRAVED]
+
| style="vertical-align: top"| NOT_ENGRAVED
 +
|
 
| Reagent can not be engraved. For example, a memorial slab can not be engraved.
 
| Reagent can not be engraved. For example, a memorial slab can not be engraved.
 
|-
 
|-
| [NOT_IMPROVED]
+
| style="vertical-align: top"| NOT_IMPROVED
 +
|
 
| Reagent has not been decorated.
 
| Reagent has not been decorated.
 
|-
 
|-
| [DOES_NOT_ABSORB]
+
| style="vertical-align: top"| NOT_PRESSED
| Reagent material must have [ABSORPTION:0]
+
|
 +
| Reagent must not be in the SOLID_PRESSED state.
 
|-
 
|-
| [FOOD_STORAGE_CONTAINER]
+
| style="vertical-align: top"| NOT_WEB
| Reagent is either a BARREL or a TOOL with the FOOD_STORAGE use.
+
|
 +
| Reagent must be collected (to distinguish silk thread from webs). Only makes sense for items of type THREAD.
 +
|-
 +
| style="vertical-align: top"| ON_GROUND
 +
|
 +
| Reagent must be on the ground. Grabs from stockpiles. Does not grab from inventories (workshops, wagon) and causes infinite gathering for reactions in workshop.
 
|-
 
|-
| [HARD_ITEM_MATERIAL]
+
| style="vertical-align: top"| POTASHABLE (Deprecated)
| Reagent material must have [ITEMS_HARD].
+
|
 +
| Alias for [CONTAINS_LYE].
 
|-
 
|-
| [METAL_ITEM_MATERIAL]
+
| style="vertical-align: top"| PRESERVE_REAGENT
| Reagent material must have [ITEMS_METAL].
+
|
 +
| Reagent is not destroyed, which is the normal effect, at the completion of the reaction. Typically used for containers.
 
|-
 
|-
| [NOT_PRESSED]
+
| style="vertical-align: top"| REACTION_CLASS
| Reagent must not be in the SOLID_PRESSED state.
+
| style="vertical-align: top"|
 +
* CLASS_ID
 +
| Reagent material must have the reaction class specified by CLASS_ID - [[Reaction#Reaction_classes|see below]] for more details.
 
|-
 
|-
| [METAL_ORE:X]
+
| style="vertical-align: top"| UNROTTEN
| Reagent material must be an ore of the specified metal.
+
|
 +
| Reagent must not be rotten, mainly for organic materials.
 
|-
 
|-
| [MIN_DIMENSION:X]
+
| style="vertical-align: top"| USE_BODY_COMPONENT
| Reagent's item dimension must be at least this large. The reagent's item type must be BAR, POWDER_MISC, LIQUID_MISC, DRINK, THREAD, CLOTH, or GLOB for this to work.
+
|
 +
| Reagent must be a body part (CORPSE or CORPSEPIECE). Must be used even if your reagent item type is CORPSE or CORPSEPIECE, otherwise it will match any item.
 
|-
 
|-
| [HAS_TOOL_USE:X]
+
| style="vertical-align: top"| WEB_ONLY
| Reagent must be a [[tool]] with the specific TOOL_USE value. The reagent's item type must be TOOL:NONE for this to make any sense.
+
|
 +
| Reagent must be undisturbed (to distinguish silk thread from webs). Only makes sense for items of type THREAD.
 
|-
 
|-
| [PRESERVE_REAGENT]
+
| style="vertical-align: top"| WORTHLESS_STONE_ONLY
| Reagent is not destroyed, which is the normal effect, at the completion of the reaction. Typically used for containers.
+
|
 +
| Reagent material must be non-[[economic]].
 
|-
 
|-
| [DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
+
| style="vertical-align: top"| WOVEN_ITEM
| Reagent quantity is ignored for the purposes of producing extra outputs. Typically used for containers so that [[stack]]s of reagents will correctly produce additional outputs.
+
|
 +
| Reagent must be a clothing item made of a woven material, ie. plant, silk, or yarn cloth.
 
|}
 
|}
  
Line 306: Line 416:
 
Products are the end product of the reaction. A reaction can have as many products as it likes.
 
Products are the end product of the reaction. A reaction can have as many products as it likes.
  
Products are almost identical to reagents, except that they do not need to be named, can't have fields undefined, and don't use the quantity field to determine the product size. Instead, the token PRODUCT_DIMENSION:X is tacked on after the PRODUCT token, determining the size of the product.
+
Products are almost identical to reagents, except that they do not need to be named, can't have fields undefined, and don't use the quantity field to determine the product size. Instead, the token [PRODUCT_DIMENSION:X] is tacked on after the PRODUCT token, determining the size of the product.
  
Products can be produced directly to a container using the [PRODUCT_TO_CONTAINER:<IDENTIFIER>] token, where the IDENTIFIER is the name of a reagent. This requires the reagent to have the PRESERVE_REAGENT token.
+
Products can be produced directly to a container using the [PRODUCT_TO_CONTAINER:''name''] token, where the ''name'' is the [[#Reagent name|name]] of a reagent. This requires the reagent to have the [PRESERVE_REAGENT] token.
  
 
Restating this in the above style, we have:
 
Restating this in the above style, we have:
 
   [PRODUCT:<probability>:<quantity>:<item token>:<material token>][...modifiers...]
 
   [PRODUCT:<probability>:<quantity>:<item token>:<material token>][...modifiers...]
  
==== probability ====
+
==== Probability ====
  
The percentage chance the product will be produced when the reaction is completed.
+
The percentage chance the product will be produced when the reaction is completed. Must be an integer.
  
==== quantity ====
+
==== Quantity ====
  
 
Determines how many of the product will be produced. For the item types AMMO, REMAINS, MEAT, FISH, FISH_RAW, PLANT, PLANT_GROWTH, DRINK, CHEESE, LIQUID_MISC, COIN, and EGG, the resulting items will be created as a single [[stack]], while all other item types will produce multiple individual items.
 
Determines how many of the product will be produced. For the item types AMMO, REMAINS, MEAT, FISH, FISH_RAW, PLANT, PLANT_GROWTH, DRINK, CHEESE, LIQUID_MISC, COIN, and EGG, the resulting items will be created as a single [[stack]], while all other item types will produce multiple individual items.
Line 323: Line 433:
 
If a reaction can take stacks of input items, then it will attempt to perform the reaction enough times to consume as many full sets of reagents as it can—for example, if a reaction "1 piece of meat + 2 pieces of fish -> 3 pieces of cheese" is given a stack of 5 meat and 5 fish, it will produce 6 pieces of cheese and leave 3 meat and 1 fish behind. Using the token DOES_NOT_DETERMINE_PRODUCT_AMOUNT allows a reagent to be excluded from this calculation - for example, with the reaction "1 plant + 1 barrel -> 5 alcohol (into barrel)", using this on the barrel allows the reaction to be performed as "5 plant + 1 barrel -> 25 alcohol" instead of "5 plant + 5 barrel -> 25 alcohol".
 
If a reaction can take stacks of input items, then it will attempt to perform the reaction enough times to consume as many full sets of reagents as it can—for example, if a reaction "1 piece of meat + 2 pieces of fish -> 3 pieces of cheese" is given a stack of 5 meat and 5 fish, it will produce 6 pieces of cheese and leave 3 meat and 1 fish behind. Using the token DOES_NOT_DETERMINE_PRODUCT_AMOUNT allows a reagent to be excluded from this calculation - for example, with the reaction "1 plant + 1 barrel -> 5 alcohol (into barrel)", using this on the barrel allows the reaction to be performed as "5 plant + 1 barrel -> 25 alcohol" instead of "5 plant + 5 barrel -> 25 alcohol".
  
==== item token ====
+
==== Item token ====
  
 
The [[item token]] and subtype of the item you produce.
 
The [[item token]] and subtype of the item you produce.
  
If you want the item type and material to be derived from one of the reagents, you can use GET_ITEM_DATA_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of both the item token ''and'' the material token below. You can also specify GET_ITEM_DATA_FROM_REAGENT:reagent:NONE in order to make a direct copy of the source item, though this will not work for complex items such as corpses or prepared meals.
+
If your item has an [[Reaction#Item reaction products|item reaction product]] and you want the item type and material to be derived from one of the reagents, you can use GET_ITEM_DATA_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of both the item token ''and'' the material token (see next section). You can also specify GET_ITEM_DATA_FROM_REAGENT:reagent:NONE in order to make a direct copy of the source item, though this will not work for complex items such as corpses or prepared meals.
  
 
For products, this can also be set to CRAFTS:NONE to produce up to three random [[craft]] items. This value cannot be used in any other context.
 
For products, this can also be set to CRAFTS:NONE to produce up to three random [[craft]] items. This value cannot be used in any other context.
  
==== material token ====
+
==== Material token ====
  
 
A [[material token]] describing what the product will be made of.
 
A [[material token]] describing what the product will be made of.
  
If you want the product's material to be derived from one of the reagents, you can use GET_MATERIAL_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of the material token. You can also specify GET_MATERIAL_FROM_REAGENT:reagent:NONE in order to directly use the reagent's own material.
+
If you want the product's material to be derived from one of the reagents, you can use GET_MATERIAL_FROM_REAGENT:reagent:NONE in place of the material token in order to directly use the reagent's own material; if the reagent has a [[Reaction#Material_reaction_products|material reaction product]] defined, you can use GET_MATERIAL_FROM_REAGENT:reagent:REACTION_PRODUCT_ID to use that.
 +
 
 +
Similarly to choosing material types for a reagent, if the item product is armor/clothing, and has the appropriate [[Entity_token#Available_resources|armor token]] in the entity file, you will be able to choose the armor/clothing size for different creatures by clicking the magnifying glass of the workshop task. However, this will only work if the product material is [[Modding pitfalls#My_custom_armor.2Fclothing_reaction_won.27t_let_user_choose_size|cloth leather or certain metals]], and the item is also recognized by the related vanilla workshop reaction{{verify}}.
  
 
==== Product modifiers ====
 
==== Product modifiers ====
  
Zero or more tokens which further clarify the acceptable types when the item type and material types are insufficient to distinguish them.
+
Zero or more tokens which further set the properties or disposition of the resulting product item.
  
 
{| {{prettytable}}
 
{| {{prettytable}}
 
|- bgcolor="#dddddd"
 
|- bgcolor="#dddddd"
 
! Token
 
! Token
! Meaning
+
! Arguments
 +
! Description
 
|-
 
|-
| [FORCE_EDGE]
+
| style="vertical-align: top"| FORCE_EDGE
 +
|
 
| Product is given a sharp edge. Used for knapping.
 
| Product is given a sharp edge. Used for knapping.
 
|-
 
|-
| [PRODUCT_PASTE]
+
| style="vertical-align: top"| PRODUCT_PASTE
 +
|
 
| Product is created in the SOLID_PASTE state.
 
| Product is created in the SOLID_PASTE state.
 
|-
 
|-
| [PRODUCT_PRESSED]
+
| style="vertical-align: top"| PRODUCT_PRESSED
 +
|
 
| Product is created in the SOLID_PRESSED state.
 
| Product is created in the SOLID_PRESSED state.
 
|-
 
|-
| [PRODUCT_DIMENSION:<size>]
+
| style="vertical-align: top"| PRODUCT_DIMENSION
| Specifies the dimensions of the product. A product of 150 is typical for BAR, POWDER_MISC, LIQUID_MISC, DRINK, and GLOB. 15000 is typical for THREAD, and a size of 10000 is typical for CLOTH. Has no effect on any other item types. Note: this is not the actual volume of the product, which is hard-coded by the item token.  
+
| style="vertical-align: top"|
 +
* Integer
 +
| Specifies the dimension of the product for those items that use dimensions. For items of type BAR, DRINK, GLOB, LIQUID_MISC, and POWDER_MISC, one item is dimension 150; one item of CLOTH or SHEET is dimension 10000; and one item of THREAD is dimension 15000. Has no effect on any other item types. Note: this is not the actual [[storage]] volume of the product, which is hard-coded by the item token.  
 
|-
 
|-
| [PRODUCT_TO_CONTAINER:<id>]
+
| style="vertical-align: top"| PRODUCT_TO_CONTAINER
| Places the product in a container; <id> must be the name of a reagent with the PRESERVE_REAGENT token and a container item type.
+
| style="vertical-align: top"|
 +
* [[#Reagent name|Name]]
 +
| Places the product in a container; ''Name'' must be the name of a reagent with the [PRESERVE_REAGENT] token and a container item type.
 +
|-
 +
| style="vertical-align: top"| PRODUCT_TOKEN
 +
| style="vertical-align: top"|
 +
* [[#Reagent name|Name]]
 +
| Allows the product to be referred to by the given name for the purpose of being passed down as and argument in other tokens, in the same fashion as reagent names.
 +
|-
 +
| style="vertical-align: top"| TRANSFER_ARTIFACT_STATUS
 +
|
 +
| style="vertical-align: top"| Transfers artifact status from the reagent to the product.
 
|}
 
|}
  
Line 369: Line 498:
 
   [IMPROVEMENT:<probability>:<reagent name>:<improvement type>:<material token>]
 
   [IMPROVEMENT:<probability>:<reagent name>:<improvement type>:<material token>]
  
==== probability ====
+
==== Probability ====
 
 
 
The percentage chance the improvement will be applied to the reagent when the reaction is completed.
 
The percentage chance the improvement will be applied to the reagent when the reaction is completed.
  
==== reagent name ====
+
==== Reagent name ====
 
+
The [[#Reagent name|name]] of the reagent that will be improved. In order to be meaningful, this reagent must have [PRESERVE_REAGENT].
The name of the reagent that will be improved. In order to be meaningful, this reagent must have [PRESERVE_REAGENT].
 
 
 
==== improvement type ====
 
  
 +
==== Improvement type ====
 
The following improvement types can be used:
 
The following improvement types can be used:
  
Line 384: Line 510:
 
|- bgcolor="#dddddd"
 
|- bgcolor="#dddddd"
 
! Token
 
! Token
! Meaning
+
! Description
 
|-
 
|-
 
| COVERED
 
| COVERED
Line 403: Line 529:
 
| PAGES
 
| PAGES
 
| Adds pages to a [[book]].
 
| Adds pages to a [[book]].
 +
|-
 +
| SPECIFIC
 +
| With subtype ROLLERS, adds rollers of <material> to a [[scroll]]; with subtype HANDLE, adds a handle of <material> to an item; with subtype TRACTION_BENCH_CHAIN or TRACTION_BENCH_ROPE adds a chain or rope of <material> to an item.
 
|}
 
|}
  
 
All other item improvement tokens (ART_IMAGE, ITEMSPECIFIC, THREAD, CLOTH, SEWN_IMAGE, and ILLUSTRATION) are ignored.
 
All other item improvement tokens (ART_IMAGE, ITEMSPECIFIC, THREAD, CLOTH, SEWN_IMAGE, and ILLUSTRATION) are ignored.
  
==== material token ====
+
==== Material token ====
  
 
A [[material token]] describing what the decoration will be made of.
 
A [[material token]] describing what the decoration will be made of.
  
If you want the decoration's material to be derived from one of the reagents, you can use GET_MATERIAL_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of the material token. You can also specify GET_MATERIAL_FROM_REAGENT:reagent:NONE in order to directly use the reagent's own material.
+
If you want the product's material to be derived from one of the reagents, and the reagent has a [[Reaction#Material_reaction_products|material reaction product]] defined, you can use GET_MATERIAL_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of the material token. You can also specify GET_MATERIAL_FROM_REAGENT:reagent:NONE in order to directly use the reagent's own material.
  
 
=== Other tokens ===
 
=== Other tokens ===
  
==== fuel ====
+
==== Fuel ====
  
 
The FUEL token means that the reaction requires coke or charcoal to be performed. Fuel is not needed when the reaction is performed at a magma workshop (a [[magma kiln]], [[magma smelter]], or any custom building having [NEEDS_MAGMA]).
 
The FUEL token means that the reaction requires coke or charcoal to be performed. Fuel is not needed when the reaction is performed at a magma workshop (a [[magma kiln]], [[magma smelter]], or any custom building having [NEEDS_MAGMA]).
  
==== skill ====
+
==== Skill ====
  
The [[Skill token|SKILL token]] determines what skill the reaction requires and what skill it trains. Only one skill may be specified. For custom reactions, the amount of experience gained is linearly correlated with the amount of product created; a reaction with no product will yield no experience for the performing dwarf. A reaction with no skill associated will always be instant.
+
The [[Skill token|skill tokens]] determine what skill the reaction requires and trains; also how quickly skill is gained, how quickly those skill gains raise attributes, and how skill level affects the quality of the reaction product.
  
One may also adjust how much skill is gained using the [SKILL_IP:<integer>] token. The default is 30; more will increase the amount of skill gain. Attribute gain from the skill gain can also be adjusted with [ATTRIBUTE_IP:<integer>], with the default being 10.{{version|0.47.01}}
+
{| {{prettytable}}
 +
|- bgcolor="#dddddd"
 +
! Token
 +
! Arguments
 +
! Description
 +
|-
 +
| style="vertical-align: top"| SKILL
 +
| style="vertical-align: top"|
 +
* [[Skill token]]
 +
| (Optional) This identifies the skill required to carry out the reaction and is trained when the reaction is performed.  Only one skill may be specified; if multiple skill tokens are defined only the last will be used.  A reaction with no product will yield no experience gain.  A reaction with no SKILL token will complete in a default amount of time.
 +
|-
 +
| style="vertical-align: top"| SKILL_IP
 +
| style="vertical-align: top"|
 +
* Integer
 +
| (Optional, requires SKILL token)  This adjusts the amount of skill gained each time the reaction is carried out. The default value is 30; higher values increase the amount of skill gain.
 +
|-
 +
| style="vertical-align: top"| ATTRIBUTE_IP
 +
| style="vertical-align: top"|
 +
* Integer
 +
| (Optional, requires SKILL token)  This adjusts the amount of [[Attribute|attribute]] gain that skill gain from this reaction results in.  The default value is 10; higher values increase the amount of attribute gain.
 +
|-
 +
| style="vertical-align: top"| SKILL_ROLL_RANGE
 +
| style="vertical-align: top"|
 +
* Range
 +
* Multiplier
 +
| (Optional, requires SKILL token)  This changes how much skill level affects the quality of the reaction product.  The default is [SKILL_ROLL_RANGE:11:5]. The ''range'' is the base "die roll" and the ''multiplier'' determines how much the dwarf's skill can affect the reaction; the skill roll is random(range) + random((skill level * multipler)/2 + 1) + random((skill level * multipler)/2 + 1), where random(x) gives a random number from 0 to x-1, inclusive (which also means that the minimum for the range is 1). The higher result on the roll, the better. Both numbers can be lowered to make the skill check harder. For example, with the default values a dwarf who is proficient in a skill has a skill level of 5; their roll will be random(11)+random(13)+random(13), meaning this dwarf can roll anywhere from 0 to 34; similarly, unskilled dwarves can roll 0 to 10 while legendary+0 (skill 15) dwarves can roll 0 to 84. If this is changed to [SKILL_ROLL_RANGE:1:8], then instead a proficient dwarf will have random(1)+random(21)+random(21), giving a roll of 0 to 40, with unskilled dwarves always rolling 0 and legendary dwarves going all the way up to 120.
  
It's also possible to change how much skill affects the outcome (i.e. quality) of the reaction using the [SKILL_ROLL_RANGE:<basic range>:<multiplier>] token.{{version|0.47.01}} The default is [SKILL_ROLL_RANGE:11:5]. The first number is the base roll and the second number is how much the dwarf's skill can affect the reaction; the skill roll is random(basic range) + random((skill level * multipler)/2 + 1) + random((skill level * multipler)/2 + 1), where random(x) gives a random number from 0 to x-1, inclusive (which also means that the minimum for the basic range is 1). The higher result on the roll, the better. Both numbers can be lowered to the skill harder. For example, a dwarf who is proficient in a skill has a skill level of 5; their roll will be random(11)+random(13)+random(13), meaning this dwarf can roll anywhere from 0 to 34; similarly, unskilled dwarves can have 0 to 10 while legendary+0 (skill 15) dwarves can have 0 to 84. If this is changed to [SKILL_ROLL_RANGE:1:8], then instead a proficient dwarf will have random(1)+random(21)+random(21), giving a range from 0 to 40 for proficient dwarves, with unskilled dwarves always having 0 and legendary dwarves going all the way up to 120.
+
As a consequence, increasing the multiplier will always make legendary dwarves more effective, even if base roll is reduced to its minimum of 1, with the default going up to 84 for default and 90 for [SKILL_ROLL_RANGE:1:6].
 +
|}
  
As a consequence, increasing the multiplier will '''always''' make legendary dwarves more effective, even if base roll is reduced to its minimum of 1, with the default going up to 84 for default and 90 for [SKILL_ROLL_RANGE:1:6].
+
==== Max multiplier ====
  
==== automatic ====
+
The [MAX_MULTIPLIER:<#>] token specifies how many times to do the reaction. This can be used to limit stacked reagent use to the specified quantity instead of the whole stack.
 +
 
 +
==== Automatic ====
  
 
The AUTOMATIC token means that the reaction will be queued automatically if the reaction reagents are all present.
 
The AUTOMATIC token means that the reaction will be queued automatically if the reaction reagents are all present.
Line 435: Line 592:
 
This token only works with jobs performed at a [[kiln]], [[smelter]], [[tanner's shop]], [[kitchen]], or custom workshop, and [[standing orders]] allow you to limit which ones trigger; custom reactions performed at a [[quern]], [[millstone]]{{verify}}, [[still]]{{verify}} or [[craftsdwarf's workshop]]{{verify}} cannot be made automatic.
 
This token only works with jobs performed at a [[kiln]], [[smelter]], [[tanner's shop]], [[kitchen]], or custom workshop, and [[standing orders]] allow you to limit which ones trigger; custom reactions performed at a [[quern]], [[millstone]]{{verify}}, [[still]]{{verify}} or [[craftsdwarf's workshop]]{{verify}} cannot be made automatic.
  
==== Adventure Mode enabled ====
+
==== Adventure mode enabled ====
  
The ADVENTURE_MODE_ENABLED token means that this version of the reaction is not used by dwarves at home in a fortress, but rather the wanderers of Adventure Mode.  When using this token, it will be allowed for adventurers of any race, without editing entity files.
+
The ADVENTURE_MODE_ENABLED token means that this version of the reaction can be used by the wanderers of Adventure Mode without needing to also give the dwarves at home in a fortress access to it.  When using this token, it will be allowed for adventurers of any race, without editing entity files. This token does not prevent Fortress Mode usage assuming the reaction also has a usable building assigned and is a {{token|PERMITTED_REACTION|entity}} within the entity file.
  
==== max multiplier ====
+
==== Description ====
  
The [MAX_MULTIPLIER:<#>] specifies how many times to do the reaction. This can be used to limit stacked reagent use to the specified quantity instead of the whole stack.{{version|0.42.01}}
+
This feature is exclusive to Classic Mode, as no description window pops up when mousing over reactions in workshops in Premium.
 +
 
 +
The [DESCRIPTION:<string>] token provides a text description of the reaction when it is highlighted in the building UI. Multiple DESCRIPTION tokens can be defined in a reaction, and each will appear on a new line.  The pop-up box that contains the description is limited to 325 characters total. Alternatively, this token can reference a DESCRIPTION token in an existing tool definition by replacing ''string'' with USE_TOOL:<ITEM_SUBTYPE>; or an existing instrument definition with USE_INSTRUMENT:<ITEM_SUBTYPE>.
  
 
== Reaction classes and products ==
 
== Reaction classes and products ==
Line 451: Line 610:
 
The simplest token is the reaction class. If it is tacked on a material, a reaction can limit reagents to only those materials that have the specified arbitrary [REACTION_CLASS:whatever] identifier.
 
The simplest token is the reaction class. If it is tacked on a material, a reaction can limit reagents to only those materials that have the specified arbitrary [REACTION_CLASS:whatever] identifier.
  
We want a reaction that smelts iron and flux into pig iron. However, there's half-dozen different stones that count as flux. Instead of clogging up the smelter job menu with half-dozen nearly identical reactions that all take in either dolomite or limestone or marble for the same result, we use a reaction class.
+
We want a reaction that smelts iron and flux into pig iron. However, there are a half-dozen different stones that count as flux. Instead of clogging up the smelter job menu with six nearly identical reactions that all take in either dolomite or limestone or marble for the same result, we use a reaction class.
  
 
   [REACTION:PIG_IRON_MAKING]
 
   [REACTION:PIG_IRON_MAKING]
Line 486: Line 645:
 
       [BUILDING:TANNER:CUSTOM_T]
 
       [BUILDING:TANNER:CUSTOM_T]
 
         [REAGENT:flaps of skin:1:NONE:NONE:NONE:NONE][USE_BODY_COMPONENT][UNROTTEN]
 
         [REAGENT:flaps of skin:1:NONE:NONE:NONE:NONE][USE_BODY_COMPONENT][UNROTTEN]
             '''[HAS_MATERIAL_REACTION_PRODUCT:BOOT_FABRIC]'''
+
             '''[HAS_MATERIAL_REACTION_PRODUCT:TAN_MAT]'''
         [PRODUCT:100:1:SKIN_TANNED:NONE:'''GET_MATERIAL_FROM_REAGENT:flaps of skin:BOOT_FABRIC''']
+
         [PRODUCT:100:1:SKIN_TANNED:NONE:'''GET_MATERIAL_FROM_REAGENT:flaps of skin:TAN_MAT''']
 
       [SKILL:TANNER]
 
       [SKILL:TANNER]
 
       [AUTOMATIC]
 
       [AUTOMATIC]
  
Where you'd usually have some fresh bodypart with the BOOT_FABRIC reaction class produce some generic SKIN_TANNED, this goes further. Instead of declaring a material, the spool of pattern-ready tailoring leather (SKIN_TANNED) now comes out as whatever the skin flaps' material reaction product (named BOOT_FABRIC) says in the material's definition (GET_MATERIAL_FROM_REAGENT). And what does it say?
+
Where you'd usually have some fresh bodypart with the TAN_MAT reaction class produce some generic SKIN_TANNED, this goes further. Instead of declaring a material, the spool of pattern-ready tailoring leather (SKIN_TANNED) now comes out as whatever the skin flaps' material reaction product (named TAN_MAT) says in the material's definition (GET_MATERIAL_FROM_REAGENT). And what does it say?
  
 
   [MATERIAL_TEMPLATE:SKIN_TEMPLATE]
 
   [MATERIAL_TEMPLATE:SKIN_TEMPLATE]
Line 499: Line 658:
 
         ...
 
         ...
 
         [ABSORPTION:100]
 
         [ABSORPTION:100]
         '''[MATERIAL_REACTION_PRODUCT:BOOT_FABRIC:LOCAL_CREATURE_MAT:LEATHER]'''
+
         '''[MATERIAL_REACTION_PRODUCT:TAN_MAT:LOCAL_CREATURE_MAT:LEATHER]'''
 
         [IMPLIES_ANIMAL_KILL]
 
         [IMPLIES_ANIMAL_KILL]
 
         [ROTS]
 
         [ROTS]
  
It says that the caller of the BOOT_FABRIC hook always comes out as the LEATHER of whatever creature the skin has been peeled off of (LOCAL_CREATURE_MAT). Make it BOOT_FABRIC:INORGANIC:GOLD instead and your tanner turns into Midas. Use your imagination.
+
It says that the caller of the TAN_MAT hook always comes out as the LEATHER of whatever creature the skin has been peeled off of (LOCAL_CREATURE_MAT). For example, skin taken from a butchered dog would be turned into dog leather. Change the SKIN_TEMPLATE MATERIAL_REACTION_PRODUCT to TAN_MAT:INORGANIC:GOLD instead and your tanner turns into Midas. Use your imagination.
 +
 
 +
If the item you're creating should be made of the ''same'' material as the raw material you're using (e.g. if you're carving a log into a training spear), you can specify "NONE" instead of the MATERIAL_REACTION_PRODUCT code:
 +
 
 +
  [REACTION:MAKE WOODEN TRAINING SPEAR]
 +
      [NAME:make wooden training spear]
 +
      [BUILDING:CARPENTER:NONE]
 +
      [REAGENT:log:1:WOOD:NONE:NONE:NONE][ANY_PLANT_MATERIAL]
 +
      [PRODUCT:100:1:WEAPON:ITEM_WEAPON_SPEAR_TRAINING:'''GET_MATERIAL_FROM_REAGENT:log:NONE''']
 +
      [SKILL:CARPENTRY]
  
 
As with reaction classes, some MATERIAL_REACTION_PRODUCT identifiers have special meanings to the game itself - notably, the [[site finder]] knows that "FIRED_MAT" should be connected to the "Clay" filter, and "CHEESE_MAT" is used when making [[cheese]] from [[milk]].
 
As with reaction classes, some MATERIAL_REACTION_PRODUCT identifiers have special meanings to the game itself - notably, the [[site finder]] knows that "FIRED_MAT" should be connected to the "Clay" filter, and "CHEESE_MAT" is used when making [[cheese]] from [[milk]].
Line 509: Line 677:
 
=== Item reaction products ===
 
=== Item reaction products ===
  
The version 0.40 added an even more powerful form of the above. Where material reaction products can only affect what type of stuff the predestined end product is made of, item reaction products can decide the entire end result ahead of time. Item AND material.
+
Item reaction products are an even more powerful form of the above. Where material reaction products can only affect what type of stuff the predestined end product is made of, item reaction products can decide the entire end result ahead of time. Item AND material.
  
 
Let's assume for a moment that we're completely tired of leather earrings and hair crowns. We want a crafting reaction that takes cloth and only produces things that make sense.
 
Let's assume for a moment that we're completely tired of leather earrings and hair crowns. We want a crafting reaction that takes cloth and only produces things that make sense.
Line 546: Line 714:
 
                   [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]
 
                   [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]
 
                     [MATERIAL_VALUE:2]
 
                     [MATERIAL_VALUE:2]
                     '''[ITEM_REACTION_PRODUCT:BEST_OPTION:BOX:NONE:LOCAL_PLANT_MAT:THREAD]'''
+
                     '''[ITEM_REACTION_PRODUCT:BEST_OPTION:BAG:NONE:LOCAL_PLANT_MAT:THREAD]'''
 
                   ...
 
                   ...
  
Line 579: Line 747:
 
! Token
 
! Token
 
! Arguments
 
! Arguments
 +
! Type
 
! Description
 
! Description
  
 
|-
 
|-
| {{text anchor|ADVENTURE_MODE_ENABLED}}
+
| style="vertical-align: top"| {{text anchor|ADVENTURE_MODE_ENABLED}}
 
|
 
|
| this version of the reaction is not used by dwarves at home in a fortress, but rather the wanderers of Adventure Mode.  When using this token, it will be allowed for adventurers of any race, without editing Entity files
+
|
 +
| style="vertical-align: top"| This version of the reaction can be used by the wanderers of Adventure Mode without needing to also give the dwarves at home in a fortress access to it.  When using this token, it will be allowed for adventurers of any race, without editing entity files. This token does not prevent Fortress Mode usage.
  
 
|-
 
|-
| {{text anchor|ANY_BONE_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_BONE_MATERIAL}}
 
|
 
|
| Reagent material must have the [BONE] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [BONE] token.
 +
 
 +
|-
 +
| style="vertical-align: top"| {{text anchor|ANY_GEM_MATERIAL}}
 +
|
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [IS_GEM] token.
 +
 
 +
|-
 +
| style="vertical-align: top"| {{text anchor|ANY_HORN_MATERIAL}}
 +
|
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [HORN] token.
 +
 
 +
|-
 +
| style="vertical-align: top"| {{text anchor|ANY_LEATHER_MATERIAL}}
 +
|
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [LEATHER] token.
  
 
|-
 
|-
| {{text anchor|ANY_HORN_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_PEARL_MATERIAL}}
 
|
 
|
| Reagent material must have the [HORN] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [PEARL] token.
  
 
|-
 
|-
| {{text anchor|ANY_LEATHER_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_PLANT_MATERIAL}}
 
|
 
|
| Reagent material must have the [LEATHER] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must be subordinate to a PLANT object.
  
 
|-
 
|-
| {{text anchor|ANY_PEARL_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_SHELL_MATERIAL}}
 
|
 
|
| Reagent material must have the [PEARL] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [SHELL] token.
  
 
|-
 
|-
| {{text anchor|ANY_PLANT_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_SILK_MATERIAL}}
 
|
 
|
| Reagent material must be subordinate to a PLANT object.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [SILK] token.
  
 
|-
 
|-
| {{text anchor|ANY_SHELL_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_SOAP_MATERIAL}}
 
|
 
|
| Reagent material must have the [SHELL] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [SOAP] token.
  
 
|-
 
|-
| {{text anchor|ANY_SILK_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_STONE_MATERIAL}}
 
|
 
|
| Reagent material must have the [SILK] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [IS_STONE] token.
  
 
|-
 
|-
| {{text anchor|ANY_SOAP_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_STRAND_TISSUE}}
 
|
 
|
| Reagent material must have the [SOAP] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent is made of a tissue having [TISSUE_SHAPE:STRANDS], intended for matching hair and wool. Must be used with [USE_BODY_COMPONENT].
  
 
|-
 
|-
| {{text anchor|ANY_STRAND_TISSUE}}
+
| style="vertical-align: top"| {{text anchor|ANY_TOOTH_MATERIAL}}
 
|
 
|
| Reagent is made of a tissue having [TISSUE_SHAPE:STRANDS], intended for matching hair and wool. Must be used with [USE_BODY_COMPONENT].
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [TOOTH] token.
  
 
|-
 
|-
| {{text anchor|ANY_TOOTH_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_WOOD_MATERIAL}}
 
|
 
|
| Reagent material must have the [TOOTH] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [WOOD] token.
  
 
|-
 
|-
| {{text anchor|ANY_YARN_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|ANY_YARN_MATERIAL}}
 
|
 
|
| Reagent material must have the [YARN] token.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [YARN] token.
  
 
|-
 
|-
| {{text anchor|ATTRIBUTE_IP}}{{version|0.47.01}}
+
| style="vertical-align: top"| {{text anchor|ATTRIBUTE_IP}}
| integer
+
| style="vertical-align: top"|  
| Amount of attributes given per skill improvement. Default is 10.
+
* Integer
 +
| style="vertical-align: top"| Skill modifier
 +
| style="vertical-align: top"| Amount of attribute gain given per skill improvement. Default is 10.
  
 
|-
 
|-
| {{text anchor|AUTOMATIC}}
+
| style="vertical-align: top"| {{text anchor|AUTOMATIC}}
 
|
 
|
| the reaction will be queued automatically if the reaction reagents are all present.
+
|
 +
| style="vertical-align: top"| The reaction will be queued automatically if the reaction reagents are all present.
  
 
|-
 
|-
| {{text anchor|BAG}}
+
| style="vertical-align: top"| {{text anchor|BAG}} (Deprecated)
 
|
 
|
| Reagent has to be a bag. Intended to be used with an item type of BOX, to prevent chests, coffers, and other containers from being used instead.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent has to be a bag. Intended to be used with an item type of BOX, to prevent chests, coffers, and other containers from being used instead. Deprecated as of Version 0.50.01 in favor of BAG:NONE [[item token]].
  
 
|-
 
|-
| {{text anchor|BUILDING}}
+
| style="vertical-align: top"| {{text anchor|BUILDING}}
|  
+
| style="vertical-align: top"|  
* Building name
+
* [[#building name|Building name]]
* in-building reaction hotkey  
+
* [[#building key|In-building reaction hotkey]]
| Sets the building that the reaction will be performed in, and the button used to queue the reaction once that building's menu is accessed in-game
+
|
 +
| style="vertical-align: top"| Sets the building that the reaction will be performed in, and the button used to queue the reaction once that building's menu is accessed in-game.
  
 
|-
 
|-
| {{text anchor|BUILDMAT}}
+
| style="vertical-align: top"| {{text anchor|BUILDMAT}}
 
|
 
|
| Reagent is able to be used to build structures (Stone, Wood, Blocks, Bars?).
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent is able to be used to build structures (Boulders, Wood, Blocks, Bars).
  
 
|-
 
|-
| {{text anchor|CAN_USE_ARTIFACT}}
+
| style="vertical-align: top"| {{text anchor|CAN_USE_ARTIFACT}}
 
|
 
|
| Reagent can be an Artifact.  Using [PRESERVE_REAGENT] with this is strongly advised.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent can be an Artifact.  Using [PRESERVE_REAGENT] with this is strongly advised.
  
 
|-
 
|-
| {{text anchor|CAN_USE_HOSPITAL_RESERVED}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CAN_USE_HOSPITAL_RESERVED}}
 
|  
 
|  
| Allows the reagent to be an item that is otherwise reserved for use by a [[healthcare|hospital]].
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Allows the reagent to be an item that is otherwise reserved for use by a [[healthcare|hospital]].
  
 
|-
 
|-
| {{text anchor|CAN_USE_LOCATION_RESERVED}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CAN_USE_LOCATION_RESERVED}}
 
|  
 
|  
| Allows the reagent to be an item that is otherwise reserved for use by a [[locations|location]].
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Allows the reagent to be an item that is otherwise reserved for use by a [[locations|location]].
  
 
|-
 
|-
| {{text anchor|CATEGORY}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CATEGORY}}
| Category ID  
+
| style="vertical-align: top"|  
| Puts the reaction in a category. Categories are custom submenus for reaction menus. The category ID is a unique identifier for the category. It is only used in the raws, and will not appear in the game.
+
* Category ID  
 +
|
 +
| style="vertical-align: top"| Puts the reaction in a category. Categories are custom submenus for reaction menus. The category ID is a unique identifier for the category. It is only used in the raws, and will not appear in the game.
  
 
If you're defining multiple categories within the same reaction - for example, if you intend the reaction to be nested two deep, and haven't yet defined the super-category - the ''last'' CATEGORY token within the reaction definition is the one that the reaction will appear in.
 
If you're defining multiple categories within the same reaction - for example, if you intend the reaction to be nested two deep, and haven't yet defined the super-category - the ''last'' CATEGORY token within the reaction definition is the one that the reaction will appear in.
  
 
|-
 
|-
| {{text anchor|CATEGORY_NAME}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CATEGORY_NAME}}
| String
+
| style="vertical-align: top"|  
| The name of the category as displayed in-game.
+
* String
 +
| style="vertical-align: top"| Category
 +
| style="vertical-align: top"| The name of the category as displayed in-game.
  
 
|-
 
|-
| {{text anchor|CATEGORY_DESCRIPTION}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CATEGORY_DESCRIPTION}}
| String
+
| style="vertical-align: top"|  
| If present, when the category is highlighted in a building menu, this string will be displayed in the Helpful Hint box.
+
* String
 +
| style="vertical-align: top"| Category
 +
| style="vertical-align: top"| If present, when the category is highlighted in a building menu, this string will be displayed in the Helpful Hint box.
  
 
|-
 
|-
| {{text anchor|CATEGORY_PARENT}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CATEGORY_PARENT}}
| Category ID
+
| style="vertical-align: top"|  
| If present, this category will be a submenu of the indicated category, rather than a submenu of the reaction's building.
+
* Category ID
 +
| style="vertical-align: top"| Category
 +
| style="vertical-align: top"| If present, this category will be a submenu of the indicated category, rather than a submenu of the reaction's building.
  
 
|-
 
|-
| {{text anchor|CATEGORY_KEY}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|CATEGORY_KEY}}
| [[interface.txt|Hotkey token]]
+
| style="vertical-align: top"|  
| If present, this category can be selected from its parent menu (whether a building or a parent category) using the given hotkey.
+
* Hotkey
 +
| style="vertical-align: top"| Category
 +
| style="vertical-align: top"| If present, this category can be selected from its parent menu (whether a building or a parent category) using the given hotkey while playing in Classic mode.
  
 
|-
 
|-
| {{text anchor|CONTAINS}}
+
| style="vertical-align: top"| {{text anchor|CONTAINS}}
| required content
+
| style="vertical-align: top"|
| Reagent is a container that holds the specified reagent.
+
* [[#Reagent name|Reagent name]]
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent is a container that holds the specified reagent.
  
 
|-
 
|-
| {{text anchor|CONTAINS_LYE}} (Deprecated)
+
| style="vertical-align: top"| {{text anchor|CONTAINS_LYE}} (Deprecated)
 
|
 
|
| If the reagent is a container, it must contain LYE. No longer used - instead, use one reagent for the LYE itself and another reagent with [CONTAINS:lye_reagent].
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| If the reagent is a container, it must contain LYE. No longer used - instead, use one reagent for the LYE itself and another reagent with [CONTAINS:lye_reagent].
  
 
|-
 
|-
| {{text anchor|DESCRIPTION}}
+
| style="vertical-align: top"| {{text anchor|DESCRIPTION}}
| String
+
| style="vertical-align: top"|
| Description of the reaction
+
* String
 +
|
 +
| style="vertical-align: top"| A description of the reaction that appears when it is highlighted in the building UI.  ''String'' can also be replaced with a reference to existing DESCRIPTION tokens in tools (using USE_TOOL:<tool_id>) or musical instruments (using USE_TOOL:<instrument_id>).
  
 
|-
 
|-
| {{text anchor|DOES_NOT_ABSORB}}
+
| style="vertical-align: top"| {{text anchor|DOES_NOT_ABSORB}}
 
|
 
|
| Reagent material must have [ABSORPTION:0]
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have [ABSORPTION:0].
  
 
|-
 
|-
| {{text anchor|DOES_NOT_DETERMINE_PRODUCT_AMOUNT}}
+
| style="vertical-align: top"| {{text anchor|DOES_NOT_DETERMINE_PRODUCT_AMOUNT}}
 
|
 
|
| Performing a reaction with large [[stack]]s of inputs can allow multiple sets of outputs to be produced. Setting this flag causes the reagent to be ignored in this process - for example, with the reaction "1 plant + 1 barrel -> 5 alcohol (into barrel)", using this on the barrel allows the reaction to be performed as "5 plant + 1 barrel -> 25 alcohol" instead of "5 plant + 5 barrel -> 25 alcohol".
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Performing a reaction with large [[stack]]s of inputs can allow multiple sets of outputs to be produced. Setting this flag causes the reagent to be ignored in this process - for example, with the reaction "1 plant + 1 barrel -> 5 alcohol (into barrel)", using this on the barrel allows the reaction to be performed as "5 plant + 1 barrel -> 25 alcohol" instead of "5 plant + 5 barrel -> 25 alcohol".
  
 
|-
 
|-
| {{text anchor|EMPTY}}
+
| style="vertical-align: top"| {{text anchor|EMPTY}}
 
|
 
|
| If the reagent is a container, it must be empty.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| If the reagent is a container, it must be empty.
  
 
|-
 
|-
| {{text anchor|FIRE_BUILD_SAFE}}
+
| style="vertical-align: top"| {{text anchor|FIRE_BUILD_SAFE}}
 
|
 
|
| Reagent must be considered fire safe - i.e. not wood, and not coal.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must be considered [[fire-safe]] (stable [[temperature]] below {{ct|11000}}) - i.e. not wood, and not coal.
  
 
|-
 
|-
| {{text anchor|FORCE_EDGE}}
+
| style="vertical-align: top"| {{text anchor|FORCE_EDGE}}
 
|
 
|
| Product is given a sharp edge. Used for knapping.
+
| style="vertical-align: top"| Product modifier
 +
| style="vertical-align: top"| Product is given a sharp edge. Used for knapping.
  
 
|-
 
|-
| {{text anchor|FOOD_STORAGE_CONTAINER}}
+
| style="vertical-align: top"| {{text anchor|FOOD_STORAGE_CONTAINER}}
 
|
 
|
| Reagent must be a barrel or any non-absorbing tool with [TOOL_USE:FOOD_STORAGE]
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must be a barrel or any non-absorbing tool with [TOOL_USE:FOOD_STORAGE].
  
 
|-
 
|-
| {{text anchor|FUEL}}
+
| style="vertical-align: top"| {{text anchor|FUEL}}
 
|
 
|
| Requires that the reaction either use up a unit of coal or charcoal or else be performed at a magma workshop
+
|
 +
| style="vertical-align: top"| Requires that the reaction either use up a unit of coal or charcoal or else be performed at a magma workshop.
  
 
|-
 
|-
| {{text anchor|GLASS_MATERIAL}}
+
| style="vertical-align: top"| {{text anchor|GLASS_MATERIAL}}
 
|
 
|
| Reagent material has [IS_GLASS].
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material has [IS_GLASS].
  
 
|-
 
|-
| {{text anchor|HAS_EDGE}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|HAS_EDGE}}
 
|
 
|
| Reagent must be sharpened (used for carving).
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must be sharpened (used for carving).
  
 
|-
 
|-
| {{text anchor|HAS_ITEM_REACTION_PRODUCT}}
+
| style="vertical-align: top"| {{text anchor|HAS_ITEM_REACTION_PRODUCT}}
| PRODUCT_ID (custom)
+
| style="vertical-align: top"|
| Similar to HAS_MATERIAL_REACTION_PRODUCT, but requires the reagents material to have a matching ITEM_REACTION_PRODUCT entry.
+
* PRODUCT_ID (custom)
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Similar to HAS_MATERIAL_REACTION_PRODUCT, but requires the reagents material to have a matching ITEM_REACTION_PRODUCT entry.
  
 
|-
 
|-
| {{text anchor|HAS_MATERIAL_REACTION_PRODUCT}}
+
| style="vertical-align: top"| {{text anchor|HAS_MATERIAL_REACTION_PRODUCT}}
| PRODUCT_ID (custom)
+
| style="vertical-align: top"|
| Similar to REACTION_CLASS, but requires the reagents material to have a matching [[Material definition token|MATERIAL_REACTION_PRODUCT]] entry. Intended for reactions which transform one class of material into another, such as skin->leather and fat->tallow.
+
* PRODUCT_ID (custom)
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Similar to REACTION_CLASS, but requires the reagents material to have a matching [[Material definition token|MATERIAL_REACTION_PRODUCT]] entry. Intended for reactions which transform one class of material into another, such as skin->leather and fat->tallow.
  
 
|-
 
|-
| {{text anchor|HAS_TOOL_USE}}
+
| style="vertical-align: top"| {{text anchor|HAS_TOOL_USE}}
| Tool-use token
+
| style="vertical-align: top"|
| Reagent must be a [[tool]] with the specific TOOL_USE value. The reagents item type must be TOOL:NONE for this to make any sense.
+
* [[Tool token#TOOL_USE|TOOL_USE value]]
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must be a [[tool]] with the specific TOOL_USE value. The reagents item type must be TOOL:NONE for this to make any sense.
  
 
|-
 
|-
| {{text anchor|HAS_WRITING_IMPROVEMENT}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|HAS_WRITING_IMPROVEMENT}}
 
|  
 
|  
| Reagent must contain writing.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must contain writing.
  
 
|-
 
|-
| {{text anchor|IMPROVEMENT}}
+
| style="vertical-align: top"| {{text anchor|IMPROVEMENT}}
|
+
| style="vertical-align: top"|  
 
* Probability
 
* Probability
* Reagent Name
+
* [[#Reagent name|Reagent name]]
 
* Improvement type
 
* Improvement type
 
* Material Token
 
* Material Token
| Improvement types include BANDS, COVERED, GLAZED, RINGS_HANGING, and SPIKES
+
|
 +
| style="vertical-align: top"| Applies an improvement to the named reagent.  Only meaningful if said reagent has [PRESERVE_REAGENT]. Improvement types include BANDS, COVERED, GLAZED, PAGES, RINGS_HANGING, and SPIKES
  
 
|-
 
|-
| {{text anchor|MAGMA_BUILD_SAFE}}
+
| style="vertical-align: top"| {{text anchor|IS_CRAFTED_ARTIFACT}}{{verify}}
 
|
 
|
| Currently broken - behaves exactly the same as FIRE_BUILD_SAFE.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent item must be an artifact.
  
 
|-
 
|-
| {{text anchor|MAX_MULTIPLIER}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|IS_DIVINE_MATERIAL}}
| number
+
|
| Sets the maximum number of times a reaction is allowed to run when using stacked reagents. This can be used to ensure that the reaction doesn't repeat until the entire stack is depleted.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must have the [DIVINE] token.
  
 
|-
 
|-
| {{text anchor|METAL_ORE}}
+
| style="vertical-align: top"| {{text anchor|MAGMA_BUILD_SAFE}}
 
|
 
|
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Currently broken - Reagent must be considered [[magma-safe]] (stable [[temperature]] below {{ct|12000}}).
 +
 +
|-
 +
| style="vertical-align: top"| {{text anchor|MAX_MULTIPLIER}}
 +
| style="vertical-align: top"|
 +
* Integer
 +
|
 +
| style="vertical-align: top"| Sets the maximum number of times a reaction is allowed to run when using stacked reagents. This can be used to ensure that the reaction doesn't repeat until the entire stack is depleted.
 +
 +
|-
 +
| style="vertical-align: top"| {{text anchor|METAL_ORE}}
 +
| style="vertical-align: top"|
 
* Inorganic material
 
* Inorganic material
| Reagent material must be an ore of the specified metal
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must be an ore of the specified metal.
 +
 
 +
|-
 +
| style="vertical-align: top"| {{text anchor|MIN_DIMENSION}}
 +
| style="vertical-align: top"|
 +
* Integer
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Requires that the reagent have a size of at least ''integer''. Only effective with BAR, POWDER_MISC, LIQUID_MISC, DRINK, THREAD, CLOTH, and GLOB items.
  
 
|-
 
|-
| {{text anchor|MIN_DIMENSION}}
+
| style="vertical-align: top"| {{text anchor|NAME}}
 +
| style="vertical-align: top"|
 +
* [[#name|Name]]
 
|
 
|
* size
+
| style="vertical-align: top"| Defines the name used by the reaction in-game.
| Requires that the reagent have a dimension of at least this value. Only effective with BAR, POWDER_MISC, LIQUID_MISC, DRINK, THREAD, CLOTH, and GLOB items.
 
  
 
|-
 
|-
| {{text anchor|NAME}}
+
| style="vertical-align: top"| {{text anchor|NO_EDGE_ALLOWED}}
| name
+
|
| defines the name used by the reaction in-game
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must not have an edge, so must be blunt. Sharp stones (produced using knapping) and most types of weapon/ammo can not be used with this token.
  
 
|-
 
|-
| {{text anchor|NO_EDGE_ALLOWED}}
+
| style="vertical-align: top"| {{text anchor|NOT_ARTIFACT}}{{verify}}
 
|
 
|
| Reagent must not be sharpened (used for knapping).
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent item must not be an artifact.
  
 
|-
 
|-
| {{text anchor|NOT_CONTAIN_BARREL_ITEM}}
+
| style="vertical-align: top"| {{text anchor|NOT_CONTAIN_BARREL_ITEM}}
 
|
 
|
| If the reagent is a Barrel, it must not contain an item that has to reside in a barrel.  Barrel items appear to be lye and milk.  Alcohol appears to be covered as part of [EMPTY].  A reaction which places an item in a barrel should probably have both tags.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| If the reagent is a Barrel, it must not contain an item that has to reside in a barrel.  Barrel items appear to be lye and milk.  Alcohol appears to be covered as part of [EMPTY].  A reaction which places an item in a barrel should probably have both tags.
  
 
|-
 
|-
| {{text anchor|NOT_ENGRAVED}}
+
| style="vertical-align: top"| {{text anchor|NOT_ENGRAVED}}
 
|
 
|
| Reagent can not be engraved. For example, a memorial slab can not be engraved.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent has not been engraved i.e. a blank memorial slab.
 
|-
 
|-
| {{text anchor|NOT_IMPROVED}}
+
| style="vertical-align: top"| {{text anchor|NOT_IMPROVED}}
 
|
 
|
| Reagent has not been decorated.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent has not been decorated.
  
 
|-
 
|-
| {{text anchor|NOT_PRESSED}}
+
| style="vertical-align: top"| {{text anchor|NOT_PRESSED}}
 
|
 
|
| Reagent must not be in the SOLID_PRESSED state.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must not be in the SOLID_PRESSED state.
  
 
|-
 
|-
| {{text anchor|NOT_WEB}}
+
| style="vertical-align: top"| {{text anchor|NOT_WEB}}
 
|
 
|
| Reagent must be "collected" - used with THREAD:NONE to exclude webs.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must be "collected" - used with THREAD:NONE to exclude webs.
  
 
|-
 
|-
| {{text anchor|POTASHABLE}} (Deprecated)
+
| style="vertical-align: top"| {{text anchor|ON_GROUND}}
 
|
 
|
| Alias for CONTAINS_LYE.
+
| style="vertical-align: top"| Reagent modifier
 +
| Reagent must be on the ground. Grabs from stockpiles. Does not grab from bins in stockpiles, nor inventories (workshops, wagon). Causes infinite collection of items if reaction is in workshop, as reagents are no longer on ground when brought to workshop. Untested in adventure mode; possibly more useful for adv. mode reactions.
  
 
|-
 
|-
| {{text anchor|PRESERVE_REAGENT}}
+
| style="vertical-align: top"| {{text anchor|POTASHABLE}} (Deprecated)
 
|
 
|
| Reagent is not destroyed, which is the normal effect, at the completion of the reaction. Typically used for containers.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Alias for [CONTAINS_LYE].
  
 
|-
 
|-
| {{text anchor|PRODUCT}}
+
| style="vertical-align: top"| {{text anchor|PRESERVE_REAGENT}}
 
|
 
|
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent is not destroyed, which is the normal effect, at the completion of the reaction. Typically used for containers.
 +
 +
|-
 +
| style="vertical-align: top"| {{text anchor|PRODUCT}}
 +
| style="vertical-align: top"|
 
*Probability of success (%)
 
*Probability of success (%)
 
*Quantity
 
*Quantity
 
*Item token:subtype
 
*Item token:subtype
 
*Material token:subtype
 
*Material token:subtype
| Defines a thing that comes out of the reaction. GET_MATERIAL_FROM_REAGENT and GET_ITEM_DATA_FROM_REAGENT can be used to defer the choice of material and/or item to the appropriate tag in a given reagent's material - the former comes in place of the material token, the latter replaces both the item and material tokens. See above for detailed information on how the hooks work.
+
|
 +
| style="vertical-align: top"| Defines a thing that comes out of the reaction. GET_MATERIAL_FROM_REAGENT and GET_ITEM_DATA_FROM_REAGENT can be used to defer the choice of material and/or item to the appropriate tag in a given reagent's material - the former comes in place of the material token, the latter replaces both the item and material tokens. See above for detailed information on how the hooks work.
  
 
|-
 
|-
| {{text anchor|PRODUCT_DIMENSION}}
+
| style="vertical-align: top"| {{text anchor|PRODUCT_DIMENSION}}
| size
+
| style="vertical-align: top"|
| Specifies the size of the product. A size of 150 is typical for BAR, POWDER_MISC, LIQUID_MISC, DRINK, and GLOB.  A size of 15000 is typical for THREAD, and a size of 10000 is typical for CLOTH.
+
* Size
 +
| style="vertical-align: top"| Product modifier
 +
| style="vertical-align: top"| Specifies the amount of the product for those items that use dimension. For items of type BAR, DRINK, GLOB, LIQUID_MISC, and POWDER_MISC, one item is dimension 150; one item of CLOTH or SHEET is dimension 10000; and one item of THREAD is dimension 15000. Has no effect on any other item types. Note: this is not the actual [[storage]] volume of the product, which is hard-coded by the item token.
  
 
|-
 
|-
| {{text anchor|PRODUCT_PASTE}}
+
| style="vertical-align: top"| {{text anchor|PRODUCT_PASTE}}
 
|
 
|
| Product is created in the SOLID_PASTE state.
+
| style="vertical-align: top"| Product modifier
 +
| style="vertical-align: top"| Product is created in the SOLID_PASTE state.
  
 
|-
 
|-
| {{text anchor|PRODUCT_PRESSED}}
+
| style="vertical-align: top"| {{text anchor|PRODUCT_PRESSED}}
 
|
 
|
| Product is created in the SOLID_PRESSED state.
+
| style="vertical-align: top"| Product modifier
 +
| style="vertical-align: top"| Product is created in the SOLID_PRESSED state.
  
 
|-
 
|-
| {{text anchor|PRODUCT_TO_CONTAINER}}
+
| style="vertical-align: top"| {{text anchor|PRODUCT_TO_CONTAINER}}
| Reagent ID
+
| style="vertical-align: top"|
| Places the product in a container; <id> must be the name of a reagent with the PRESERVE_REAGENT token and a container item type.
+
* [[#Reagent name|Reagent name]]
 +
| style="vertical-align: top"| Product modifier
 +
| style="vertical-align: top"| Places the product in a container; reagent name must be the name of a reagent with the [PRESERVE_REAGENT] token and a container item type.
  
 
|-
 
|-
| {{text anchor|PRODUCT_TOKEN}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|PRODUCT_TOKEN}}
| name
+
| style="vertical-align: top"|  
| Allows the product to be referred to by the given name, for the purpose of being passed down as argument in other tokens.
+
* Name
 +
| style="vertical-align: top"| Product modifier
 +
| style="vertical-align: top"| Allows the product to be referred to by the given name, for the purpose of being passed down as argument in other tokens in the same fashion as reagent names.
  
 
|-
 
|-
| {{text anchor|REACTION}}
+
| style="vertical-align: top"| {{text anchor|REACTION}}
| Identifier
+
| style="vertical-align: top"|
| defines a new reaction
+
* Identifier
 +
|
 +
| style="vertical-align: top"| Defines a new reaction.
  
 
|-
 
|-
| {{text anchor|REACTION_CLASS}}
+
| style="vertical-align: top"| {{text anchor|REACTION_CLASS}}
| CLASS_ID (custom)
+
| style="vertical-align: top"|
| Requires the reagent's material to have a matching [[Material definition token|REACTION_CLASS]] entry. Intended for reactions which accept a variety of materials but where the input material does not determine the output material, such as FLUX (for making pig iron and steel) and GYPSUM (for producing plaster powder).
+
* CLASS_ID (custom)
 +
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Requires the reagent's material to have a matching [[Material definition token|REACTION_CLASS]] entry. Intended for reactions which accept a variety of materials but where the input material does not determine the output material, such as FLUX (for making pig iron and steel) and GYPSUM (for producing plaster powder).
  
 
|-
 
|-
| {{text anchor|REAGENT}}
+
| style="vertical-align: top"| {{text anchor|REAGENT}}
 +
| style="vertical-align: top"|
 +
* [[#Reagent name|Reagent name]]
 +
* [[#quantity|Quantity]]
 +
* [[Item token]]
 +
* [[Material token]]
 
|
 
|
* name/id
+
| style="vertical-align: top"| Specifies a given reagent as an input for a reaction.
* quantity
 
* [[item token]]
 
* [[material token]]
 
| Requires a given reagent as an input for a reaction
 
  
 
|-
 
|-
| {{text anchor|SKILL}}
+
| style="vertical-align: top"| {{text anchor|SKILL}}
| Skill Token
+
| style="vertical-align: top"|
| Skill used by the reaction
+
* [[Skill token]]
 +
|
 +
| style="vertical-align: top"| Skill used by the reaction.
  
 
|-
 
|-
| {{text anchor|SKILL_IP}}{{version|0.47.01}}
+
| style="vertical-align: top"| {{text anchor|SKILL_IP}}
| integer
+
| style="vertical-align: top"|  
| Amount of skill given per product made. Default is 30.  
+
* Integer
 +
| style="vertical-align: top"| Skill modifier
 +
| style="vertical-align: top"| Amount of skill given per product made. Default is 30.  
  
 
|-
 
|-
| {{text anchor|SKILL_ROLL_RANGE}}{{version|0.47.01}}
+
| style="vertical-align: top"| {{text anchor|SKILL_ROLL_RANGE}}
 +
|  style="vertical-align: top"|
 +
* Range
 +
* Multiplier
 +
| style="vertical-align: top"| Skill modifier
 +
| style="vertical-align: top"| Determines how [[skill]] level affects [[quality]] of the reaction product.  The skill roll is random(range) + random((skill level * multipler)/2 + 1) + random((skill level * multipler)/2 + 1). random(x) returns a number between 0 and x-1, so range is always 1 or more.  The default is 11. The default multiplier is 5. Higher skill rolls give better results.
 +
 
 +
|-
 +
| style="vertical-align: top"| {{text anchor|TRANSFER_ARTIFACT_STATUS}}
 
|  
 
|  
* basic range
+
| style="vertical-align: top"| Product modifier
* multiplier
+
| style="vertical-align: top"| Transfers artifact status from the reagent to the product.
| The skill roll is random(basic range) + random((skill level * multipler)/2 + 1) + random((skill level * multipler)/2 + 1). random(x) returns a number between 0 and x-1, so basic range is always 1 or more.  The default is 11. The default multiplier is 5. Higher skill rolls give better results.
 
  
 
|-
 
|-
| {{text anchor|TRANSFER_ARTIFACT_STATUS}}{{version|0.42.01}}
+
| style="vertical-align: top"| {{text anchor|UNROTTEN}}
|  
+
|
| Transfers artifact status from the reagent to the product.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must not be rotten, mainly for organic materials.
  
 
|-
 
|-
| {{text anchor|UNROTTEN}}
+
| style="vertical-align: top"| {{text anchor|USE_BODY_COMPONENT}}
 
|
 
|
| Reagent must not be rotten, mainly for organic materials.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must come off a creature's body.
  
 
|-
 
|-
| {{text anchor|USE_BODY_COMPONENT}}
+
| style="vertical-align: top"| {{text anchor|WEB_ONLY}}
 
|
 
|
| Reagent material must come off a creature's body.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent must be "undisturbed" - used with THREAD:NONE to gather webs.
  
 
|-
 
|-
| {{text anchor|WEB_ONLY}}
+
| style="vertical-align: top"| {{text anchor|WORTHLESS_STONE_ONLY}}
 
|
 
|
| Reagent must be "undisturbed" - used with THREAD:NONE to gather webs.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent is not made of an economic stone.
  
 
|-
 
|-
| {{text anchor|WORTHLESS_STONE_ONLY}}
+
| style="vertical-align: top"| {{text anchor|WOVEN_ITEM}}
 
|
 
|
| Reagent is not made of an economic stone.
+
| style="vertical-align: top"| Reagent modifier
 +
| style="vertical-align: top"| Reagent material must be a woven material, eg. plant cloth, silk, yarn. This ''excludes'' CLOTH or THREAD items.
  
 
|}
 
|}
 +
 +
== Examples ==
 +
:''Main articles: [[Reaction Examples]]''
  
 
{{Category|Modding}}
 
{{Category|Modding}}
 
{{Category|Tokens}}
 
{{Category|Tokens}}
 
[[ru:Reaction]]
 
[[ru:Reaction]]

Latest revision as of 12:49, 23 October 2024

This article is about the current version of DF.
Note that some content may still need to be updated.


Reactions are modular, editable formulas that take specific ingredients, or reagents, and use them to produce a desired item. A lot of reactions are hardcoded—building beds or creating glass, for example—but a few are freely editable, and it's (sometimes) quite simple to add additional ones. There is a separate page with custom reaction examples.

Reaction differences between modes[edit]


In fortress mode, reactions are linked to specific buildings, and must be added to a civilization's entity file to be usable by that civilization. This has the useful effect of limiting new items and materials (such as special wood or metal) to civilizations that have the requisite reaction — so that if you give your custom civilization a reaction to produce "star metal" or some other custom material, only they will be able to use it.

In adventure mode, reactions are freely available in the x menu via the create option, and any adventurer character can make free use of them. Reagents may be held in the hands or dropped on the ground, but cannot be used within a backpack or quiver. There are several bugs with adventure mode reactions, chief of which is the fact that you cannot select liquid reagents.[Verify]

Anatomy of a reaction[edit]

Reactions are found within reaction_x files (such as reaction_smelter or reaction_other). All reaction files must begin with the file name, followed by the [OBJECT:REACTION] token that tells the game that the file contains reaction definitions.

The reactions themselves generally adhere to the following structure:

  [REACTION:<identifier>]
     [NAME:<name>]
     [BUILDING:<BUILDING NAME>:<BUILDING KEY>]
     [REAGENT:A:150:BAR:NONE:POTASH:NONE]
     [PRODUCT:100:1:BAR:NONE:PEARLASH:NONE][PRODUCT_DIMENSION:150]
     [FUEL] 
     [SKILL:<SKILL TOKEN>]
     [MAX_MULTIPLIER:<multiplier>]
     [AUTOMATIC]
     [ADVENTURE_MODE_ENABLED]
     [DESCRIPTION:<description>]
  • identifier: The internal ID of the reaction.
  • name: The name of the reaction, visible to the player in the Fortress mode or Adventure mode menus.
  • building: The building ID that the reaction uses, and the relevant keyboard shortcut.
  • ...reagents...: Zero or more reagents (ingredients) that are required to be in stock for the reaction to be possible.
  • ...products...: Zero or more products that are created from the reaction.
  • fuel: (optional) If present, the reaction requires charcoal, coke or a magma-powered workshop.
  • skill: (optional) The skill required and trained by the reaction.
  • multiplier: (optional) If present, the reaction will only be done the specified number of times per job; used to limit the output of reactions that accept stacks of items as reagents.
  • automatic: (optional) If present, the reaction will automatically be enqueued whenever it can possibly be performed.
  • adventure mode enabled: (optional) If present, the reaction can be used by the player in Adventure mode.
  • description: (optional) If present, shows pop-up description when the reaction is selected in workshop (not working in v50).

Reaction identifier[edit]

The REACTION token assigns a unique ID to your reaction.

   [REACTION:<reaction identifier>]

The reaction identifier may be anything, so long as it is unique within the raw data files. A good habit to get into is to append a short prefix or suffix to each name related to the name of your mod, to ensure nobody else is going to make an identical reaction and thereby mess up the game if their mod is run alongside yours. This is referenced in an entity definition via PERMITTED_REACTION to allow that entity to use the reaction.

Reaction name[edit]

The REACTION_NAME token assigns a descriptive name to your reaction in-game.

   [REACTION_NAME:<name>]

Name[edit]

This can be anything at all, and is how the reaction will appear in the job list of the building it is assigned to, and so should describe the reaction. Tan a hide, for example, is the name of the default leather-producing reaction. Generally this should be written as a small descriptive verb phrase, with the first letter capitalized, for consistency with the existing reactions.

Building[edit]

The BUILDING token assigns the reaction to a building. Adding multiple BUILDING tokens will cause the reaction to be available at all of the specified buildings. Omitting the BUILDING token entirely will make the reaction unusable in Fortress mode (often used to restrict certain reactions to Adventure mode).

   [BUILDING:<building name>:<building key>]
  • building name: The ID of the building the reaction appears in.
  • building key: The hotkey to queue up the reaction in the specified building.

Building name[edit]

This is the ID of the building where the reaction will be carried out. Valid building names are as follows:

Building key[edit]

This defines the shortcut key(s) used to queue up the reaction in the workshop during gameplay in Classic mode only. It can be NONE for no shortcut, or take the format of CUSTOM_X, where X can be: any uppercase letter, which shows as a lowercase letter in the building UI, eg. "CUSTOM_A" creates the shortcut a; or a valid modifier key (ALT, CTRL, or SHIFT) followed by an uppercase letter, eg. CUSTOM_SHIFT_A.

Category[edit]

Categories are custom submenus for buildings' reaction menus. A reaction doesn't require a category, but if you have a lot of reactions, categories can be invaluable for organizing and presenting those reactions to players.

Categories can be nested indefinitely—you can have a category within a category within a category within a category within a category within... but as a practical matter, nesting categories more than 2 deep is not recommended.

Categories will be displayed in alphabetical order, first off the file name and then off the category name.

Categories currently have no effect on adventure mode reactions.

Defining a category[edit]

Each category needs to be defined within a reaction, usually one which should appear within its menu. Categories only need to be defined once.

Token Arguments Description
CATEGORY Category ID The category ID is a unique identifier for the category. It is only used in the raws, and will not appear in the game.

If you're defining multiple categories within the same reaction - for example, if you intend the reaction to be nested two deep, and haven't yet defined the super-category - the last CATEGORY token within the reaction definition is the one that the reaction will appear in.

CATEGORY_NAME String The name of the category as displayed in-game.
CATEGORY_DESCRIPTION String Optional. If present, when the category is highlighted in a building menu, this string will be displayed in the Helpful Hint box.
CATEGORY_PARENT Category ID Optional. If present, this category will be a submenu of the indicated category, rather than a submenu of the reaction's building.
CATEGORY_KEY Hotkey token Optional. If present, this category can be selected from its parent menu (whether a building or a parent category) using the given hotkey. Uses the same format as the BUILDING KEY described above.

Adding reactions to an existing category[edit]

Just include the tag [CATEGORY:<category_id>] within your reaction definition, and if the category exists, your reaction will be added to its menu. You can only add reactions to custom categories.

Each reaction can belong to only one category.

Reagents[edit]

REAGENTs are a little bit complicated. They are the ingredients that the reaction will use. You can define as many as you like within a reaction.

   [REAGENT:<name>:<quantity>:<item token>:<material token>][...modifiers...]
  • name: The name of the reagent, local to the reaction.
  • quantity: The amount of the item that will be used in the reaction.
  • item token: The type (and subtype) of the item you require.
  • material token: The material the item should be made of.
  • ...modifiers...: Zero or more tokens which further clarify the acceptable types when the item type and material types are insufficient to distinguish them.

Name[edit]

The name field is a small string used to identify the reagent within the reaction. The name is not visible to the player. It is local to the reaction and does not need to be unique across all of the reactions, so you can reuse the same names over and over, although each reagent within the same individual reaction must have a different name.

Most reagents are simply named A, B, and so forth in default reactions, although names such as TOOLSTONE, FLUX, or seeds will also work equally well. The PRODUCT may make reference to this name – for instance, if a container B is specified as a reagent, PRODUCT_TO_CONTAINER:B specifies that container.

Quantity[edit]

How many or how much of this reagent the reaction requires. For most item types this is just the number of them required. However, some other item types─specifically bars, cloth, thread, globs, liquids, powder, and sheets of paper or parchment─instead use numbers representing the size of the material within one (or more) of these items. For example, while REAGENT:A:10:TOY:NONE:NONE:NONE is ten unique, solid toy items, REAGENT:A:10:THREAD:NONE:NONE:NONE is an extremely tiny portion of a random spool of thread. One can see which items have what size quantities in the description of the PRODUCT_DIMENSION token.

If one of the reagents is in a stack, or the reaction is only using a fraction of the amount of a sized item, the reaction will consume the entire stack, or as much of the sized item as possible, and multiply the product accordingly. This behaviour can be controlled using the MAX_MULTIPLIER token.

Item token[edit]

Item tokens are of the form ITEM_TYPE:ITEM_SUBTYPE.

The ITEM_TYPE is the category of item you require; WEAPON, TOY or SKIN_TANNED, for example.

The ITEM_SUBTYPE is name of the exact item that you require. Examples are ITEM_WEAPON_SPEAR or ITEM_TOY_PUZZLEBOX. Some items, like quivers or backpacks, or chunks of stone or metal, have no subtype and only require the item token to be filled in; so if you're asking for those you should set the subtype to NONE. Subtypes are defined within the local raw data files and their exact names can be referenced by looking at the corresponding file.

For reagents, the item token can also be set to ANY_RAW_MATERIAL:NONE (to permit BAR, BOULDER, POWDER_MISC, or GLOB) or ANY_CRAFT:NONE (to permit FIGURINE, AMULET, SCEPTER, CROWN, RING, EARRING, or BRACELET). Internally, these special values are both converted to NONE:NONE and merely set special modifiers (similar to [BUILDMAT])—they cannot be used in any other context.

For backwards compatibility, reagents can also accept "METAL_ORE:metal_id" in place of both the item and material tokens—this is equivalent to using the reagent BOULDER:NONE:NONE:NONE with the modifier [METAL_ORE:metal_id] (see below).

Material token[edit]

Material tokens come in several forms. For most reagents, this will typically be INORGANIC:MATERIAL_ID or NONE:NONE (to allow multiple materials using other modifier tokens).

Some reactions will allow the player to select specific materials after creating the job (or in some cases, armor size from the product), by clicking on the magnifying glass icon next to the job in the workshop queue. To permit this behaviour in your reaction, the reagent materials must be specified as follows:

Item Type Material Notes
BAR
BLOCKS
BOULDER
ROUGH
SMALLGEM
INORGANIC:NONE These all appear as "stone" in the material selection menu, and list all inorganic materials regardless of any material modifier tokens, eg. [ITEMS_METAL]. BAR and BLOCKS made of organic materials, and BOULDER made of clay, are excluded.
SKIN_TANNED or WOOD NONE:NONE
Other Item Types NONE:NONE These will appear if a material modifier token other than [ANY_LEATHER_MATERIAL] is included.

Modifiers[edit]

Reagents may also have extra tokens added on, following the REAGENT token, in order to modify their behaviour.

Generally speaking, if you set a field in a reagent to NONE, the reaction won't discriminate when it comes to that particular field. For example, if you require a BOULDER reagent but leave the material as NONE:NONE, it will grab any available BOULDER-type item regardless of material. Modifiers can then be used to restrict this to only certain broad classes of materials.

The following is a list of all known reagent modifiers:

Token Arguments Description
ANY_BONE_MATERIAL Reagent material must have the [BONE] token.
ANY_GEM_MATERIAL Reagent material must have the [IS_GEM] token.
ANY_HORN_MATERIAL Reagent material must have the [HORN] token.
ANY_LEATHER_MATERIAL Reagent material must have the [LEATHER] token.
ANY_PEARL_MATERIAL Reagent material must have the [PEARL] token.
ANY_PLANT_MATERIAL Reagent material must be subordinate to a PLANT object.
ANY_SHELL_MATERIAL Reagent material must have the [SHELL] token.
ANY_SILK_MATERIAL Reagent material must have the [SILK] token.
ANY_SOAP_MATERIAL Reagent material must have the [SOAP] token.
ANY_STONE_MATERIAL Reagent material must have the [IS_STONE] token.
ANY_STRAND_TISSUE Reagent is made of a tissue having TISSUE_SHAPE:STRANDS, intended for matching hair and wool. Must be used with USE_BODY_COMPONENT.
ANY_TOOTH_MATERIAL Reagent material must have the [TOOTH] token.
ANY_WOOD_MATERIAL Reagent material must have the [WOOD] token.
ANY_YARN_MATERIAL Reagent material must have the [YARN] token.
BUILDMAT Reagent must be a general building material - BAR, BLOCKS, BOULDER, or WOOD.
CAN_USE_ARTIFACT Reagent can be an Artifact. Using [PRESERVE_REAGENT] with this is strongly advised.
CONTAINS Reagent is a container that holds the specified reagent (where Reagent name is the locally-defined name of the reagent).
CONTAINS_LYE Reagent must be a BARREL or TOOL which contains at least one item of type LIQUID_MISC made of LYE. Use of this token is discouraged, as it does not work with buckets (instead, use [CONTAINS:lye] — note the colon — and a corresponding lye reagent [REAGENT:lye:150:LIQUID_MISC:NONE:LYE]).
DOES_NOT_ABSORB Reagent material must have ABSORPTION:0
DOES_NOT_DETERMINE_PRODUCT_AMOUNT Reagent quantity is ignored for the purposes of producing extra outputs. Typically used for containers so that stacks of reagents will correctly produce additional outputs.
EMPTY If the reagent is a container, it must be empty.
FIRE_BUILD_SAFE Reagent material must be solid and stable at temperatures approaching 11000. Only works with items of type BAR, BLOCKS, BOULDER, WOOD, and ANVIL - all others are considered unsafe.
FOOD_STORAGE_CONTAINER Reagent is either a BARREL or a TOOL with the FOOD_STORAGE use.
GLASS_MATERIAL Reagent material must have the IS_GLASS token. All 3 types of glass have this token hardcoded.
HARD_ITEM_MATERIAL Reagent material must have the [ITEMS_HARD] token.
HAS_EDGE Reagent must have an edge.
HAS_ITEM_REACTION_PRODUCT
  • PRODUCT_ID
Reagent material must have the item reaction product specified by PRODUCT_ID - see below for more details. This can be used interchangeably with HAS_MATERIAL_REACTION_PRODUCT.
HAS_MATERIAL_REACTION_PRODUCT
  • PRODUCT_ID
Reagent material must have the material reaction product specified by PRODUCT_ID - see below for more details.
HAS_TOOL_USE Reagent must be a tool with the specific TOOL_USE value. The reagent's item type must be TOOL:NONE for this to make any sense.
IS_CRAFTED_ARTIFACT[Verify] Reagent item must be an artifact.
IS_DIVINE_MATERIAL Reagent material must have the [DIVINE] token.
IS_SAND_MATERIAL Reagent material must have the [SOIL_SAND] token.
MAGMA_BUILD_SAFE Reagent material must be solid and stable at temperatures approaching 12000. Only works with items of type BAR, BLOCKS, BOULDER, WOOD, and ANVIL - all others are considered unsafe.
METAL_ITEM_MATERIAL Reagent material must have the [ITEMS_METAL] token.
METAL_ORE
  • Metal ID
Reagent material must be an ore of the specified metal.
MIN_DIMENSION
  • Integer
Reagent's item size must be at least as large as Integer. The reagent's item type must be BAR, POWDER_MISC, LIQUID_MISC, DRINK, THREAD, CLOTH, or GLOB for this to work. See PRODUCT_DIMENSION below.
NO_EDGE_ALLOWED Reagent must not have an edge, so must be blunt. Sharp stones (produced using knapping) and most types of weapon/ammo can not be used with this token.
NOT_ARTIFACT[Verify] Reagent item must not be an artifact.
NOT_CONTAIN_BARREL_ITEM If the reagent is a container, it must not contain lye or milk. Not necessary if specifying [EMPTY].
NOT_ENGRAVED Reagent can not be engraved. For example, a memorial slab can not be engraved.
NOT_IMPROVED Reagent has not been decorated.
NOT_PRESSED Reagent must not be in the SOLID_PRESSED state.
NOT_WEB Reagent must be collected (to distinguish silk thread from webs). Only makes sense for items of type THREAD.
ON_GROUND Reagent must be on the ground. Grabs from stockpiles. Does not grab from inventories (workshops, wagon) and causes infinite gathering for reactions in workshop.
POTASHABLE (Deprecated) Alias for [CONTAINS_LYE].
PRESERVE_REAGENT Reagent is not destroyed, which is the normal effect, at the completion of the reaction. Typically used for containers.
REACTION_CLASS
  • CLASS_ID
Reagent material must have the reaction class specified by CLASS_ID - see below for more details.
UNROTTEN Reagent must not be rotten, mainly for organic materials.
USE_BODY_COMPONENT Reagent must be a body part (CORPSE or CORPSEPIECE). Must be used even if your reagent item type is CORPSE or CORPSEPIECE, otherwise it will match any item.
WEB_ONLY Reagent must be undisturbed (to distinguish silk thread from webs). Only makes sense for items of type THREAD.
WORTHLESS_STONE_ONLY Reagent material must be non-economic.
WOVEN_ITEM Reagent must be a clothing item made of a woven material, ie. plant, silk, or yarn cloth.

Products[edit]

Products are the end product of the reaction. A reaction can have as many products as it likes.

Products are almost identical to reagents, except that they do not need to be named, can't have fields undefined, and don't use the quantity field to determine the product size. Instead, the token [PRODUCT_DIMENSION:X] is tacked on after the PRODUCT token, determining the size of the product.

Products can be produced directly to a container using the [PRODUCT_TO_CONTAINER:name] token, where the name is the name of a reagent. This requires the reagent to have the [PRESERVE_REAGENT] token.

Restating this in the above style, we have:

  [PRODUCT:<probability>:<quantity>:<item token>:<material token>][...modifiers...]

Probability[edit]

The percentage chance the product will be produced when the reaction is completed. Must be an integer.

Quantity[edit]

Determines how many of the product will be produced. For the item types AMMO, REMAINS, MEAT, FISH, FISH_RAW, PLANT, PLANT_GROWTH, DRINK, CHEESE, LIQUID_MISC, COIN, and EGG, the resulting items will be created as a single stack, while all other item types will produce multiple individual items.

If a reaction can take stacks of input items, then it will attempt to perform the reaction enough times to consume as many full sets of reagents as it can—for example, if a reaction "1 piece of meat + 2 pieces of fish -> 3 pieces of cheese" is given a stack of 5 meat and 5 fish, it will produce 6 pieces of cheese and leave 3 meat and 1 fish behind. Using the token DOES_NOT_DETERMINE_PRODUCT_AMOUNT allows a reagent to be excluded from this calculation - for example, with the reaction "1 plant + 1 barrel -> 5 alcohol (into barrel)", using this on the barrel allows the reaction to be performed as "5 plant + 1 barrel -> 25 alcohol" instead of "5 plant + 5 barrel -> 25 alcohol".

Item token[edit]

The item token and subtype of the item you produce.

If your item has an item reaction product and you want the item type and material to be derived from one of the reagents, you can use GET_ITEM_DATA_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of both the item token and the material token (see next section). You can also specify GET_ITEM_DATA_FROM_REAGENT:reagent:NONE in order to make a direct copy of the source item, though this will not work for complex items such as corpses or prepared meals.

For products, this can also be set to CRAFTS:NONE to produce up to three random craft items. This value cannot be used in any other context.

Material token[edit]

A material token describing what the product will be made of.

If you want the product's material to be derived from one of the reagents, you can use GET_MATERIAL_FROM_REAGENT:reagent:NONE in place of the material token in order to directly use the reagent's own material; if the reagent has a material reaction product defined, you can use GET_MATERIAL_FROM_REAGENT:reagent:REACTION_PRODUCT_ID to use that.

Similarly to choosing material types for a reagent, if the item product is armor/clothing, and has the appropriate armor token in the entity file, you will be able to choose the armor/clothing size for different creatures by clicking the magnifying glass of the workshop task. However, this will only work if the product material is cloth leather or certain metals, and the item is also recognized by the related vanilla workshop reaction[Verify].

Product modifiers[edit]

Zero or more tokens which further set the properties or disposition of the resulting product item.

Token Arguments Description
FORCE_EDGE Product is given a sharp edge. Used for knapping.
PRODUCT_PASTE Product is created in the SOLID_PASTE state.
PRODUCT_PRESSED Product is created in the SOLID_PRESSED state.
PRODUCT_DIMENSION
  • Integer
Specifies the dimension of the product for those items that use dimensions. For items of type BAR, DRINK, GLOB, LIQUID_MISC, and POWDER_MISC, one item is dimension 150; one item of CLOTH or SHEET is dimension 10000; and one item of THREAD is dimension 15000. Has no effect on any other item types. Note: this is not the actual storage volume of the product, which is hard-coded by the item token.
PRODUCT_TO_CONTAINER Places the product in a container; Name must be the name of a reagent with the [PRESERVE_REAGENT] token and a container item type.
PRODUCT_TOKEN Allows the product to be referred to by the given name for the purpose of being passed down as and argument in other tokens, in the same fashion as reagent names.
TRANSFER_ARTIFACT_STATUS Transfers artifact status from the reagent to the product.

Improvements[edit]

Improvements are applied to existing reagents. A reaction can have as many improvements as it likes.

Restating this in the above style, we have:

  [IMPROVEMENT:<probability>:<reagent name>:<improvement type>:<material token>]

Probability[edit]

The percentage chance the improvement will be applied to the reagent when the reaction is completed.

Reagent name[edit]

The name of the reagent that will be improved. In order to be meaningful, this reagent must have [PRESERVE_REAGENT].

Improvement type[edit]

The following improvement types can be used:

Token Description
COVERED Item is encrusted/studded/decorated with <material>.
GLAZED Item is glazed with <material>.
RINGS_HANGING Item is adorned with hanging rings of <material>.
BANDS Item is encircled with bands of <material>.
SPIKES Item menaces with spikes of <material>.
PAGES Adds pages to a book.
SPECIFIC With subtype ROLLERS, adds rollers of <material> to a scroll; with subtype HANDLE, adds a handle of <material> to an item; with subtype TRACTION_BENCH_CHAIN or TRACTION_BENCH_ROPE adds a chain or rope of <material> to an item.

All other item improvement tokens (ART_IMAGE, ITEMSPECIFIC, THREAD, CLOTH, SEWN_IMAGE, and ILLUSTRATION) are ignored.

Material token[edit]

A material token describing what the decoration will be made of.

If you want the product's material to be derived from one of the reagents, and the reagent has a material reaction product defined, you can use GET_MATERIAL_FROM_REAGENT:reagent:REACTION_PRODUCT_ID in place of the material token. You can also specify GET_MATERIAL_FROM_REAGENT:reagent:NONE in order to directly use the reagent's own material.

Other tokens[edit]

Fuel[edit]

The FUEL token means that the reaction requires coke or charcoal to be performed. Fuel is not needed when the reaction is performed at a magma workshop (a magma kiln, magma smelter, or any custom building having [NEEDS_MAGMA]).

Skill[edit]

The skill tokens determine what skill the reaction requires and trains; also how quickly skill is gained, how quickly those skill gains raise attributes, and how skill level affects the quality of the reaction product.

Token Arguments Description
SKILL (Optional) This identifies the skill required to carry out the reaction and is trained when the reaction is performed. Only one skill may be specified; if multiple skill tokens are defined only the last will be used. A reaction with no product will yield no experience gain. A reaction with no SKILL token will complete in a default amount of time.
SKILL_IP
  • Integer
(Optional, requires SKILL token) This adjusts the amount of skill gained each time the reaction is carried out. The default value is 30; higher values increase the amount of skill gain.
ATTRIBUTE_IP
  • Integer
(Optional, requires SKILL token) This adjusts the amount of attribute gain that skill gain from this reaction results in. The default value is 10; higher values increase the amount of attribute gain.
SKILL_ROLL_RANGE
  • Range
  • Multiplier
(Optional, requires SKILL token) This changes how much skill level affects the quality of the reaction product. The default is [SKILL_ROLL_RANGE:11:5]. The range is the base "die roll" and the multiplier determines how much the dwarf's skill can affect the reaction; the skill roll is random(range) + random((skill level * multipler)/2 + 1) + random((skill level * multipler)/2 + 1), where random(x) gives a random number from 0 to x-1, inclusive (which also means that the minimum for the range is 1). The higher result on the roll, the better. Both numbers can be lowered to make the skill check harder. For example, with the default values a dwarf who is proficient in a skill has a skill level of 5; their roll will be random(11)+random(13)+random(13), meaning this dwarf can roll anywhere from 0 to 34; similarly, unskilled dwarves can roll 0 to 10 while legendary+0 (skill 15) dwarves can roll 0 to 84. If this is changed to [SKILL_ROLL_RANGE:1:8], then instead a proficient dwarf will have random(1)+random(21)+random(21), giving a roll of 0 to 40, with unskilled dwarves always rolling 0 and legendary dwarves going all the way up to 120.

As a consequence, increasing the multiplier will always make legendary dwarves more effective, even if base roll is reduced to its minimum of 1, with the default going up to 84 for default and 90 for [SKILL_ROLL_RANGE:1:6].

Max multiplier[edit]

The [MAX_MULTIPLIER:<#>] token specifies how many times to do the reaction. This can be used to limit stacked reagent use to the specified quantity instead of the whole stack.

Automatic[edit]

The AUTOMATIC token means that the reaction will be queued automatically if the reaction reagents are all present.

This token only works with jobs performed at a kiln, smelter, tanner's shop, kitchen, or custom workshop, and standing orders allow you to limit which ones trigger; custom reactions performed at a quern, millstone[Verify], still[Verify] or craftsdwarf's workshop[Verify] cannot be made automatic.

Adventure mode enabled[edit]

The ADVENTURE_MODE_ENABLED token means that this version of the reaction can be used by the wanderers of Adventure Mode without needing to also give the dwarves at home in a fortress access to it. When using this token, it will be allowed for adventurers of any race, without editing entity files. This token does not prevent Fortress Mode usage assuming the reaction also has a usable building assigned and is a [PERMITTED_REACTION] within the entity file.

Description[edit]

This feature is exclusive to Classic Mode, as no description window pops up when mousing over reactions in workshops in Premium.

The [DESCRIPTION:<string>] token provides a text description of the reaction when it is highlighted in the building UI. Multiple DESCRIPTION tokens can be defined in a reaction, and each will appear on a new line. The pop-up box that contains the description is limited to 325 characters total. Alternatively, this token can reference a DESCRIPTION token in an existing tool definition by replacing string with USE_TOOL:<ITEM_SUBTYPE>; or an existing instrument definition with USE_INSTRUMENT:<ITEM_SUBTYPE>.

Reaction classes and products[edit]

When you're doing things like tanning hides or brewing alcohol, having separate reactions for every single possible raw material is unwieldy and terrible. However, you can let the reaction itself ask the material for details and process them all with the same reaction. There are three types of tags to dictate this behavior.

Reaction classes[edit]

The simplest token is the reaction class. If it is tacked on a material, a reaction can limit reagents to only those materials that have the specified arbitrary [REACTION_CLASS:whatever] identifier.

We want a reaction that smelts iron and flux into pig iron. However, there are a half-dozen different stones that count as flux. Instead of clogging up the smelter job menu with six nearly identical reactions that all take in either dolomite or limestone or marble for the same result, we use a reaction class.

  [REACTION:PIG_IRON_MAKING]
     [NAME:make pig iron bars]
     [BUILDING:SMELTER:NONE]
     [REAGENT:A:150:BAR:NO_SUBTYPE:METAL:IRON]
     [REAGENT:B:1:BOULDER:NO_SUBTYPE:NONE:NONE][REACTION_CLASS:FLUX]
     [REAGENT:C:150:BAR:NO_SUBTYPE:COAL:NO_MATGLOSS]
     [PRODUCT:100:1:BAR:NO_SUBTYPE:METAL:PIG_IRON][PRODUCT_DIMENSION:150]
     [FUEL]
     [SKILL:SMELT]

Note how reagent B asks for "NONE:NONE" as its material. This means "boulders of any kind as long as they have the reaction class named FLUX". Stuff like calcite, here:

  [INORGANIC:CALCITE]
     [USE_MATERIAL_TEMPLATE:STONE_TEMPLATE]
     [STATE_NAME_ADJ:ALL_SOLID:calcite][DISPLAY_COLOR:7:7:1][TILE:'"']
     [REACTION_CLASS:FLUX]
     [ENVIRONMENT_SPEC:LIMESTONE:CLUSTER_SMALL:100]
     [ENVIRONMENT_SPEC:MARBLE:CLUSTER_SMALL:100]
     [MATERIAL_VALUE:2]
     [IS_STONE]
     [MELTING_POINT:12902]
     [SOLID_DENSITY:2930]

The label itself can be absolutely anything. It's only used to find a match between the material and the reaction. Note that some reaction classes have special meanings to the game itself—notably, the site finder knows that "FLUX" should be connected to the "Flux stone" filter.

Material reaction products[edit]

But what if it's not all the same what materials the members of the reaction class put out? If a tanner starts working on a bear pelt, a horse hide, some dragon scales and a section of human skin, surely they all can't produce generic boot leather! No, the reaction must get the chance to ask the "reaction class" what the reagent should turn out as. We will declare a material reaction product.

  [REACTION:TAN_A_HIDE]
     [NAME:tan a hide]
     [BUILDING:TANNER:CUSTOM_T]
        [REAGENT:flaps of skin:1:NONE:NONE:NONE:NONE][USE_BODY_COMPONENT][UNROTTEN]
           [HAS_MATERIAL_REACTION_PRODUCT:TAN_MAT]
        [PRODUCT:100:1:SKIN_TANNED:NONE:GET_MATERIAL_FROM_REAGENT:flaps of skin:TAN_MAT]
     [SKILL:TANNER]
     [AUTOMATIC]

Where you'd usually have some fresh bodypart with the TAN_MAT reaction class produce some generic SKIN_TANNED, this goes further. Instead of declaring a material, the spool of pattern-ready tailoring leather (SKIN_TANNED) now comes out as whatever the skin flaps' material reaction product (named TAN_MAT) says in the material's definition (GET_MATERIAL_FROM_REAGENT). And what does it say?

  [MATERIAL_TEMPLATE:SKIN_TEMPLATE]
        [STATE_COLOR:ALL_SOLID:GRAY]
        [STATE_NAME:ALL_SOLID:skin]
        [STATE_ADJ:ALL_SOLID:skin]
        ...
        [ABSORPTION:100]
        [MATERIAL_REACTION_PRODUCT:TAN_MAT:LOCAL_CREATURE_MAT:LEATHER]
        [IMPLIES_ANIMAL_KILL]
        [ROTS]

It says that the caller of the TAN_MAT hook always comes out as the LEATHER of whatever creature the skin has been peeled off of (LOCAL_CREATURE_MAT). For example, skin taken from a butchered dog would be turned into dog leather. Change the SKIN_TEMPLATE MATERIAL_REACTION_PRODUCT to TAN_MAT:INORGANIC:GOLD instead and your tanner turns into Midas. Use your imagination.

If the item you're creating should be made of the same material as the raw material you're using (e.g. if you're carving a log into a training spear), you can specify "NONE" instead of the MATERIAL_REACTION_PRODUCT code:

  [REACTION:MAKE WOODEN TRAINING SPEAR]
     [NAME:make wooden training spear]
     [BUILDING:CARPENTER:NONE]
     [REAGENT:log:1:WOOD:NONE:NONE:NONE][ANY_PLANT_MATERIAL]
     [PRODUCT:100:1:WEAPON:ITEM_WEAPON_SPEAR_TRAINING:GET_MATERIAL_FROM_REAGENT:log:NONE]
     [SKILL:CARPENTRY]

As with reaction classes, some MATERIAL_REACTION_PRODUCT identifiers have special meanings to the game itself - notably, the site finder knows that "FIRED_MAT" should be connected to the "Clay" filter, and "CHEESE_MAT" is used when making cheese from milk.

Item reaction products[edit]

Item reaction products are an even more powerful form of the above. Where material reaction products can only affect what type of stuff the predestined end product is made of, item reaction products can decide the entire end result ahead of time. Item AND material.

Let's assume for a moment that we're completely tired of leather earrings and hair crowns. We want a crafting reaction that takes cloth and only produces things that make sense.

     [REACTION:TAILOR_THE_BEST_THING]
           [NAME:weave something that makes sense]
           [BUILDING:CRAFTSMAN]
           [REAGENT:woven fabric:1:CLOTH:NONE:NONE:NONE]
              [HAS_ITEM_REACTION_PRODUCT:BEST_OPTION]
           [PRODUCT:100:1:GET_ITEM_DATA_FROM_REAGENT:woven fabric:BEST_OPTION]
           [SKILL:CLOTHIER]

Now we need to come up with the counterpart tags in the materials. Hmmm... cotton is thin and soft, so it makes pretty good undergarments. An undershirt, maybe?

        [PLANT:COTTON] Gossypium hirsutum / sp.
                 [NAME:cotton plant][NAME_PLURAL:cotton plants][ADJ:cotton plant]
                 [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
                 [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
                 [DRY][BIOME:ANY_TROPICAL]
                 [VALUE:2]
                 ...
                 [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]
                    [MATERIAL_VALUE:2]
                    [ITEM_REACTION_PRODUCT:BEST_OPTION:ARMOR:ITEM_ARMOR_TUNIC:LOCAL_PLANT_MAT:THREAD]
                 ...

Then jute fabric. Isn't that burlap? And what's about the only thing they make from burlap?

        [PLANT:JUTE] Corchorus capsularis / Corchorus olitorius
                 [NAME:jute plant][NAME_PLURAL:jute plants][ADJ:jute plant]
                 [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
                 [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
                 [DRY][BIOME:ANY_TROPICAL]
                 [VALUE:2]
                 ...
                 [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]
                    [MATERIAL_VALUE:2]
                    [ITEM_REACTION_PRODUCT:BEST_OPTION:BAG:NONE:LOCAL_PLANT_MAT:THREAD]
                 ...

Sacks, of course! Wait, how about silk?

        [CREATURE:SPIDER_CAVE]
                 [DESCRIPTION:A tiny underground bug, sought after for its thread.]
                 [NAME:cave spider:cave spiders:cave spider]
                 ...
                 [USE_MATERIAL_TEMPLATE:SILK:SILK_TEMPLATE]
                    [ITEM_REACTION_PRODUCT:BEST_OPTION:PANTS:ITEM_PANTS_THONG:LOCAL_CREATURE_MAT:SILK]
                 ...

This goes on for as long as you let it. The ITEM_REACTION_PRODUCT declares the identifier and then the item and material with subtypes, just like a normal reaction's product line would.

Do note that MATERIAL_REACTION_PRODUCT and ITEM_REACTION_PRODUCT use the same IDs, so you cannot have both a material and item reaction product of the same name. Also, though you cannot use GET_ITEM_DATA_FROM_REAGENT with a MATERIAL_REACTION_PRODUCT (there'd be no item type information), you can use GET_MATERIAL_FROM_REAGENT on an ITEM_REACTION_PRODUCT (in case you want to force your own item type).

Reactions and world generation[edit]

There are several things to keep in mind when you're adding reactions to a game that already exists.

  • Most entity changes require a regen, but adding PERMITTED_REACTION tokens for reactions that existed at the time of world generation to the entity file in the save directory do not.
  • Adding reactions to the raws in a save directory requires you to regen the world.
  • You can alter an existing reaction in any way you like without regenning the world, so long as you don't alter the reaction identifier.

Full token list[edit]

For the sake of convenience and readability, this is a complete compilation of the previously listed reaction tokens in alphabetical order:

Token Arguments Type Description
ADVENTURE_MODE_ENABLED This version of the reaction can be used by the wanderers of Adventure Mode without needing to also give the dwarves at home in a fortress access to it. When using this token, it will be allowed for adventurers of any race, without editing entity files. This token does not prevent Fortress Mode usage.
ANY_BONE_MATERIAL Reagent modifier Reagent material must have the [BONE] token.
ANY_GEM_MATERIAL Reagent modifier Reagent material must have the [IS_GEM] token.
ANY_HORN_MATERIAL Reagent modifier Reagent material must have the [HORN] token.
ANY_LEATHER_MATERIAL Reagent modifier Reagent material must have the [LEATHER] token.
ANY_PEARL_MATERIAL Reagent modifier Reagent material must have the [PEARL] token.
ANY_PLANT_MATERIAL Reagent modifier Reagent material must be subordinate to a PLANT object.
ANY_SHELL_MATERIAL Reagent modifier Reagent material must have the [SHELL] token.
ANY_SILK_MATERIAL Reagent modifier Reagent material must have the [SILK] token.
ANY_SOAP_MATERIAL Reagent modifier Reagent material must have the [SOAP] token.
ANY_STONE_MATERIAL Reagent modifier Reagent material must have the [IS_STONE] token.
ANY_STRAND_TISSUE Reagent modifier Reagent is made of a tissue having [TISSUE_SHAPE:STRANDS], intended for matching hair and wool. Must be used with [USE_BODY_COMPONENT].
ANY_TOOTH_MATERIAL Reagent modifier Reagent material must have the [TOOTH] token.
ANY_WOOD_MATERIAL Reagent modifier Reagent material must have the [WOOD] token.
ANY_YARN_MATERIAL Reagent modifier Reagent material must have the [YARN] token.
ATTRIBUTE_IP
  • Integer
Skill modifier Amount of attribute gain given per skill improvement. Default is 10.
AUTOMATIC The reaction will be queued automatically if the reaction reagents are all present.
BAG (Deprecated) Reagent modifier Reagent has to be a bag. Intended to be used with an item type of BOX, to prevent chests, coffers, and other containers from being used instead. Deprecated as of Version 0.50.01 in favor of BAG:NONE item token.
BUILDING Sets the building that the reaction will be performed in, and the button used to queue the reaction once that building's menu is accessed in-game.
BUILDMAT Reagent modifier Reagent is able to be used to build structures (Boulders, Wood, Blocks, Bars).
CAN_USE_ARTIFACT Reagent modifier Reagent can be an Artifact. Using [PRESERVE_REAGENT] with this is strongly advised.
CAN_USE_HOSPITAL_RESERVED Reagent modifier Allows the reagent to be an item that is otherwise reserved for use by a hospital.
CAN_USE_LOCATION_RESERVED Reagent modifier Allows the reagent to be an item that is otherwise reserved for use by a location.
CATEGORY
  • Category ID
Puts the reaction in a category. Categories are custom submenus for reaction menus. The category ID is a unique identifier for the category. It is only used in the raws, and will not appear in the game.

If you're defining multiple categories within the same reaction - for example, if you intend the reaction to be nested two deep, and haven't yet defined the super-category - the last CATEGORY token within the reaction definition is the one that the reaction will appear in.

CATEGORY_NAME
  • String
Category The name of the category as displayed in-game.
CATEGORY_DESCRIPTION
  • String
Category If present, when the category is highlighted in a building menu, this string will be displayed in the Helpful Hint box.
CATEGORY_PARENT
  • Category ID
Category If present, this category will be a submenu of the indicated category, rather than a submenu of the reaction's building.
CATEGORY_KEY
  • Hotkey
Category If present, this category can be selected from its parent menu (whether a building or a parent category) using the given hotkey while playing in Classic mode.
CONTAINS Reagent modifier Reagent is a container that holds the specified reagent.
CONTAINS_LYE (Deprecated) Reagent modifier If the reagent is a container, it must contain LYE. No longer used - instead, use one reagent for the LYE itself and another reagent with [CONTAINS:lye_reagent].
DESCRIPTION
  • String
A description of the reaction that appears when it is highlighted in the building UI. String can also be replaced with a reference to existing DESCRIPTION tokens in tools (using USE_TOOL:<tool_id>) or musical instruments (using USE_TOOL:<instrument_id>).
DOES_NOT_ABSORB Reagent modifier Reagent material must have [ABSORPTION:0].
DOES_NOT_DETERMINE_PRODUCT_AMOUNT Reagent modifier Performing a reaction with large stacks of inputs can allow multiple sets of outputs to be produced. Setting this flag causes the reagent to be ignored in this process - for example, with the reaction "1 plant + 1 barrel -> 5 alcohol (into barrel)", using this on the barrel allows the reaction to be performed as "5 plant + 1 barrel -> 25 alcohol" instead of "5 plant + 5 barrel -> 25 alcohol".
EMPTY Reagent modifier If the reagent is a container, it must be empty.
FIRE_BUILD_SAFE Reagent modifier Reagent must be considered fire-safe (stable temperature below 11000 °U ) - i.e. not wood, and not coal.
FORCE_EDGE Product modifier Product is given a sharp edge. Used for knapping.
FOOD_STORAGE_CONTAINER Reagent modifier Reagent must be a barrel or any non-absorbing tool with [TOOL_USE:FOOD_STORAGE].
FUEL Requires that the reaction either use up a unit of coal or charcoal or else be performed at a magma workshop.
GLASS_MATERIAL Reagent modifier Reagent material has [IS_GLASS].
HAS_EDGE Reagent modifier Reagent must be sharpened (used for carving).
HAS_ITEM_REACTION_PRODUCT
  • PRODUCT_ID (custom)
Reagent modifier Similar to HAS_MATERIAL_REACTION_PRODUCT, but requires the reagents material to have a matching ITEM_REACTION_PRODUCT entry.
HAS_MATERIAL_REACTION_PRODUCT
  • PRODUCT_ID (custom)
Reagent modifier Similar to REACTION_CLASS, but requires the reagents material to have a matching MATERIAL_REACTION_PRODUCT entry. Intended for reactions which transform one class of material into another, such as skin->leather and fat->tallow.
HAS_TOOL_USE Reagent modifier Reagent must be a tool with the specific TOOL_USE value. The reagents item type must be TOOL:NONE for this to make any sense.
HAS_WRITING_IMPROVEMENT Reagent modifier Reagent must contain writing.
IMPROVEMENT Applies an improvement to the named reagent. Only meaningful if said reagent has [PRESERVE_REAGENT]. Improvement types include BANDS, COVERED, GLAZED, PAGES, RINGS_HANGING, and SPIKES
IS_CRAFTED_ARTIFACT[Verify] Reagent modifier Reagent item must be an artifact.
IS_DIVINE_MATERIAL Reagent modifier Reagent material must have the [DIVINE] token.
MAGMA_BUILD_SAFE Reagent modifier Currently broken - Reagent must be considered magma-safe (stable temperature below 12000 °U ).
MAX_MULTIPLIER
  • Integer
Sets the maximum number of times a reaction is allowed to run when using stacked reagents. This can be used to ensure that the reaction doesn't repeat until the entire stack is depleted.
METAL_ORE
  • Inorganic material
Reagent modifier Reagent material must be an ore of the specified metal.
MIN_DIMENSION
  • Integer
Reagent modifier Requires that the reagent have a size of at least integer. Only effective with BAR, POWDER_MISC, LIQUID_MISC, DRINK, THREAD, CLOTH, and GLOB items.
NAME Defines the name used by the reaction in-game.
NO_EDGE_ALLOWED Reagent modifier Reagent must not have an edge, so must be blunt. Sharp stones (produced using knapping) and most types of weapon/ammo can not be used with this token.
NOT_ARTIFACT[Verify] Reagent modifier Reagent item must not be an artifact.
NOT_CONTAIN_BARREL_ITEM Reagent modifier If the reagent is a Barrel, it must not contain an item that has to reside in a barrel. Barrel items appear to be lye and milk. Alcohol appears to be covered as part of [EMPTY]. A reaction which places an item in a barrel should probably have both tags.
NOT_ENGRAVED Reagent modifier Reagent has not been engraved i.e. a blank memorial slab.
NOT_IMPROVED Reagent modifier Reagent has not been decorated.
NOT_PRESSED Reagent modifier Reagent must not be in the SOLID_PRESSED state.
NOT_WEB Reagent modifier Reagent must be "collected" - used with THREAD:NONE to exclude webs.
ON_GROUND Reagent modifier Reagent must be on the ground. Grabs from stockpiles. Does not grab from bins in stockpiles, nor inventories (workshops, wagon). Causes infinite collection of items if reaction is in workshop, as reagents are no longer on ground when brought to workshop. Untested in adventure mode; possibly more useful for adv. mode reactions.
POTASHABLE (Deprecated) Reagent modifier Alias for [CONTAINS_LYE].
PRESERVE_REAGENT Reagent modifier Reagent is not destroyed, which is the normal effect, at the completion of the reaction. Typically used for containers.
PRODUCT
  • Probability of success (%)
  • Quantity
  • Item token:subtype
  • Material token:subtype
Defines a thing that comes out of the reaction. GET_MATERIAL_FROM_REAGENT and GET_ITEM_DATA_FROM_REAGENT can be used to defer the choice of material and/or item to the appropriate tag in a given reagent's material - the former comes in place of the material token, the latter replaces both the item and material tokens. See above for detailed information on how the hooks work.
PRODUCT_DIMENSION
  • Size
Product modifier Specifies the amount of the product for those items that use dimension. For items of type BAR, DRINK, GLOB, LIQUID_MISC, and POWDER_MISC, one item is dimension 150; one item of CLOTH or SHEET is dimension 10000; and one item of THREAD is dimension 15000. Has no effect on any other item types. Note: this is not the actual storage volume of the product, which is hard-coded by the item token.
PRODUCT_PASTE Product modifier Product is created in the SOLID_PASTE state.
PRODUCT_PRESSED Product modifier Product is created in the SOLID_PRESSED state.
PRODUCT_TO_CONTAINER Product modifier Places the product in a container; reagent name must be the name of a reagent with the [PRESERVE_REAGENT] token and a container item type.
PRODUCT_TOKEN
  • Name
Product modifier Allows the product to be referred to by the given name, for the purpose of being passed down as argument in other tokens in the same fashion as reagent names.
REACTION
  • Identifier
Defines a new reaction.
REACTION_CLASS
  • CLASS_ID (custom)
Reagent modifier Requires the reagent's material to have a matching REACTION_CLASS entry. Intended for reactions which accept a variety of materials but where the input material does not determine the output material, such as FLUX (for making pig iron and steel) and GYPSUM (for producing plaster powder).
REAGENT Specifies a given reagent as an input for a reaction.
SKILL Skill used by the reaction.
SKILL_IP
  • Integer
Skill modifier Amount of skill given per product made. Default is 30.
SKILL_ROLL_RANGE
  • Range
  • Multiplier
Skill modifier Determines how skill level affects quality of the reaction product. The skill roll is random(range) + random((skill level * multipler)/2 + 1) + random((skill level * multipler)/2 + 1). random(x) returns a number between 0 and x-1, so range is always 1 or more. The default is 11. The default multiplier is 5. Higher skill rolls give better results.
TRANSFER_ARTIFACT_STATUS Product modifier Transfers artifact status from the reagent to the product.
UNROTTEN Reagent modifier Reagent must not be rotten, mainly for organic materials.
USE_BODY_COMPONENT Reagent modifier Reagent material must come off a creature's body.
WEB_ONLY Reagent modifier Reagent must be "undisturbed" - used with THREAD:NONE to gather webs.
WORTHLESS_STONE_ONLY Reagent modifier Reagent is not made of an economic stone.
WOVEN_ITEM Reagent modifier Reagent material must be a woven material, eg. plant cloth, silk, yarn. This excludes CLOTH or THREAD items.

Examples[edit]

Main articles: Reaction Examples