Implement a special command parsing mode with one verbatim argument.

Intended for script expressions, e.g. rb_eval.
develop
Alexander Gavrilov 2012-09-24 19:13:33 +04:00
parent 8e25158811
commit 627f036830
3 changed files with 277 additions and 142 deletions

@ -148,6 +148,19 @@ for context ``foo/bar/baz``, possible matches are any of ``@foo/bar/baz``, ``@fo
Commands Commands
======== ========
DFHack command syntax consists of a command name, followed by arguments separated
by whitespace. To include whitespace in an argument, quote it in double quotes.
To include a double quote character, use ``\"`` inside double quotes.
If the first non-whitespace character of a line is ``#``, the line is treated
as a comment, i.e. a silent no-op command.
If the first non-whitespace character is ``:``, the command is parsed in a special
alternative mode: first, non-whitespace characters immediately following the ``:``
are used as the command name; the remaining part of the line, starting with the first
non-whitespace character *after* the command name, is used verbatim as the first argument.
This is intended for commands like ``rb_eval`` that evaluate script language statements.
Almost all the commands support using the 'help <command-name>' built-in command Almost all the commands support using the 'help <command-name>' built-in command
to retrieve further help without having to look at this document. Alternatively, to retrieve further help without having to look at this document. Alternatively,
some accept a 'help'/'?' option on their command line. some accept a 'help'/'?' option on their command line.
@ -1636,8 +1649,8 @@ digfort
A script to designate an area for digging according to a plan in csv format. A script to designate an area for digging according to a plan in csv format.
This script, inspired from quickfort, can designate an area for digging. This script, inspired from quickfort, can designate an area for digging.
Your plan should be stored in a .csv file like this: Your plan should be stored in a .csv file like this::
::
# this is a comment # this is a comment
d;d;u;d;d;skip this tile;d d;d;u;d;d;skip this tile;d
d;d;d;i d;d;d;i
@ -1656,8 +1669,8 @@ superdwarf
========== ==========
Similar to fastdwarf, per-creature. Similar to fastdwarf, per-creature.
To make any creature superfast, target it ingame using 'v' and: To make any creature superfast, target it ingame using 'v' and::
::
superdwarf add superdwarf add
Other options available: ``del``, ``clear``, ``list``. Other options available: ``del``, ``clear``, ``list``.
@ -1748,16 +1761,6 @@ focus on the current one. Shift-Enter has an effect equivalent to pressing Enter
re-entering the mechanisms ui. re-entering the mechanisms ui.
Power Meter
===========
Front-end to the power-meter plugin implemented by the gui/power-meter script. Bind to a
key and activate after selecting Pressure Plate in the build menu.
The script follows the general look and feel of the regular pressure plate build
configuration page, but configures parameters relevant to the modded power meter building.
Rename Rename
====== ======
@ -1786,11 +1789,25 @@ The script lists other rooms owned by the same owner, or by the unit selected in
list, and allows unassigning them. list, and allows unassigning them.
=============
Behavior Mods
=============
These plugins, when activated via configuration UI or by detecting certain
structures in RAWs, modify the game engine behavior concerning the target
objects to add features not otherwise present.
Siege Engine Siege Engine
============ ============
Front-end to the siege-engine plugin implemented by the gui/siege-engine script. Bind to a The siege-engine plugin enables siege engines to be linked to stockpiles, and
key and activate after selecting a siege engine in 'q' mode. aimed at an arbitrary rectangular area across Z levels, instead of the original
four directions. Also, catapults can be ordered to load arbitrary objects, not
just stones.
The configuration front-end to the plugin is implemented by the gui/siege-engine
script. Bind it to a key and activate after selecting a siege engine in 'q' mode.
The main mode displays the current target, selected ammo item type, linked stockpiles and The main mode displays the current target, selected ammo item type, linked stockpiles and
the allowed operator skill range. The map tile color is changed to signify if it can be the allowed operator skill range. The map tile color is changed to signify if it can be
@ -1799,7 +1816,7 @@ yellow for partially blocked.
Pressing 'r' changes into the target selection mode, which works by highlighting two points Pressing 'r' changes into the target selection mode, which works by highlighting two points
with Enter like all designations. When a target area is set, the engine projectiles are with Enter like all designations. When a target area is set, the engine projectiles are
aimed at that area, or units within it, instead of the vanilla four directions. aimed at that area, or units within it.
After setting the target in this way for one engine, you can 'paste' the same area into others After setting the target in this way for one engine, you can 'paste' the same area into others
just by pressing 'p' in the main page of this script. The area to paste is kept until you quit just by pressing 'p' in the main page of this script. The area to paste is kept until you quit
@ -1813,17 +1830,23 @@ menu.
.. admonition:: DISCLAIMER .. admonition:: DISCLAIMER
Siege engines are a very interesting feature, but currently nearly useless Siege engines are a very interesting feature, but sadly almost useless in the current state
because they haven't been updated since 2D and can only aim in four directions. This is an because they haven't been updated since 2D and can only aim in four directions. This is an
attempt to bring them more up to date until Toady has time to work on it. Actual improvements, attempt to bring them more up to date until Toady has time to work on it. Actual improvements,
e.g. like making siegers bring their own, are something only Toady can do. e.g. like making siegers bring their own, are something only Toady can do.
========= Power Meter
RAW hacks ===========
=========
The power-meter plugin implements a modified pressure plate that detects power being
supplied to gear boxes built in the four adjacent N/S/W/E tiles.
The configuration front-end is implemented by the gui/power-meter script. Bind it to a
key and activate after selecting Pressure Plate in the build menu.
These plugins detect certain structures in RAWs, and enhance them in various ways. The script follows the general look and feel of the regular pressure plate build
configuration page, but configures parameters relevant to the modded power meter building.
Steam Engine Steam Engine
@ -1855,7 +1878,7 @@ The magma version also needs magma.
.. admonition:: ISSUE .. admonition:: ISSUE
Since this building is a machine, and machine collapse Since this building is a machine, and machine collapse
code cannot be modified, it would collapse over true open space. code cannot be hooked, it would collapse over true open space.
As a loophole, down stair provides support to machines, while As a loophole, down stair provides support to machines, while
being passable, so use them. being passable, so use them.
@ -1866,7 +1889,7 @@ is extracted from the workshop raws.
.. admonition:: ISSUE .. admonition:: ISSUE
Like with collapse above, part of the code involved in Like with collapse above, part of the code involved in
machine connection cannot be modified. As a result, the workshop machine connection cannot be hooked. As a result, the workshop
can only immediately connect to machine components built AFTER it. can only immediately connect to machine components built AFTER it.
This also means that engines cannot be chained without intermediate This also means that engines cannot be chained without intermediate
short axles that can be built later than both of the engines. short axles that can be built later than both of the engines.
@ -1879,8 +1902,13 @@ on repeat). A furnace operator will come, possibly bringing a bar of fuel,
and perform it. As a result, a "boiling water" item will appear and perform it. As a result, a "boiling water" item will appear
in the 't' view of the workshop. in the 't' view of the workshop.
**NOTE**: The completion of the job will actually consume one unit .. note::
of the appropriate liquids from below the workshop.
The completion of the job will actually consume one unit
of the appropriate liquids from below the workshop. This means
that you cannot just raise 7 units of magma with a piston and
have infinite power. However, liquid consumption should be slow
enough that water can be supplied by a pond zone bucket chain.
Every such item gives 100 power, up to a limit of 300 for coal, Every such item gives 100 power, up to a limit of 300 for coal,
and 500 for a magma engine. The building can host twice that and 500 for a magma engine. The building can host twice that
@ -1928,9 +1956,12 @@ Add Spatter
=========== ===========
This plugin makes reactions with names starting with ``SPATTER_ADD_`` This plugin makes reactions with names starting with ``SPATTER_ADD_``
produce contaminants on the items instead of improvements. produce contaminants on the items instead of improvements. The produced
contaminants are immune to being washed away by water or destroyed by
the ``clean items`` command.
Intended to give some use to all those poisons that can be bought from caravans. The plugin is intended to give some use to all those poisons that can
be bought from caravans. :)
To be really useful this needs patches from bug 808, ``tweak fix-dimensions`` To be really useful this needs patches from bug 808, ``tweak fix-dimensions``
and ``tweak advmode-contained``. and ``tweak advmode-contained``.

@ -432,72 +432,78 @@ access DF memory and allow for easier development of new tools.</p>
<li><a class="reference internal" href="#visualizer-and-data-export" id="id84">Visualizer and data export</a><ul> <li><a class="reference internal" href="#visualizer-and-data-export" id="id84">Visualizer and data export</a><ul>
<li><a class="reference internal" href="#ssense-stonesense" id="id85">ssense / stonesense</a></li> <li><a class="reference internal" href="#ssense-stonesense" id="id85">ssense / stonesense</a></li>
<li><a class="reference internal" href="#mapexport" id="id86">mapexport</a></li> <li><a class="reference internal" href="#mapexport" id="id86">mapexport</a></li>
<li><a class="reference internal" href="#dwarfexport" id="id87">dwarfexport</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#job-management" id="id87">Job management</a><ul> <li><a class="reference internal" href="#job-management" id="id88">Job management</a><ul>
<li><a class="reference internal" href="#job" id="id88">job</a></li> <li><a class="reference internal" href="#job" id="id89">job</a></li>
<li><a class="reference internal" href="#job-material" id="id89">job-material</a></li> <li><a class="reference internal" href="#job-material" id="id90">job-material</a></li>
<li><a class="reference internal" href="#job-duplicate" id="id90">job-duplicate</a></li> <li><a class="reference internal" href="#job-duplicate" id="id91">job-duplicate</a></li>
<li><a class="reference internal" href="#workflow" id="id91">workflow</a><ul> <li><a class="reference internal" href="#workflow" id="id92">workflow</a><ul>
<li><a class="reference internal" href="#function" id="id92">Function</a></li> <li><a class="reference internal" href="#function" id="id93">Function</a></li>
<li><a class="reference internal" href="#constraint-examples" id="id93">Constraint examples</a></li> <li><a class="reference internal" href="#constraint-examples" id="id94">Constraint examples</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#fortress-activity-management" id="id94">Fortress activity management</a><ul> <li><a class="reference internal" href="#fortress-activity-management" id="id95">Fortress activity management</a><ul>
<li><a class="reference internal" href="#seedwatch" id="id95">seedwatch</a></li> <li><a class="reference internal" href="#seedwatch" id="id96">seedwatch</a></li>
<li><a class="reference internal" href="#zone" id="id96">zone</a><ul> <li><a class="reference internal" href="#zone" id="id97">zone</a><ul>
<li><a class="reference internal" href="#usage-with-single-units" id="id97">Usage with single units</a></li> <li><a class="reference internal" href="#usage-with-single-units" id="id98">Usage with single units</a></li>
<li><a class="reference internal" href="#usage-with-filters" id="id98">Usage with filters</a></li> <li><a class="reference internal" href="#usage-with-filters" id="id99">Usage with filters</a></li>
<li><a class="reference internal" href="#mass-renaming" id="id99">Mass-renaming</a></li> <li><a class="reference internal" href="#mass-renaming" id="id100">Mass-renaming</a></li>
<li><a class="reference internal" href="#cage-zones" id="id100">Cage zones</a></li> <li><a class="reference internal" href="#cage-zones" id="id101">Cage zones</a></li>
<li><a class="reference internal" href="#examples" id="id101">Examples</a></li> <li><a class="reference internal" href="#examples" id="id102">Examples</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#autonestbox" id="id102">autonestbox</a></li> <li><a class="reference internal" href="#autonestbox" id="id103">autonestbox</a></li>
<li><a class="reference internal" href="#autobutcher" id="id103">autobutcher</a></li> <li><a class="reference internal" href="#autobutcher" id="id104">autobutcher</a></li>
<li><a class="reference internal" href="#autolabor" id="id104">autolabor</a></li> <li><a class="reference internal" href="#autolabor" id="id105">autolabor</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#other" id="id105">Other</a><ul> <li><a class="reference internal" href="#other" id="id106">Other</a><ul>
<li><a class="reference internal" href="#catsplosion" id="id106">catsplosion</a></li> <li><a class="reference internal" href="#catsplosion" id="id107">catsplosion</a></li>
<li><a class="reference internal" href="#dfusion" id="id107">dfusion</a></li> <li><a class="reference internal" href="#dfusion" id="id108">dfusion</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#scripts" id="id108">Scripts</a><ul> <li><a class="reference internal" href="#scripts" id="id109">Scripts</a><ul>
<li><a class="reference internal" href="#fix" id="id109">fix/*</a></li> <li><a class="reference internal" href="#fix" id="id110">fix/*</a></li>
<li><a class="reference internal" href="#gui" id="id110">gui/*</a></li> <li><a class="reference internal" href="#gui" id="id111">gui/*</a></li>
<li><a class="reference internal" href="#quicksave" id="id111">quicksave</a></li> <li><a class="reference internal" href="#quicksave" id="id112">quicksave</a></li>
<li><a class="reference internal" href="#setfps" id="id112">setfps</a></li> <li><a class="reference internal" href="#setfps" id="id113">setfps</a></li>
<li><a class="reference internal" href="#growcrops" id="id113">growcrops</a></li> <li><a class="reference internal" href="#siren" id="id114">siren</a></li>
<li><a class="reference internal" href="#removebadthoughts" id="id114">removebadthoughts</a></li> <li><a class="reference internal" href="#growcrops" id="id115">growcrops</a></li>
<li><a class="reference internal" href="#slayrace" id="id115">slayrace</a></li> <li><a class="reference internal" href="#removebadthoughts" id="id116">removebadthoughts</a></li>
<li><a class="reference internal" href="#magmasource" id="id116">magmasource</a></li> <li><a class="reference internal" href="#slayrace" id="id117">slayrace</a></li>
<li><a class="reference internal" href="#magmasource" id="id118">magmasource</a></li>
<li><a class="reference internal" href="#digfort" id="id119">digfort</a></li>
<li><a class="reference internal" href="#superdwarf" id="id120">superdwarf</a></li>
<li><a class="reference internal" href="#drainaquifer" id="id121">drainaquifer</a></li>
<li><a class="reference internal" href="#deathcause" id="id122">deathcause</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#in-game-interface-tools" id="id117">In-game interface tools</a><ul> <li><a class="reference internal" href="#in-game-interface-tools" id="id123">In-game interface tools</a><ul>
<li><a class="reference internal" href="#dwarf-manipulator" id="id118">Dwarf Manipulator</a></li> <li><a class="reference internal" href="#dwarf-manipulator" id="id124">Dwarf Manipulator</a></li>
<li><a class="reference internal" href="#id1" id="id119">Liquids</a></li> <li><a class="reference internal" href="#id1" id="id125">Liquids</a></li>
<li><a class="reference internal" href="#mechanisms" id="id120">Mechanisms</a></li> <li><a class="reference internal" href="#mechanisms" id="id126">Mechanisms</a></li>
<li><a class="reference internal" href="#power-meter" id="id121">Power Meter</a></li> <li><a class="reference internal" href="#id2" id="id127">Rename</a></li>
<li><a class="reference internal" href="#id2" id="id122">Rename</a></li> <li><a class="reference internal" href="#room-list" id="id128">Room List</a></li>
<li><a class="reference internal" href="#room-list" id="id123">Room List</a></li>
<li><a class="reference internal" href="#siege-engine" id="id124">Siege Engine</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#raw-hacks" id="id125">RAW hacks</a><ul> <li><a class="reference internal" href="#behavior-mods" id="id129">Behavior Mods</a><ul>
<li><a class="reference internal" href="#steam-engine" id="id126">Steam Engine</a><ul> <li><a class="reference internal" href="#siege-engine" id="id130">Siege Engine</a></li>
<li><a class="reference internal" href="#rationale" id="id127">Rationale</a></li> <li><a class="reference internal" href="#power-meter" id="id131">Power Meter</a></li>
<li><a class="reference internal" href="#construction" id="id128">Construction</a></li> <li><a class="reference internal" href="#steam-engine" id="id132">Steam Engine</a><ul>
<li><a class="reference internal" href="#operation" id="id129">Operation</a></li> <li><a class="reference internal" href="#rationale" id="id133">Rationale</a></li>
<li><a class="reference internal" href="#explosions" id="id130">Explosions</a></li> <li><a class="reference internal" href="#construction" id="id134">Construction</a></li>
<li><a class="reference internal" href="#save-files" id="id131">Save files</a></li> <li><a class="reference internal" href="#operation" id="id135">Operation</a></li>
<li><a class="reference internal" href="#explosions" id="id136">Explosions</a></li>
<li><a class="reference internal" href="#save-files" id="id137">Save files</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#add-spatter" id="id132">Add Spatter</a></li> <li><a class="reference internal" href="#add-spatter" id="id138">Add Spatter</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -627,6 +633,16 @@ for context <tt class="docutils literal">foo/bar/baz</tt>, possible matches are
</div> </div>
<div class="section" id="commands"> <div class="section" id="commands">
<h1><a class="toc-backref" href="#id11">Commands</a></h1> <h1><a class="toc-backref" href="#id11">Commands</a></h1>
<p>DFHack command syntax consists of a command name, followed by arguments separated
by whitespace. To include whitespace in an argument, quote it in double quotes.
To include a double quote character, use <tt class="docutils literal">\&quot;</tt> inside double quotes.</p>
<p>If the first non-whitespace character of a line is <tt class="docutils literal">#</tt>, the line is treated
as a comment, i.e. a silent no-op command.</p>
<p>If the first non-whitespace character is <tt class="docutils literal">:</tt>, the command is parsed in a special
alternative mode: first, non-whitespace characters immediately following the <tt class="docutils literal">:</tt>
are used as the command name; the remaining part of the line, starting with the first
non-whitespace character <em>after</em> the command name, is used verbatim as the first argument.
This is intended for commands like <tt class="docutils literal">rb_eval</tt> that evaluate script language statements.</p>
<p>Almost all the commands support using the 'help &lt;command-name&gt;' built-in command <p>Almost all the commands support using the 'help &lt;command-name&gt;' built-in command
to retrieve further help without having to look at this document. Alternatively, to retrieve further help without having to look at this document. Alternatively,
some accept a 'help'/'?' option on their command line.</p> some accept a 'help'/'?' option on their command line.</p>
@ -1782,15 +1798,16 @@ thread: <a class="reference external" href="http://www.bay12forums.com/smf/index
<h3><a class="toc-backref" href="#id86">mapexport</a></h3> <h3><a class="toc-backref" href="#id86">mapexport</a></h3>
<p>Export the current loaded map as a file. This will be eventually usable <p>Export the current loaded map as a file. This will be eventually usable
with visualizers.</p> with visualizers.</p>
<p>dwarfexport </div>
----------= <div class="section" id="dwarfexport">
Export dwarves to RuneSmith-compatible XML.</p> <h3><a class="toc-backref" href="#id87">dwarfexport</a></h3>
<p>Export dwarves to RuneSmith-compatible XML.</p>
</div> </div>
</div> </div>
<div class="section" id="job-management"> <div class="section" id="job-management">
<h2><a class="toc-backref" href="#id87">Job management</a></h2> <h2><a class="toc-backref" href="#id88">Job management</a></h2>
<div class="section" id="job"> <div class="section" id="job">
<h3><a class="toc-backref" href="#id88">job</a></h3> <h3><a class="toc-backref" href="#id89">job</a></h3>
<p>Command for general job query and manipulation.</p> <p>Command for general job query and manipulation.</p>
<dl class="docutils"> <dl class="docutils">
<dt>Options:</dt> <dt>Options:</dt>
@ -1809,7 +1826,7 @@ in a workshop, or the unit/jobs screen.</dd>
</dl> </dl>
</div> </div>
<div class="section" id="job-material"> <div class="section" id="job-material">
<h3><a class="toc-backref" href="#id89">job-material</a></h3> <h3><a class="toc-backref" href="#id90">job-material</a></h3>
<p>Alter the material of the selected job.</p> <p>Alter the material of the selected job.</p>
<p>Invoked as:</p> <p>Invoked as:</p>
<pre class="literal-block"> <pre class="literal-block">
@ -1827,7 +1844,7 @@ over the first available choice with the matching material.</li>
</blockquote> </blockquote>
</div> </div>
<div class="section" id="job-duplicate"> <div class="section" id="job-duplicate">
<h3><a class="toc-backref" href="#id90">job-duplicate</a></h3> <h3><a class="toc-backref" href="#id91">job-duplicate</a></h3>
<dl class="docutils"> <dl class="docutils">
<dt>Duplicate the selected job in a workshop:</dt> <dt>Duplicate the selected job in a workshop:</dt>
<dd><ul class="first last simple"> <dd><ul class="first last simple">
@ -1838,7 +1855,7 @@ instantly duplicates the job.</li>
</dl> </dl>
</div> </div>
<div class="section" id="workflow"> <div class="section" id="workflow">
<h3><a class="toc-backref" href="#id91">workflow</a></h3> <h3><a class="toc-backref" href="#id92">workflow</a></h3>
<p>Manage control of repeat jobs.</p> <p>Manage control of repeat jobs.</p>
<p>Usage:</p> <p>Usage:</p>
<blockquote> <blockquote>
@ -1862,7 +1879,7 @@ Otherwise, enables or disables any of the following options:</p>
</dl> </dl>
</blockquote> </blockquote>
<div class="section" id="function"> <div class="section" id="function">
<h4><a class="toc-backref" href="#id92">Function</a></h4> <h4><a class="toc-backref" href="#id93">Function</a></h4>
<p>When the plugin is enabled, it protects all repeat jobs from removal. <p>When the plugin is enabled, it protects all repeat jobs from removal.
If they do disappear due to any cause, they are immediately re-added to their If they do disappear due to any cause, they are immediately re-added to their
workshop and suspended.</p> workshop and suspended.</p>
@ -1873,7 +1890,7 @@ the amount has to drop before jobs are resumed; this is intended to reduce
the frequency of jobs being toggled.</p> the frequency of jobs being toggled.</p>
</div> </div>
<div class="section" id="constraint-examples"> <div class="section" id="constraint-examples">
<h4><a class="toc-backref" href="#id93">Constraint examples</a></h4> <h4><a class="toc-backref" href="#id94">Constraint examples</a></h4>
<p>Keep metal bolts within 900-1000, and wood/bone within 150-200.</p> <p>Keep metal bolts within 900-1000, and wood/bone within 150-200.</p>
<pre class="literal-block"> <pre class="literal-block">
workflow amount AMMO:ITEM_AMMO_BOLTS/METAL 1000 100 workflow amount AMMO:ITEM_AMMO_BOLTS/METAL 1000 100
@ -1912,15 +1929,15 @@ command.
</div> </div>
</div> </div>
<div class="section" id="fortress-activity-management"> <div class="section" id="fortress-activity-management">
<h2><a class="toc-backref" href="#id94">Fortress activity management</a></h2> <h2><a class="toc-backref" href="#id95">Fortress activity management</a></h2>
<div class="section" id="seedwatch"> <div class="section" id="seedwatch">
<h3><a class="toc-backref" href="#id95">seedwatch</a></h3> <h3><a class="toc-backref" href="#id96">seedwatch</a></h3>
<p>Tool for turning cooking of seeds and plants on/off depending on how much you <p>Tool for turning cooking of seeds and plants on/off depending on how much you
have of them.</p> have of them.</p>
<p>See 'seedwatch help' for detailed description.</p> <p>See 'seedwatch help' for detailed description.</p>
</div> </div>
<div class="section" id="zone"> <div class="section" id="zone">
<h3><a class="toc-backref" href="#id96">zone</a></h3> <h3><a class="toc-backref" href="#id97">zone</a></h3>
<p>Helps a bit with managing activity zones (pens, pastures and pits) and cages.</p> <p>Helps a bit with managing activity zones (pens, pastures and pits) and cages.</p>
<p>Options:</p> <p>Options:</p>
<blockquote> <blockquote>
@ -2019,7 +2036,7 @@ for war/hunt). Negatable.</td>
</table> </table>
</blockquote> </blockquote>
<div class="section" id="usage-with-single-units"> <div class="section" id="usage-with-single-units">
<h4><a class="toc-backref" href="#id97">Usage with single units</a></h4> <h4><a class="toc-backref" href="#id98">Usage with single units</a></h4>
<p>One convenient way to use the zone tool is to bind the command 'zone assign' to <p>One convenient way to use the zone tool is to bind the command 'zone assign' to
a hotkey, maybe also the command 'zone set'. Place the in-game cursor over a hotkey, maybe also the command 'zone set'. Place the in-game cursor over
a pen/pasture or pit, use 'zone set' to mark it. Then you can select units a pen/pasture or pit, use 'zone set' to mark it. Then you can select units
@ -2028,7 +2045,7 @@ and use 'zone assign' to assign them to their new home. Allows pitting your
own dwarves, by the way.</p> own dwarves, by the way.</p>
</div> </div>
<div class="section" id="usage-with-filters"> <div class="section" id="usage-with-filters">
<h4><a class="toc-backref" href="#id98">Usage with filters</a></h4> <h4><a class="toc-backref" href="#id99">Usage with filters</a></h4>
<p>All filters can be used together with the 'assign' command.</p> <p>All filters can be used together with the 'assign' command.</p>
<p>Restrictions: It's not possible to assign units who are inside built cages <p>Restrictions: It's not possible to assign units who are inside built cages
or chained because in most cases that won't be desirable anyways. or chained because in most cases that won't be desirable anyways.
@ -2046,14 +2063,14 @@ are not properly added to your own stocks; slaughtering them should work).</p>
<p>Most filters can be negated (e.g. 'not grazer' -&gt; race is not a grazer).</p> <p>Most filters can be negated (e.g. 'not grazer' -&gt; race is not a grazer).</p>
</div> </div>
<div class="section" id="mass-renaming"> <div class="section" id="mass-renaming">
<h4><a class="toc-backref" href="#id99">Mass-renaming</a></h4> <h4><a class="toc-backref" href="#id100">Mass-renaming</a></h4>
<p>Using the 'nick' command you can set the same nickname for multiple units. <p>Using the 'nick' command you can set the same nickname for multiple units.
If used without 'assign', 'all' or 'count' it will rename all units in the If used without 'assign', 'all' or 'count' it will rename all units in the
current default target zone. Combined with 'assign', 'all' or 'count' (and current default target zone. Combined with 'assign', 'all' or 'count' (and
further optional filters) it will rename units matching the filter conditions.</p> further optional filters) it will rename units matching the filter conditions.</p>
</div> </div>
<div class="section" id="cage-zones"> <div class="section" id="cage-zones">
<h4><a class="toc-backref" href="#id100">Cage zones</a></h4> <h4><a class="toc-backref" href="#id101">Cage zones</a></h4>
<p>Using the 'tocages' command you can assign units to a set of cages, for example <p>Using the 'tocages' command you can assign units to a set of cages, for example
a room next to your butcher shop(s). They will be spread evenly among available a room next to your butcher shop(s). They will be spread evenly among available
cages to optimize hauling to and butchering from them. For this to work you need cages to optimize hauling to and butchering from them. For this to work you need
@ -2064,7 +2081,7 @@ would make no sense, but can be used together with 'nick' or 'remnick' and all
the usual filters.</p> the usual filters.</p>
</div> </div>
<div class="section" id="examples"> <div class="section" id="examples">
<h4><a class="toc-backref" href="#id101">Examples</a></h4> <h4><a class="toc-backref" href="#id102">Examples</a></h4>
<dl class="docutils"> <dl class="docutils">
<dt><tt class="docutils literal">zone assign all own ALPACA minage 3 maxage 10</tt></dt> <dt><tt class="docutils literal">zone assign all own ALPACA minage 3 maxage 10</tt></dt>
<dd>Assign all own alpacas who are between 3 and 10 years old to the selected <dd>Assign all own alpacas who are between 3 and 10 years old to the selected
@ -2090,7 +2107,7 @@ on the current default zone.</dd>
</div> </div>
</div> </div>
<div class="section" id="autonestbox"> <div class="section" id="autonestbox">
<h3><a class="toc-backref" href="#id102">autonestbox</a></h3> <h3><a class="toc-backref" href="#id103">autonestbox</a></h3>
<p>Assigns unpastured female egg-layers to nestbox zones. Requires that you create <p>Assigns unpastured female egg-layers to nestbox zones. Requires that you create
pen/pasture zones above nestboxes. If the pen is bigger than 1x1 the nestbox pen/pasture zones above nestboxes. If the pen is bigger than 1x1 the nestbox
must be in the top left corner. Only 1 unit will be assigned per pen, regardless must be in the top left corner. Only 1 unit will be assigned per pen, regardless
@ -2119,7 +2136,7 @@ frames between runs.</td>
</blockquote> </blockquote>
</div> </div>
<div class="section" id="autobutcher"> <div class="section" id="autobutcher">
<h3><a class="toc-backref" href="#id103">autobutcher</a></h3> <h3><a class="toc-backref" href="#id104">autobutcher</a></h3>
<p>Assigns lifestock for slaughter once it reaches a specific count. Requires that <p>Assigns lifestock for slaughter once it reaches a specific count. Requires that
you add the target race(s) to a watch list. Only tame units will be processed.</p> you add the target race(s) to a watch list. Only tame units will be processed.</p>
<p>Named units will be completely ignored (to protect specific animals from <p>Named units will be completely ignored (to protect specific animals from
@ -2227,7 +2244,7 @@ autobutcher.bat
</pre> </pre>
</div> </div>
<div class="section" id="autolabor"> <div class="section" id="autolabor">
<h3><a class="toc-backref" href="#id104">autolabor</a></h3> <h3><a class="toc-backref" href="#id105">autolabor</a></h3>
<p>Automatically manage dwarf labors.</p> <p>Automatically manage dwarf labors.</p>
<p>When enabled, autolabor periodically checks your dwarves and enables or <p>When enabled, autolabor periodically checks your dwarves and enables or
disables labors. It tries to keep as many dwarves as possible busy but disables labors. It tries to keep as many dwarves as possible busy but
@ -2241,14 +2258,14 @@ while it is enabled.</p>
</div> </div>
</div> </div>
<div class="section" id="other"> <div class="section" id="other">
<h2><a class="toc-backref" href="#id105">Other</a></h2> <h2><a class="toc-backref" href="#id106">Other</a></h2>
<div class="section" id="catsplosion"> <div class="section" id="catsplosion">
<h3><a class="toc-backref" href="#id106">catsplosion</a></h3> <h3><a class="toc-backref" href="#id107">catsplosion</a></h3>
<p>Makes cats just <em>multiply</em>. It is not a good idea to run this more than once or <p>Makes cats just <em>multiply</em>. It is not a good idea to run this more than once or
twice.</p> twice.</p>
</div> </div>
<div class="section" id="dfusion"> <div class="section" id="dfusion">
<h3><a class="toc-backref" href="#id107">dfusion</a></h3> <h3><a class="toc-backref" href="#id108">dfusion</a></h3>
<p>This is the DFusion lua plugin system by warmist/darius, running as a DFHack plugin.</p> <p>This is the DFusion lua plugin system by warmist/darius, running as a DFHack plugin.</p>
<p>See the bay12 thread for details: <a class="reference external" href="http://www.bay12forums.com/smf/index.php?topic=69682.15">http://www.bay12forums.com/smf/index.php?topic=69682.15</a></p> <p>See the bay12 thread for details: <a class="reference external" href="http://www.bay12forums.com/smf/index.php?topic=69682.15">http://www.bay12forums.com/smf/index.php?topic=69682.15</a></p>
<p>Confirmed working DFusion plugins:</p> <p>Confirmed working DFusion plugins:</p>
@ -2272,7 +2289,7 @@ twice.</p>
</div> </div>
</div> </div>
<div class="section" id="scripts"> <div class="section" id="scripts">
<h1><a class="toc-backref" href="#id108">Scripts</a></h1> <h1><a class="toc-backref" href="#id109">Scripts</a></h1>
<p>Lua or ruby scripts placed in the hack/scripts/ directory are considered for <p>Lua or ruby scripts placed in the hack/scripts/ directory are considered for
execution as if they were native DFHack commands. They are listed at the end execution as if they were native DFHack commands. They are listed at the end
of the 'ls' command output.</p> of the 'ls' command output.</p>
@ -2281,7 +2298,7 @@ only be listed by ls if called as 'ls -a'. This is intended as a way to hide
scripts that are obscure, developer-oriented, or should be used as keybindings.</p> scripts that are obscure, developer-oriented, or should be used as keybindings.</p>
<p>Some notable scripts:</p> <p>Some notable scripts:</p>
<div class="section" id="fix"> <div class="section" id="fix">
<h2><a class="toc-backref" href="#id109">fix/*</a></h2> <h2><a class="toc-backref" href="#id110">fix/*</a></h2>
<p>Scripts in this subdirectory fix various bugs and issues, some of them obscure.</p> <p>Scripts in this subdirectory fix various bugs and issues, some of them obscure.</p>
<ul> <ul>
<li><p class="first">fix/dead-units</p> <li><p class="first">fix/dead-units</p>
@ -2307,22 +2324,29 @@ caused by autodump bugs or other hacking mishaps.</p>
</ul> </ul>
</div> </div>
<div class="section" id="gui"> <div class="section" id="gui">
<h2><a class="toc-backref" href="#id110">gui/*</a></h2> <h2><a class="toc-backref" href="#id111">gui/*</a></h2>
<p>Scripts that implement dialogs inserted into the main game window are put in this <p>Scripts that implement dialogs inserted into the main game window are put in this
directory.</p> directory.</p>
</div> </div>
<div class="section" id="quicksave"> <div class="section" id="quicksave">
<h2><a class="toc-backref" href="#id111">quicksave</a></h2> <h2><a class="toc-backref" href="#id112">quicksave</a></h2>
<p>If called in dwarf mode, makes DF immediately auto-save the game by setting a flag <p>If called in dwarf mode, makes DF immediately auto-save the game by setting a flag
normally used in seasonal auto-save.</p> normally used in seasonal auto-save.</p>
</div> </div>
<div class="section" id="setfps"> <div class="section" id="setfps">
<h2><a class="toc-backref" href="#id112">setfps</a></h2> <h2><a class="toc-backref" href="#id113">setfps</a></h2>
<p>Run <tt class="docutils literal">setfps &lt;number&gt;</tt> to set the FPS cap at runtime, in case you want to watch <p>Run <tt class="docutils literal">setfps &lt;number&gt;</tt> to set the FPS cap at runtime, in case you want to watch
combat in slow motion or something :)</p> combat in slow motion or something :)</p>
</div> </div>
<div class="section" id="siren">
<h2><a class="toc-backref" href="#id114">siren</a></h2>
<p>Wakes up sleeping units, cancels breaks and stops parties either everywhere,
or in the burrows given as arguments. In return, adds bad thoughts about
noise and tiredness. Also, the units with interrupted breaks will go on
break again a lot sooner.</p>
</div>
<div class="section" id="growcrops"> <div class="section" id="growcrops">
<h2><a class="toc-backref" href="#id113">growcrops</a></h2> <h2><a class="toc-backref" href="#id115">growcrops</a></h2>
<p>Instantly grow seeds inside farming plots.</p> <p>Instantly grow seeds inside farming plots.</p>
<p>With no argument, this command list the various seed types currently in <p>With no argument, this command list the various seed types currently in
use in your farming plots. use in your farming plots.
@ -2334,7 +2358,7 @@ growcrops plump 40
</pre> </pre>
</div> </div>
<div class="section" id="removebadthoughts"> <div class="section" id="removebadthoughts">
<h2><a class="toc-backref" href="#id114">removebadthoughts</a></h2> <h2><a class="toc-backref" href="#id116">removebadthoughts</a></h2>
<p>This script remove negative thoughts from your dwarves. Very useful against <p>This script remove negative thoughts from your dwarves. Very useful against
tantrum spirals.</p> tantrum spirals.</p>
<p>With a selected unit in 'v' mode, will clear this unit's mind, otherwise <p>With a selected unit in 'v' mode, will clear this unit's mind, otherwise
@ -2347,7 +2371,7 @@ you unpause.</p>
it removed.</p> it removed.</p>
</div> </div>
<div class="section" id="slayrace"> <div class="section" id="slayrace">
<h2><a class="toc-backref" href="#id115">slayrace</a></h2> <h2><a class="toc-backref" href="#id117">slayrace</a></h2>
<p>Kills any unit of a given race.</p> <p>Kills any unit of a given race.</p>
<p>With no argument, lists the available races.</p> <p>With no argument, lists the available races.</p>
<p>With the special argument 'him', targets only the selected creature.</p> <p>With the special argument 'him', targets only the selected creature.</p>
@ -2373,7 +2397,7 @@ slayrace elve magma
</pre> </pre>
</div> </div>
<div class="section" id="magmasource"> <div class="section" id="magmasource">
<h2><a class="toc-backref" href="#id116">magmasource</a></h2> <h2><a class="toc-backref" href="#id118">magmasource</a></h2>
<p>Create an infinite magma source on a tile.</p> <p>Create an infinite magma source on a tile.</p>
<p>This script registers a map tile as a magma source, and every 12 game ticks <p>This script registers a map tile as a magma source, and every 12 game ticks
that tile receives 1 new unit of flowing magma.</p> that tile receives 1 new unit of flowing magma.</p>
@ -2387,13 +2411,50 @@ magmasource here
To remove all placed sources, call <tt class="docutils literal">magmasource stop</tt>.</p> To remove all placed sources, call <tt class="docutils literal">magmasource stop</tt>.</p>
<p>With no argument, this command shows an help message and list existing sources.</p> <p>With no argument, this command shows an help message and list existing sources.</p>
</div> </div>
<div class="section" id="digfort">
<h2><a class="toc-backref" href="#id119">digfort</a></h2>
<p>A script to designate an area for digging according to a plan in csv format.</p>
<p>This script, inspired from quickfort, can designate an area for digging.
Your plan should be stored in a .csv file like this:</p>
<pre class="literal-block">
# this is a comment
d;d;u;d;d;skip this tile;d
d;d;d;i
</pre>
<p>Available tile shapes are named after the 'dig' menu shortcuts:
<tt class="docutils literal">d</tt> for dig, <tt class="docutils literal">u</tt> for upstairs, <tt class="docutils literal">d</tt> downstairs, <tt class="docutils literal">i</tt> updown,
<tt class="docutils literal">h</tt> channel, <tt class="docutils literal">r</tt> upward ramp, <tt class="docutils literal">x</tt> remove designation.
Unrecognized characters are ignored (eg the 'skip this tile' in the sample).</p>
<p>Empty lines and data after a <tt class="docutils literal">#</tt> are ignored as comments.
To skip a row in your design, use a single <tt class="docutils literal">;</tt>.</p>
<p>The script takes the plan filename, starting from the root df folder.</p>
</div>
<div class="section" id="superdwarf">
<h2><a class="toc-backref" href="#id120">superdwarf</a></h2>
<p>Similar to fastdwarf, per-creature.</p>
<p>To make any creature superfast, target it ingame using 'v' and:</p>
<pre class="literal-block">
superdwarf add
</pre>
<p>Other options available: <tt class="docutils literal">del</tt>, <tt class="docutils literal">clear</tt>, <tt class="docutils literal">list</tt>.</p>
<p>This plugin also shortens the 'sleeping' and 'on break' periods of targets.</p>
</div>
<div class="section" id="drainaquifer">
<h2><a class="toc-backref" href="#id121">drainaquifer</a></h2>
<p>Remove all 'aquifer' tag from the map blocks. Irreversible.</p>
</div>
<div class="section" id="deathcause">
<h2><a class="toc-backref" href="#id122">deathcause</a></h2>
<p>Focus a body part ingame, and this script will display the cause of death of
the creature.</p>
</div>
</div> </div>
<div class="section" id="in-game-interface-tools"> <div class="section" id="in-game-interface-tools">
<h1><a class="toc-backref" href="#id117">In-game interface tools</a></h1> <h1><a class="toc-backref" href="#id123">In-game interface tools</a></h1>
<p>These tools work by displaying dialogs or overlays in the game window, and <p>These tools work by displaying dialogs or overlays in the game window, and
are mostly implemented by lua scripts.</p> are mostly implemented by lua scripts.</p>
<div class="section" id="dwarf-manipulator"> <div class="section" id="dwarf-manipulator">
<h2><a class="toc-backref" href="#id118">Dwarf Manipulator</a></h2> <h2><a class="toc-backref" href="#id124">Dwarf Manipulator</a></h2>
<p>Implemented by the manipulator plugin. To activate, open the unit screen and <p>Implemented by the manipulator plugin. To activate, open the unit screen and
press 'l'.</p> press 'l'.</p>
<p>This tool implements a Dwarf Therapist-like interface within the game UI. The <p>This tool implements a Dwarf Therapist-like interface within the game UI. The
@ -2428,13 +2489,13 @@ cursor onto that cell instead of toggling it.</li>
directly to the main dwarf mode screen.</p> directly to the main dwarf mode screen.</p>
</div> </div>
<div class="section" id="id1"> <div class="section" id="id1">
<h2><a class="toc-backref" href="#id119">Liquids</a></h2> <h2><a class="toc-backref" href="#id125">Liquids</a></h2>
<p>Implemented by the gui/liquids script. To use, bind to a key and activate in the 'k' mode.</p> <p>Implemented by the gui/liquids script. To use, bind to a key and activate in the 'k' mode.</p>
<p>While active, use the suggested keys to switch the usual liquids parameters, and Enter <p>While active, use the suggested keys to switch the usual liquids parameters, and Enter
to select the target area and apply changes.</p> to select the target area and apply changes.</p>
</div> </div>
<div class="section" id="mechanisms"> <div class="section" id="mechanisms">
<h2><a class="toc-backref" href="#id120">Mechanisms</a></h2> <h2><a class="toc-backref" href="#id126">Mechanisms</a></h2>
<p>Implemented by the gui/mechanims script. To use, bind to a key and activate in the 'q' mode.</p> <p>Implemented by the gui/mechanims script. To use, bind to a key and activate in the 'q' mode.</p>
<p>Lists mechanisms connected to the building, and their links. Navigating the list centers <p>Lists mechanisms connected to the building, and their links. Navigating the list centers
the view on the relevant linked buildings.</p> the view on the relevant linked buildings.</p>
@ -2442,15 +2503,8 @@ the view on the relevant linked buildings.</p>
focus on the current one. Shift-Enter has an effect equivalent to pressing Enter, and then focus on the current one. Shift-Enter has an effect equivalent to pressing Enter, and then
re-entering the mechanisms ui.</p> re-entering the mechanisms ui.</p>
</div> </div>
<div class="section" id="power-meter">
<h2><a class="toc-backref" href="#id121">Power Meter</a></h2>
<p>Front-end to the power-meter plugin implemented by the gui/power-meter script. Bind to a
key and activate after selecting Pressure Plate in the build menu.</p>
<p>The script follows the general look and feel of the regular pressure plate build
configuration page, but configures parameters relevant to the modded power meter building.</p>
</div>
<div class="section" id="id2"> <div class="section" id="id2">
<h2><a class="toc-backref" href="#id122">Rename</a></h2> <h2><a class="toc-backref" href="#id127">Rename</a></h2>
<p>Backed by the rename plugin, the gui/rename script allows entering the desired name <p>Backed by the rename plugin, the gui/rename script allows entering the desired name
via a simple dialog in the game ui.</p> via a simple dialog in the game ui.</p>
<ul> <ul>
@ -2466,23 +2520,33 @@ It is also possible to rename zones from the 'i' menu.</p>
<p>The <tt class="docutils literal">building</tt> or <tt class="docutils literal">unit</tt> are automatically assumed when in relevant ui state.</p> <p>The <tt class="docutils literal">building</tt> or <tt class="docutils literal">unit</tt> are automatically assumed when in relevant ui state.</p>
</div> </div>
<div class="section" id="room-list"> <div class="section" id="room-list">
<h2><a class="toc-backref" href="#id123">Room List</a></h2> <h2><a class="toc-backref" href="#id128">Room List</a></h2>
<p>Implemented by the gui/room-list script. To use, bind to a key and activate in the 'q' mode, <p>Implemented by the gui/room-list script. To use, bind to a key and activate in the 'q' mode,
either immediately or after opening the assign owner page.</p> either immediately or after opening the assign owner page.</p>
<p>The script lists other rooms owned by the same owner, or by the unit selected in the assign <p>The script lists other rooms owned by the same owner, or by the unit selected in the assign
list, and allows unassigning them.</p> list, and allows unassigning them.</p>
</div> </div>
</div>
<div class="section" id="behavior-mods">
<h1><a class="toc-backref" href="#id129">Behavior Mods</a></h1>
<p>These plugins, when activated via configuration UI or by detecting certain
structures in RAWs, modify the game engine behavior concerning the target
objects to add features not otherwise present.</p>
<div class="section" id="siege-engine"> <div class="section" id="siege-engine">
<h2><a class="toc-backref" href="#id124">Siege Engine</a></h2> <h2><a class="toc-backref" href="#id130">Siege Engine</a></h2>
<p>Front-end to the siege-engine plugin implemented by the gui/siege-engine script. Bind to a <p>The siege-engine plugin enables siege engines to be linked to stockpiles, and
key and activate after selecting a siege engine in 'q' mode.</p> aimed at an arbitrary rectangular area across Z levels, instead of the original
four directions. Also, catapults can be ordered to load arbitrary objects, not
just stones.</p>
<p>The configuration front-end to the plugin is implemented by the gui/siege-engine
script. Bind it to a key and activate after selecting a siege engine in 'q' mode.</p>
<p>The main mode displays the current target, selected ammo item type, linked stockpiles and <p>The main mode displays the current target, selected ammo item type, linked stockpiles and
the allowed operator skill range. The map tile color is changed to signify if it can be the allowed operator skill range. The map tile color is changed to signify if it can be
hit by the selected engine: green for fully reachable, blue for out of range, red for blocked, hit by the selected engine: green for fully reachable, blue for out of range, red for blocked,
yellow for partially blocked.</p> yellow for partially blocked.</p>
<p>Pressing 'r' changes into the target selection mode, which works by highlighting two points <p>Pressing 'r' changes into the target selection mode, which works by highlighting two points
with Enter like all designations. When a target area is set, the engine projectiles are with Enter like all designations. When a target area is set, the engine projectiles are
aimed at that area, or units within it, instead of the vanilla four directions.</p> aimed at that area, or units within it.</p>
<p>After setting the target in this way for one engine, you can 'paste' the same area into others <p>After setting the target in this way for one engine, you can 'paste' the same area into others
just by pressing 'p' in the main page of this script. The area to paste is kept until you quit just by pressing 'p' in the main page of this script. The area to paste is kept until you quit
DF, or select another area manually.</p> DF, or select another area manually.</p>
@ -2492,22 +2556,27 @@ the script. Shift-ESC retains the current viewport, and also exits from the 'q'
menu.</p> menu.</p>
<div class="admonition-disclaimer admonition"> <div class="admonition-disclaimer admonition">
<p class="first admonition-title">DISCLAIMER</p> <p class="first admonition-title">DISCLAIMER</p>
<p class="last">Siege engines are a very interesting feature, but currently nearly useless <p class="last">Siege engines are a very interesting feature, but sadly almost useless in the current state
because they haven't been updated since 2D and can only aim in four directions. This is an because they haven't been updated since 2D and can only aim in four directions. This is an
attempt to bring them more up to date until Toady has time to work on it. Actual improvements, attempt to bring them more up to date until Toady has time to work on it. Actual improvements,
e.g. like making siegers bring their own, are something only Toady can do.</p> e.g. like making siegers bring their own, are something only Toady can do.</p>
</div> </div>
</div> </div>
<div class="section" id="power-meter">
<h2><a class="toc-backref" href="#id131">Power Meter</a></h2>
<p>The power-meter plugin implements a modified pressure plate that detects power being
supplied to gear boxes built in the four adjacent N/S/W/E tiles.</p>
<p>The configuration front-end is implemented by the gui/power-meter script. Bind it to a
key and activate after selecting Pressure Plate in the build menu.</p>
<p>The script follows the general look and feel of the regular pressure plate build
configuration page, but configures parameters relevant to the modded power meter building.</p>
</div> </div>
<div class="section" id="raw-hacks">
<h1><a class="toc-backref" href="#id125">RAW hacks</a></h1>
<p>These plugins detect certain structures in RAWs, and enhance them in various ways.</p>
<div class="section" id="steam-engine"> <div class="section" id="steam-engine">
<h2><a class="toc-backref" href="#id126">Steam Engine</a></h2> <h2><a class="toc-backref" href="#id132">Steam Engine</a></h2>
<p>The steam-engine plugin detects custom workshops with STEAM_ENGINE in <p>The steam-engine plugin detects custom workshops with STEAM_ENGINE in
their token, and turns them into real steam engines.</p> their token, and turns them into real steam engines.</p>
<div class="section" id="rationale"> <div class="section" id="rationale">
<h3><a class="toc-backref" href="#id127">Rationale</a></h3> <h3><a class="toc-backref" href="#id133">Rationale</a></h3>
<p>The vanilla game contains only water wheels and windmills as sources of <p>The vanilla game contains only water wheels and windmills as sources of
power, but windmills give relatively little power, and water wheels require power, but windmills give relatively little power, and water wheels require
flowing water, which must either be a real river and thus immovable and flowing water, which must either be a real river and thus immovable and
@ -2518,14 +2587,14 @@ it can be done just by combining existing features of the game engine
in a new way with some glue code and a bit of custom logic.</p> in a new way with some glue code and a bit of custom logic.</p>
</div> </div>
<div class="section" id="construction"> <div class="section" id="construction">
<h3><a class="toc-backref" href="#id128">Construction</a></h3> <h3><a class="toc-backref" href="#id134">Construction</a></h3>
<p>The workshop needs water as its input, which it takes via a <p>The workshop needs water as its input, which it takes via a
passable floor tile below it, like usual magma workshops do. passable floor tile below it, like usual magma workshops do.
The magma version also needs magma.</p> The magma version also needs magma.</p>
<div class="admonition-issue admonition"> <div class="admonition-issue admonition">
<p class="first admonition-title">ISSUE</p> <p class="first admonition-title">ISSUE</p>
<p class="last">Since this building is a machine, and machine collapse <p class="last">Since this building is a machine, and machine collapse
code cannot be modified, it would collapse over true open space. code cannot be hooked, it would collapse over true open space.
As a loophole, down stair provides support to machines, while As a loophole, down stair provides support to machines, while
being passable, so use them.</p> being passable, so use them.</p>
</div> </div>
@ -2535,20 +2604,26 @@ is extracted from the workshop raws.</p>
<div class="admonition-issue admonition"> <div class="admonition-issue admonition">
<p class="first admonition-title">ISSUE</p> <p class="first admonition-title">ISSUE</p>
<p class="last">Like with collapse above, part of the code involved in <p class="last">Like with collapse above, part of the code involved in
machine connection cannot be modified. As a result, the workshop machine connection cannot be hooked. As a result, the workshop
can only immediately connect to machine components built AFTER it. can only immediately connect to machine components built AFTER it.
This also means that engines cannot be chained without intermediate This also means that engines cannot be chained without intermediate
short axles that can be built later than both of the engines.</p> short axles that can be built later than both of the engines.</p>
</div> </div>
</div> </div>
<div class="section" id="operation"> <div class="section" id="operation">
<h3><a class="toc-backref" href="#id129">Operation</a></h3> <h3><a class="toc-backref" href="#id135">Operation</a></h3>
<p>In order to operate the engine, queue the Stoke Boiler job (optionally <p>In order to operate the engine, queue the Stoke Boiler job (optionally
on repeat). A furnace operator will come, possibly bringing a bar of fuel, on repeat). A furnace operator will come, possibly bringing a bar of fuel,
and perform it. As a result, a &quot;boiling water&quot; item will appear and perform it. As a result, a &quot;boiling water&quot; item will appear
in the 't' view of the workshop.</p> in the 't' view of the workshop.</p>
<p><strong>NOTE</strong>: The completion of the job will actually consume one unit <div class="note">
of the appropriate liquids from below the workshop.</p> <p class="first admonition-title">Note</p>
<p class="last">The completion of the job will actually consume one unit
of the appropriate liquids from below the workshop. This means
that you cannot just raise 7 units of magma with a piston and
have infinite power. However, liquid consumption should be slow
enough that water can be supplied by a pond zone bucket chain.</p>
</div>
<p>Every such item gives 100 power, up to a limit of 300 for coal, <p>Every such item gives 100 power, up to a limit of 300 for coal,
and 500 for a magma engine. The building can host twice that and 500 for a magma engine. The building can host twice that
amount of items to provide longer autonomous running. When the amount of items to provide longer autonomous running. When the
@ -2567,7 +2642,7 @@ decrease it by further 4%, and also decrease the whole steam
use rate by 10%.</p> use rate by 10%.</p>
</div> </div>
<div class="section" id="explosions"> <div class="section" id="explosions">
<h3><a class="toc-backref" href="#id130">Explosions</a></h3> <h3><a class="toc-backref" href="#id136">Explosions</a></h3>
<p>The engine must be constructed using barrel, pipe and piston <p>The engine must be constructed using barrel, pipe and piston
from fire-safe, or in the magma version magma-safe metals.</p> from fire-safe, or in the magma version magma-safe metals.</p>
<p>During operation weak parts get gradually worn out, and <p>During operation weak parts get gradually worn out, and
@ -2576,7 +2651,7 @@ toppled during operation by a building destroyer, or a
tantruming dwarf.</p> tantruming dwarf.</p>
</div> </div>
<div class="section" id="save-files"> <div class="section" id="save-files">
<h3><a class="toc-backref" href="#id131">Save files</a></h3> <h3><a class="toc-backref" href="#id137">Save files</a></h3>
<p>It should be safe to load and view engine-using fortresses <p>It should be safe to load and view engine-using fortresses
from a DF version without DFHack installed, except that in such from a DF version without DFHack installed, except that in such
case the engines won't work. However actually making modifications case the engines won't work. However actually making modifications
@ -2587,10 +2662,13 @@ being generated.</p>
</div> </div>
</div> </div>
<div class="section" id="add-spatter"> <div class="section" id="add-spatter">
<h2><a class="toc-backref" href="#id132">Add Spatter</a></h2> <h2><a class="toc-backref" href="#id138">Add Spatter</a></h2>
<p>This plugin makes reactions with names starting with <tt class="docutils literal">SPATTER_ADD_</tt> <p>This plugin makes reactions with names starting with <tt class="docutils literal">SPATTER_ADD_</tt>
produce contaminants on the items instead of improvements.</p> produce contaminants on the items instead of improvements. The produced
<p>Intended to give some use to all those poisons that can be bought from caravans.</p> contaminants are immune to being washed away by water or destroyed by
the <tt class="docutils literal">clean items</tt> command.</p>
<p>The plugin is intended to give some use to all those poisons that can
be bought from caravans. :)</p>
<p>To be really useful this needs patches from bug 808, <tt class="docutils literal">tweak <span class="pre">fix-dimensions</span></tt> <p>To be really useful this needs patches from bug 808, <tt class="docutils literal">tweak <span class="pre">fix-dimensions</span></tt>
and <tt class="docutils literal">tweak <span class="pre">advmode-contained</span></tt>.</p> and <tt class="docutils literal">tweak <span class="pre">advmode-contained</span></tt>.</p>
</div> </div>

@ -126,8 +126,34 @@ struct Core::Private
void Core::cheap_tokenise(string const& input, vector<string> &output) void Core::cheap_tokenise(string const& input, vector<string> &output)
{ {
string *cur = NULL; string *cur = NULL;
size_t i = 0;
for (size_t i = 0; i < input.size(); i++) { // Check the first non-space character
while (i < input.size() && isspace(input[i])) i++;
// Special verbatim argument mode?
if (i < input.size() && input[i] == ':')
{
// Read the command
std::string cmd;
i++;
while (i < input.size() && !isspace(input[i]))
cmd.push_back(input[i++]);
if (!cmd.empty())
output.push_back(cmd);
// Find the argument
while (i < input.size() && isspace(input[i])) i++;
if (i < input.size())
output.push_back(input.substr(i));
return;
}
// Otherwise, parse in the regular quoted mode
for (; i < input.size(); i++)
{
unsigned char c = input[i]; unsigned char c = input[i];
if (isspace(c)) { if (isspace(c)) {
cur = NULL; cur = NULL;