Great stuff, view change and script usage to pinpoint dwarves for work are essential.
Hello there! I'm a noob who's never even seen magma and just finished reading this guide. Maybe I'm necroing an ancient thread, I don't know.
Anyhow, I copied and pasted the example "Available for Work" filter from the guide, hoping to avoid any kind of brain activity whatsoever in order to try and integrate the filters into my playstyle, as it's 7am and I still haven't unpaused my fortress today. Then it filtered out all my dwarves so I ended up debugging it.
I'm running df 0.43.03-r1 and therapist 37.0.0 provided by PyLNP on linux, and I have no idea about previous versions or the mod ecosystem in general,
so maybe some of the changes I needed have to do with that.
I still haven't checked out the addon repository, or know of any other place this discussion might have already taken place, so maybe I've just reinvented warm water, but here goes:
// hauling test
(d.total_assigned_labors(true) - d.total_assigned_labors(false) == 18) &&
// masonry and stone detailing test
((d.labor_enabled(13) == true && d.labor_rating(13) < 3) ||
d.labor_enabled(13) == false) &&
((d.labor_enabled(12) == true && d.labor_rating(12) < 4) ||
d.labor_enabled(12) == false) &&
// no nicknames - caution, migrants from older forts come with their old nicks
(d.nickname() == "") &&
// is in squad test
(d.squad_id() < 0) &&
// exclude key dwarves
!(d.labor_enabled(47) || d.labor_enabled(48) || d.labor_enabled(29)
|| d.labor_enabled(11) || d.labor_enabled(33) || d.labor_enabled(38)
|| d.labor_enabled(45) || d.labor_enabled(50) || d.labor_enabled(51)
|| d.labor_enabled(49) || d.labor_enabled(00) || d.labor_enabled(53)
|| d.labor_enabled(46)) &&
true // this allows the last line to end with an && for ease of moving things around.
So, to walk through it:
- Hauling + Nursing is 18 total professions in my client and not 11.
- The Masonry/Detailing statement had an OR instead of an AND, making it show Skilled Masons not skilled in Engraving and vice versa. I split it into two separate statements, connected with an AND as the rest of them. Should also allow adding more labors with a level cutoff to the script without fiddling with parentheses.
- I am not really sure what d.nice_name() is (being able to print stuff through the DT editor would be nice, names or otherwise *drum roll*), but the nicknames the next section is supposed to filter we get from d.nickname(). Also, as I warn in the comment, you can get nicknamed dwarves in migrant waves, and having this filter here makes it necessary to reset those nicks to default. Which is fine, it's what I'll do, just saiyan
- The "military duty" test I replaced with an "is in squad" test, as the former only catches actually active soldiers. Maybe I'm missing some nuance that makes this preferable but it didn't catch my militia commander who's all alone in a squad. My (admittedly limited) understanding is that soldiers' active status will be changing on its own and it's not a qualifying criterion for assigning them new labors.
- The exclude key dwarves bit seems fine to me, I just changed it to the format suggested in the paragraph right below it, so my brain doesn't hurt when I'm trying to read all the negations: NOT (this OR that) seems easier to me than (NOT this AND NOT that). Actually both this one and the Masonry one seem to me to have been written with an XOR in mind instead of the OR dt uses. The labors that are in there seem fine to me - I'll probably add a couple more, but that's beyond the scope of this comment as it's a matter of taste.
- The "useless labors" filter that's in that snippet in the manual allows dwarves who don't have the useless skill and those who have and have it enabled, but ends up hiding those with who have it leveled and disabled. I suppose that wouldn't matter if I had done all my assigning through a custom grid hiding all those labors in the first place, but in my case it ended up hiding haulers. So, I'm probably missing something, but it looks to me like plain old whitespace has all the intended functionality of the snippet without the unintended behavior, making it the bit of the script I improved the most, with a 100% reduction in bytesize.
- Finally, that "true" at the end just allows an extra && at the end of the last line, just so when debugging I can erase/reorder any of them without breaking the syntax. I'm such a poser.
That's all. The manual was a really good read and if I sounded mean at any point I was just trying to be funny, not insulting. Actually I just had my first look at the addons repo in the wiki and saw a couple of those issues addressed at a version of the snippet there, but not all. Maybe the rest of my corrections are noobish things I don't get, so feel free to set me straight.
Did I forget to say thanks for having written this thing? Thanks for having written this thing!
comment last edited by BadAlchemy on Nov 24, 2016, 01:11:29 am
I learned today that this website is configured to shoot emails to me when comments arise, which is...actually pretty smart, as I would not have gotten this otherwise.
Given that two years have passed since I published the most recent revision, and three since the initial version, I'm not surprised at all that components it describes are non-working at this point.
I no longer maintain this document, as I have not played Dwarf Fortress for several years now.
I suggest bringing this issue up on the forums instead---just copy-paste it there, where it will be seen: http://www.bay12forums.com/smf/index.php?topic=122968.2835
If you're feeling frisky and know what you're doing, you can contribute directly by issuing a pull requests against the library's docs on GitHub: https://github.com/splintermind/Dwarf-Therapist/tree/DF2016/doc
I understand. Thanks for pointing me in the right direction. It seems the snippet over in github is the same I read in the guide, so if I don't get distracted by non-gamey things and lose momentum I'll try and find someone in the thread to check my logic then I'll clone and fix it.