Hi,
I'm new. DFHack's pretty neat. Some of the documentation is bit poor though.
Also, I've noticed some... thingies. I don't have a github account, so.
embark-skills
Adjusts dwarves’ skills when embarking.
Note that already-used skill points are not taken into account or reset.
points N: Sets the skill points remaining of the selected dwarf to N.
points N all: Sets the skill points remaining of all dwarves to N.
max: Sets all skills of the selected dwarf to “Proficient”.
max all: Sets all skills of all dwarves to “Proficient”.
legendary: Sets all skills of the selected dwarf to “Legendary”.
legendary all: Sets all skills of all dwarves to “Legendary”.
Of that script, the points function doesn't seem to work. Similarly, this one doesn't work either:
points
Sets available points at the embark screen to the specified number. Eg. points 1000000 would allow you to buy everything, or points 0 would make life quite difficult.
And this one gave me some crashes:
prefchange
Sets preferences for mooding to include a weapon type, equipment type, and material. If you also wish to trigger a mood, see strangemood.
Valid options:
show: show preferences of all units
c: clear preferences of selected unit
all: clear preferences of all units
axp: likes axes, breastplates, and steel
has: likes hammers, mail shirts, and steel
swb: likes short swords, high boots, and steel
spb: likes spears, high boots, and steel
mas: likes maces, shields, and steel
xbh: likes crossbows, helms, and steel
pig: likes picks, gauntlets, and steel
log: likes long swords, gauntlets, and steel
dap: likes daggers, greaves, and steel
Feel free to adjust the values as you see fit, change the has steel to platinum, change the axp axes to great axes, whatnot.
If I used, say, the xbh option on a dwarf with too many preferences (possibly of certain type), the game would crash when viewing their thoughts and preferences ingame.
At least I managed to avoid the crashes after editing the source code a bit. I don't really understand how preferences work, but I patched up some new functions, like:
function clear_craft_preferences()
local unit = dfhack.gui.getSelectedUnit()
local prefs = unit.status.current_soul.preferences
local crafttype = 4
local count = 0
local kk,vv,unk_counter
unk_counter=31415926
for kk,vv in ipairs(prefs) do
if vv.type == crafttype then
vv.type = -1
vv.item_type = -1
vv.creature_id = -1
vv.color_id = -1
vv.shape_id = -1
vv.plant_id = -1
vv.item_subtype = -1
vv.mattype = -1
vv.matindex = -1
vv.active = false
vv.prefstring_seed = unk_counter
count = count + 1
unk_counter = unk_counter + 1
end
end
print(count.." crafting preferences cleared.")
end
function clear_material_preferences()
local unit = dfhack.gui.getSelectedUnit()
local prefs = unit.status.current_soul.preferences
local material = -1
local count = 0
local kk,vv,unk_counter
unk_counter=31415926
for kk,vv in ipairs(prefs) do
if vv.mattype == material then
vv.type = -1
vv.item_type = -1
vv.creature_id = -1
vv.color_id = -1
vv.shape_id = -1
vv.plant_id = -1
vv.item_subtype = -1
vv.mattype = -1
vv.matindex = -1
vv.active = false
vv.prefstring_seed = unk_counter
count = count + 1
unk_counter = unk_counter + 1
end
end
print(count.." material preferences cleared.")
end
So err, I had a save with a dwarf working in a strange mood, always resulting in a bone battle axe, and I wanted to see if I could change the end result to something little less stupid. Clearing all of his preferences would've felt wrong, so I wanted to clear only type == 4 preferences, as they seemed to be what mattered at that point, possibly to restore them after the artifact was finished. The latter function was useful in another case, where I guess a dwarf preferred too many materials or something.
The script seems fairly buggy overall, for example, it's possible to get the same preference twice.
There is (was) also no option to show preferences of selected unit only, and the output isn't extremely human-readable either. Is there a resource containing information of the preferences stuff? I perhaps could be bothered to edit out a script that'd check if a preference exists before setting it, allow exporting/importing a dwarf's preference "identity" and allow setting/clearing a single preference (instead of these groups of three preferences). Unless such thing exists already? At least the dfhack scripts I've seen seem to concentrate on optimizing preferences, but I personally dislike the idea of ruining the uniqueness in that.
[edit: now that I gave a closer look to the latter of those two functions... there's an equality condition where there should be inequality condition, so it clears preferences with which the material doesn't matter. Oh well.]