Bugfixing Scripts

fix/* scripts fix various bugs and issues, some of them obscure.

fix/blood-del

Makes it so that future caravans won’t bring barrels full of blood, ichor, or goo.

fix/build-location

Fixes construction jobs that are stuck trying to build a wall while standing on the same exact tile (Bug 5991), designates the tile restricted traffic to hopefully avoid jamming it again, and unsuspends them.

fix/corrupt-equipment

Fixes some corruption that can occur in equipment lists, as in Bug 11014.

Note that there have been several possible types of corruption identified:

  1. Items that have been deleted without being removed from the equipment lists
  2. Items of the wrong type being stored in the equipment lists
  3. Items of the wrong type being assigned to squad members

This script currently only fixes the first two, as they have been linked to the majority of crashes.

Note that in some cases, multiple issues may be present, and may only be present for a short window of time before DF crashes. To address this, running this script with repeat is recommended. For example, to run this script every 100 ticks:

repeat -name fix-corrupt-equipment -time 100 -timeUnits ticks -command [ fix/corrupt-equipment ]

To cancel it (which is likely safe if the script has not produced any output in some time, and if you have saved first):

repeat -cancel fix-corrupt-equipment

Running this script with repeat on all saves is not recommended, as it can have overhead (sometimes over 0.1 seconds on a large save). In general, running this script with repeat is recommended if:

  • You have experienced crashes likely caused by Bug 11014, and running this script a single time produces output but does not fix the crash
  • You are running large military operations, or have sent squads out on raids

fix/dead-units

Removes uninteresting dead units from the unit list. Doesn’t seem to give any noticeable performance gain, but migrants normally stop if the unit list grows to around 3000 units, and this script reduces it back.

fix/diplomats

Adds a Diplomat position to all Elven civilizations, allowing them to negotiate tree cutting quotas - and you to violate them and start wars. This was vanilla behaviour until version 0.31.12, in which the “bug” was “fixed”.

fix/drop-webs

Turns floating webs into projectiles, causing them to fall down to a valid surface. This addresses Bug 595.

Use fix/drop-webs -all to turn all webs into projectiles, causing webs to fall out of branches, etc.

Use clear-webs to remove webs entirely.

fix/dry-buckets

Removes water from all buckets in your fortress, allowing them to be used for making lye. Skips buckets in buildings (eg a well), being carried, or currently used by a job.

fix/fat-dwarves

Avoids 5-10% FPS loss due to constant recalculation of insulation for dwarves at maximum fatness, by reducing the cap from 1,000,000 to 999,999. Recalculation is triggered in steps of 250 units, and very fat dwarves constantly bounce off the maximum value while eating.

fix/feeding-timers

Reset the GiveWater and GiveFood timers of all living citizens.

fix/item-occupancy

Diagnoses and fixes issues with nonexistant ‘items occupying site’, usually caused by autodump bugs or other hacking mishaps. Checks that:

  1. Item has flags.on_ground <=> it is in the correct block item list
  2. A tile has items in block item list <=> it has occupancy.item
  3. The block item lists are sorted

fix/loyaltycascade

Aborts loyalty cascades by fixing units whose own civ is the enemy.

fix/merchants

Adds the Guild Representative position to all Human civilizations, allowing them to make trade agreements. This was the default behaviour in version 0.28.181.40d and earlier.

fix/population-cap

Run this after every migrant wave to ensure your population cap is not exceeded.

The reason for population cap problems is that the population value it is compared against comes from the last dwarven caravan that successfully left for mountainhomes. This script instantly updates it. Note that a migration wave can still overshoot the limit by 1-2 dwarves because of the last migrant bringing his family. Likewise, king arrival ignores cap.

fix/retrieve-units

This script forces some units off the map to enter the map, which can fix issues such as the following:

  • Stuck [SIEGE] tags due to invisible armies (or parts of armies)
  • Forgotten beasts that never appear
  • Packs of wildlife that are missing from the surface or caverns
  • Caravans that are partially or completely missing.

Note

For caravans that are missing entirely, this script may retrieve the merchants but not the items. Using fix/stuck-merchants followed by force to create a new caravan may work better.

fix/stable-temp

Instantly sets the temperature of all free-lying items to be in equilibrium with the environment, which stops temperature updates until something changes. To maintain this efficient state, use tweak fast-heat.

fix/stuck-merchants

Dismisses merchants that haven’t entered the map yet. This can fix Bug 9593. This script should probably not be run if any merchants are on the map, so using it with repeat is not recommended.

Run fix/stuck-merchants -n or fix/stuck-merchants --dry-run to list all merchants that would be dismissed but make no changes.

fix/stuckdoors

Fix doors that are stuck open due to incorrect map occupancy flags, eg due to incorrect use of teleport.

fix/tile-occupancy

Clears bad occupancy flags at the selected tile. Useful for getting rid of phantom “building present” messages. Currently only supports issues with building and unit occupancy. Requires that a tile is selected with the in-game cursor (k).

Can be used to fix problematic tiles caused by Issue 1047.