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.

User:Fleeting Frames/listexoticpreferences

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Save as lep.lua into /hack/scripts folder.

--prints rare weapon preferences in all units.

local units = df.global.world.units.active

for i, unit in pairs (units) do
	if unit.race == df.global.ui.race_id and unit.status.current_soul then
		for j, preference in pairs(unit.status.current_soul.preferences) do
			if preference.type == 4 and 
			preference.item_type == 24 and 
			(preference.item_subtype == 0 or preference.item_subtype == 10 or preference.item_subtype == 12 or preference.item_subtype == 13 or preference.item_subtype == 15 or preference.item_subtype == 19 ) then
				dfhack.println(dfhack.TranslateName(dfhack.units.getVisibleName(unit)) .. " has useful preference")
			end
		end
	end
end