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 "User:Quietust"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(document all of the DFRawFunctions parser functions)
Line 1: Line 1:
 
==About==
 
==About==
 
He's just this guy, you know?
 
He's just this guy, you know?
 +
 +
==DFRawFunctions==
 +
'''DFRawFunctions''' is a MediaWiki extension designed for parsing Dwarf Fortress raws. The following parser functions are defined:
 +
* <nowiki>{{#df_raw:data|object|id|notfound}}</nowiki> - Searches through a raw file and returns raws for a specific object
 +
**data - Usually the entire contents of a Dwarf Fortress raw.txt file
 +
**object - The object type to search for.
 +
**id - The ID of the object you are searching for. Objects begin with "[object:id]" (e.g. [INORGANIC:SANDSTONE] or [CREATURE:DWARF])
 +
**notfound - The string to be returned if the specified entity could not be located.
 +
* <nowiki>{{#df_tag:data|type|offset|entry}}</nowiki> - Checks if a particular tag exists, optionally with a specific token at a specific offset. Returns 1 if found, otherwise returns nothing.
 +
**data - The raws for a single object.
 +
**type - The tag type you are searching for.
 +
**offset - Optional, specifies an offset to check for a specific value.
 +
**entry - Optional, specifies the actual value to look for at the above offset.
 +
* <nowiki>{{#df_tagentry:data|type|offset|notfound|matches...}}</nowiki> - Finds the first tag of the specified type, with any number of specific tokens at specific offsets, and returns the token at the specified offset.
 +
**data - The raws for a single object.
 +
**type - The tag type you are searching for.
 +
**offset - The offset of the token to be returned. Specify a pair of numbers, separated by colons, to return multiple tokens, also separated by colons.
 +
**notfound - The string to be returned if the specified entity could not be located.
 +
**matches - Zero or more match conditions. Match conditions are of the format "offset:value". Only the first tag which satisfies all match conditions will be returned.
 +
* <nowiki>{{#df_tagvalue:data|type|notfound}}</nowiki> - Finds the first tag of the specified type and returns all of its values, separated by colons.
 +
**data - The raws for a single object.
 +
**type - The tag type you are searching for.
 +
**notfound - The string to be returned if the specified entity could not be located.
 +
* <nowiki>{{#df_foreachtag:data|type|string}}</nowiki> - Iterates across all tags of the specified type and outputs a string for each one
 +
**data - The raws for a single object.
 +
**type - The tag type you are searching for.
 +
**string - A format string into which token values can be substituted using \1, \2, ..., \9. The first parameter is the tag name itself.
 +
* <nowiki>{{#df_foreachtoken:data|offset|group|string}}</nowiki> - Iterates across a set of tokens in specific groups and outputs a string for each one
 +
**data - A colon-separated list of values, usually the output from <nowiki>{{#df_tagvalue:...}}</nowiki>
 +
**offset - How many tokens to ignore from the beginning of the list.
 +
**group - How many tokens should be parsed at once.
 +
**string - A format string into which token values can be substituted using \1, \2, ..., \9.
 +
* <nowiki>{{#df_makelist:data|object|string|extracts...}}</nowiki> - Iterates across all objects in a single raw file and outputs a string for each one
 +
**data - Usually the entire contents of a Dwarf Fortress raw.txt file
 +
**object - The object type to iterate across.
 +
**string - A format string into which values can be substituted using \1, \2, ..., \9.
 +
**extracts - Zero or more token extraction parameters. Extraction parameters are of the format "type:offset:checkoffset:checkvalue", where the first matching tag of "type" will return the token at "offset" if the token at "checkoffset" has the value "checkvalue". If "checkoffset" is set to -1, the checkvalue is ignored.
 +
***For material definitions, the format "STATE:type:state" can also be used, where "type" and "state" are fed into <nowiki>{{#df_statedesc:...}}</nowiki> below.
 +
***The order in which the extraction parameters are defined will determine the substitution values used - the first will use \1, the second will use \2, etc.
 +
* <nowiki>{{#df_statedesc:data|type|state}}</nowiki> - Parses a material definition and returns the name for a particular state.
 +
**data - The raws for a single material.
 +
**type - Either NAME or ADJ, to specify whether the noun or adjective form should be returned
 +
**state - The state type whose name should be returned. Valid values are SOLID, POWDER, PASTE, PRESSED, LIQUID, and GAS.
 +
* <nowiki>{{#mreplace:data|from|to|from|to|...}}</nowiki> - Performs multiple simple string replacements on the data specified.
 +
* <nowiki>{{#delay:data}}</nowiki> - Returns "<nowiki>{{data}}</nowiki>", intended for delayed evaluation of templates and parser functions when used with <nowiki>{{#df_foreachtag}}</nowiki>, <nowiki>{{#df_foreachtoken}}</nowiki>, and <nowiki>{{#df_makelist}}</nowiki>.
 +
* <nowiki>{{#eval:data}}</nowiki> - Evaluates all parser functions and template calls in the specified data. Intended for usage with <nowiki>{{#df_foreachtag}}</nowiki>, <nowiki>{{#df_foreachtoken}}</nowiki>, and <nowiki>{{#df_makelist}}</nowiki>.
  
 
==Fortresses==
 
==Fortresses==

Revision as of 15:30, 1 April 2011

About

He's just this guy, you know?

DFRawFunctions

DFRawFunctions is a MediaWiki extension designed for parsing Dwarf Fortress raws. The following parser functions are defined:

  • {{#df_raw:data|object|id|notfound}} - Searches through a raw file and returns raws for a specific object
    • data - Usually the entire contents of a Dwarf Fortress raw.txt file
    • object - The object type to search for.
    • id - The ID of the object you are searching for. Objects begin with "[object:id]" (e.g. [INORGANIC:SANDSTONE] or [CREATURE:DWARF])
    • notfound - The string to be returned if the specified entity could not be located.
  • {{#df_tag:data|type|offset|entry}} - Checks if a particular tag exists, optionally with a specific token at a specific offset. Returns 1 if found, otherwise returns nothing.
    • data - The raws for a single object.
    • type - The tag type you are searching for.
    • offset - Optional, specifies an offset to check for a specific value.
    • entry - Optional, specifies the actual value to look for at the above offset.
  • {{#df_tagentry:data|type|offset|notfound|matches...}} - Finds the first tag of the specified type, with any number of specific tokens at specific offsets, and returns the token at the specified offset.
    • data - The raws for a single object.
    • type - The tag type you are searching for.
    • offset - The offset of the token to be returned. Specify a pair of numbers, separated by colons, to return multiple tokens, also separated by colons.
    • notfound - The string to be returned if the specified entity could not be located.
    • matches - Zero or more match conditions. Match conditions are of the format "offset:value". Only the first tag which satisfies all match conditions will be returned.
  • {{#df_tagvalue:data|type|notfound}} - Finds the first tag of the specified type and returns all of its values, separated by colons.
    • data - The raws for a single object.
    • type - The tag type you are searching for.
    • notfound - The string to be returned if the specified entity could not be located.
  • {{#df_foreachtag:data|type|string}} - Iterates across all tags of the specified type and outputs a string for each one
    • data - The raws for a single object.
    • type - The tag type you are searching for.
    • string - A format string into which token values can be substituted using \1, \2, ..., \9. The first parameter is the tag name itself.
  • {{#df_foreachtoken:data|offset|group|string}} - Iterates across a set of tokens in specific groups and outputs a string for each one
    • data - A colon-separated list of values, usually the output from {{#df_tagvalue:...}}
    • offset - How many tokens to ignore from the beginning of the list.
    • group - How many tokens should be parsed at once.
    • string - A format string into which token values can be substituted using \1, \2, ..., \9.
  • {{#df_makelist:data|object|string|extracts...}} - Iterates across all objects in a single raw file and outputs a string for each one
    • data - Usually the entire contents of a Dwarf Fortress raw.txt file
    • object - The object type to iterate across.
    • string - A format string into which values can be substituted using \1, \2, ..., \9.
    • extracts - Zero or more token extraction parameters. Extraction parameters are of the format "type:offset:checkoffset:checkvalue", where the first matching tag of "type" will return the token at "offset" if the token at "checkoffset" has the value "checkvalue". If "checkoffset" is set to -1, the checkvalue is ignored.
      • For material definitions, the format "STATE:type:state" can also be used, where "type" and "state" are fed into {{#df_statedesc:...}} below.
      • The order in which the extraction parameters are defined will determine the substitution values used - the first will use \1, the second will use \2, etc.
  • {{#df_statedesc:data|type|state}} - Parses a material definition and returns the name for a particular state.
    • data - The raws for a single material.
    • type - Either NAME or ADJ, to specify whether the noun or adjective form should be returned
    • state - The state type whose name should be returned. Valid values are SOLID, POWDER, PASTE, PRESSED, LIQUID, and GAS.
  • {{#mreplace:data|from|to|from|to|...}} - Performs multiple simple string replacements on the data specified.
  • {{#delay:data}} - Returns "{{data}}", intended for delayed evaluation of templates and parser functions when used with {{#df_foreachtag}}, {{#df_foreachtoken}}, and {{#df_makelist}}.
  • {{#eval:data}} - Evaluates all parser functions and template calls in the specified data. Intended for usage with {{#df_foreachtag}}, {{#df_foreachtoken}}, and {{#df_makelist}}.

Fortresses

v0.28.181.40d

  • Urdimzatam, Towerclouted - First successful fortress; no real megaprojects to speak of.
  • Tathtakunib, Wasprag - First megaproject as monument (23 Z-level clear glass pyramid filled with magma), tower-cap farm, giant cave spider silk farm, automatic obsidian factory implementation (see below).
  • Naniratîs, Rhymestakes - First megaproject as actual fortress (47x47x16 cast obsidian tower), complete with self-destruct button.

v0.31

  • Ashmônèrith, Shadelabors - First fortress in version 0.31.
  • Sobìrilral, Releasetreaty - Second fortress in version 0.31. Used a spiral ramp for access until it turned out to be significantly slower than just using stairs.

Wiki

  • Mostly casual editor, updating article content as well as fixing formatting
  • Owner of the bot QuietBot - if you need to run a series of repetitive but predictable tasks, post a message here.

Projects

Dwarf Manipulator

Just like Dwarf Therapist, but using a text-based interface (based on Valdemar's prototype), and it's for Dwarf Fortress v0.23.130.23a. The only other tool available, Dwarf Foreman, was incapable of assigning labors for individual dwarves unless you gave each dwarf its own custom profession. Download here.

2D Forbidder

A tool for Dwarf Fortress v0.23.130.23a which allows manually forbidding/reclaiming, chasming, or melting the currently viewed item, almost just like in the 3D version. Download here.

2D Autoforbid

A tool for Dwarf Fortress v0.23.130.23a which automatically forbids items carried in the inventories of foreign units. Download here.

Forgotten Beast Extractor

Run this PHP script and specify your save directory as a parameter (or omit it to use the current working directory) and all generated beast raws (titans, forgotten beasts, demons, and night creatures) will be written to files in the current directory, named by the creature's ID. Works with both compressed and uncompressed worlds, with or without active saves.

Automatic Obsidian Factory Plans

See here for more information.