Skip to content

Instantly share code, notes, and snippets.

@Ramblurr
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ramblurr/477187fe5630bffd9420 to your computer and use it in GitHub Desktop.
Save Ramblurr/477187fe5630bffd9420 to your computer and use it in GitHub Desktop.
Stockpile Settings Plugin Documentation

Stockpiles Settings

a dfhack plugin by rmblr

For importing and exporting stockpile settings between saves

  • Version: 0.1, for DF v0.34.11, 0.40.16, and 0.40.19
  • Updated: 6 Dec, 2014
  • Author: rmblr
  • OS: Windows, Linux, OS X
  • DOWNLOAD IT
  • DOWNLOAD PRESETS

(read this documentation online)

This is a massive enhancement to the 'copystock' plugin. Now, in addition to copying settings between stockpiles in game, it can export the settings to a file in your DF folder and import them in again. This works even across worlds, saves, and operating systems.

Using this plugin you’ll save time creating your elaborate stockpile logistics flows and you can even share your masterfully crafted stockpile settings with other players.

Why?

Stockpiling behavior by players has been getting more and more complicated as the years go by. Persisting stockpile settings that are tedious to setup will make it easier for players to adopt more efficient, but complicated, stockpiling practices.

Moreover, this is an incredible improvement over macros. Macros are not only tedious but error prone and impossible to edit after the fat. Not to mention sharing them is cumbersome and fraught with other problems.

Changelog

  • v0.1 (6 Dec 2014)

  • v0.1 beta2 (4 Dec 2014)

    • Fix a few crashes
    • Show user friendly error messages
  • v0.1 beta (3 Dec 2014)

    • Initial release

How to install it

If this plugin came with your DFHack installation, you don't need to do anything. This only applies to DFHack version 40.19 or later.

Install the plugin to your existing DFHack folder:

  1. Download the plugin (see below)

  2. Which version of DF/DFHack are you using? Enter that subfolder.

  3. Which OS are you using? Enter that subfolder.

  4. Windows: copy and paste the hack\ folder to ...\DF\hack\ (where DF is your DF folder), merge and replace all files.

    Linux/OS X: copy hack/* to df_linux/hack/* (where DF is your DF folder), merge and replace all files.

     cd linux/YOUR_VERSION
     /bin/cp -fr hack/* ~/PATH/TO/YOUR/df_linux/hack/
    

How to use it

With a GUI

First, create a folder in your DF directory called stocksettings. This is where the stockpile settings will be stored.

creating a new folder

Then download the presets and place them in this folder!

Second, setup your dfhack.init. If you are using a DFHack that is distributed with this plugin (v40.19 and later), then these settings should already exist in dfhack.init-example.

# enable the stockpiles gui plugin
enable stockpiles

# q->stockpile - copy & paste stockpiles
keybinding add Alt-P copystock

# q->stockpile - load and save stockpile settings out of game
keybinding add Alt-L@dwarfmode/QueryBuilding/Some/Stockpile "gui/stockpiles -load"
keybinding add Alt-S@dwarfmode/QueryBuilding/Some/Stockpile "gui/stockpiles -save"

With the plugin installed you will see a new hotkey when in the q menu and a stockpile is selected.

the new load/save menu

When you press the l (as in load) key, it will prompt you to save or load the settings of the currently selected stockpile.

load or save, the choice is yours

Saving

When you choose to save settings, it will ask you to type the name of the settings so you can reference it later. Access directly with Alt-S

saving settings

Loading

When you choose to load settings, it will display a list of all your saved stockpile settings (in the stocksettings) folder. Access directly with Alt-L

loading settings

Custom Hotkeys

dfhack.init-example has some default hotkeys I recommend to speed up the process.

  • Alt-P - copystock - copy and paste stockpiles
  • Alt-L - load stockpile settings (like pressing l -> Load)
  • Alt-S - save stockpile settings (like pressing l -> Save)

These all require you to have a stockpile selected in the q menu.

Command Line (advanced)

The plugin is also accessible directly from the DFHack command line. It adds two new commands: savestock and loadstock

Use the q key in DF to highlight a stockpile. Then run savestock name_of_file giving it a descriptive filename. This will create a file called name_of_file in your DF folder that contains the settings for that stockpile.

Then, in a different (or same!) game save, you can highlight any stockpile with q then run the loadstock command passing it the name of that file. The settings will be applied to that stockpile. Example: loadstock name_of_file

Notes & Limitations

Notes: It saves and loads files relative to the DF folder, so put your files there or in a subfolder for easy access. Filenames should not have spaces. Make sure you create the stocksettings folder if you use the GUI feature.

Limitations: Generated materials, divine metals, etc are not saved as they are different in every world.

Request for testing

Before this is released with the next version of DFHack, I would appreciate some testing, especially on Windows and OS X.

If you’re on OS X, and can build dfhack from source, I could use your help building an OS X version of this plugin. Shoot me a message!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment