Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 91 92 [93] 94 95 ... 244

Author Topic: DFHack 50.14-r1.1  (Read 892998 times)

taleden

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1380 on: August 08, 2018, 10:40:07 am »

Actually, labormanager is not enabled by default, and tweak cage-butcher is.
Oh, when I wrote labormanager I guess I meant manipulator; I think I got them mixed up since the title bar of the manipulator interface says "Manage Labors", which of course is what it lets me do. :)

And you're right, cage-butcher is enabled and I somehow completely failed to notice those extra hotkeys down there. I guess I was looking for them up by the "a: Assign" and "+-: Select" labels. So that'll suffice for my needs, thanks and sorry to bother! Though I still think it'd be neat to have the extra hotkeys/indicators on the units and stocks pages too; as to whether setting the flag is sufficient to generate the job, if it works for cage-butcher, it must be doable elsewhere.

In general, there are only a few categories of tools that are enabled by default:
- things that are fairly uncontroversially improvements (tweak stable-cursor, tweak burrow-name-cancel, tweak kitchen-prefs-all, search, etc.)
- things that, when enabled, only add options in-game to start using them, but don't actually do anything until then (manipulator, autogems, autochop, automelt, autotrade, etc.)
- bugfixes
- keybindings (that don't conflict with vanilla keys and are unlikely to be triggered accidentally)
Has a case been made already for embark-assistant to be enabled by default, or at least enable-able with a red hotkey on the pre-embark screen so more people realize it exists? It seems to me that it's a straight upgrade over the vanilla site finder; it can do all the same things and more, without forcing the user to employ any of its extra filters. The main objection I could think of is maybe some folks don't want to know in advance what ores are present, but I can't imagine it would be too hard to leave that part of it off by default and give it a separate hotkey for people who want to display that information.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1381 on: August 08, 2018, 10:53:18 am »

If by enabling embark-assistant you mean running it every time the embark screen shows up, that would negatively impact user experience, for one thing, since you'd have to press "esc" twice after (seemingly) entering the embark screen to get to the options menu (i.e. you have to "exit" a screen you didn't explicitly enter). It also has some screen size requirements, and would display poorly for people with smaller screens.

Adding an option to enter it in the UI should definitely be doable, though.

For butcher/slaughter indicators, my concern about the unit list is a lack of available space, but I can look at it. What "stocks page" are you referring to? The vanilla z -> Animals screen definitely has both a slaughter and geld option, and I'm not aware of a separate one (even provided by DFHack) that lists animals.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

taleden

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1382 on: August 08, 2018, 11:21:16 am »

If by enabling embark-assistant you mean running it every time the embark screen shows up, that would negatively impact user experience, for one thing, since you'd have to press "esc" twice after (seemingly) entering the embark screen to get to the options menu (i.e. you have to "exit" a screen you didn't explicitly enter). It also has some screen size requirements, and would display poorly for people with smaller screens.
Doesn't look that way to me; when I run "embark-assistant" all that happens at first is the "f: Find Desired Location" label disappears from the bottom area (because it's replaced by new hotkeys on the right), the new i/f/c/q hotkeys appear on the right, and the layers/materials details appear below the local map. A single "esc" still goes directly to the options menu; the only previous behavior that changes is "f" opens the advanced site finder instead of the stock one, but that's exactly the point. :)

As for screen space it seems to work just fine down to 80 columns wide (which looks like the minimum supported by the embark screen as a whole), but I see your point that embark-assistant doesn't do well at 25 rows; it looks like it expects at least 33 rows for its right-hand hotkeys and probably 35-40 rows to accommodate the layer materials on the left, under the local map. So that's an issue, but probably solvable by the author by simply cutting off the materials list before it runs into the bottom text area; the right-hand hotkeys should be easy enough to fold into the bottom area if it were enabled by default, since "q" wouldn't be needed any more, "f" and "c" could be combined into the space where the original "f" hotkey was displayed (that's how the default finder works -- it's "f" until you search, then turns into "c" to clear those results), which leaves only "i" to squeeze in probably just to the right of "n: Notes".

Adding an option to enter it in the UI should definitely be doable, though.

But all that aside, yeah, even just displaying a hotkey to activate it I think would be great. Whenever anyone mentions embark-assistant in any thread I've seen, invariably a bunch of people reply "oh wow I didn't even know that existed!", so just presenting the option would probably satisfy a desire that a lot of users don't even realize they have. :)

For butcher/slaughter indicators, my concern about the unit list is a lack of available space, but I can look at it. What "stocks page" are you referring to? The vanilla z -> Animals screen definitely has both a slaughter and geld option, and I'm not aware of a separate one (even provided by DFHack) that lists animals.
I think even at 80 columns the unit list has enough space to stick a little 2 or 4 character "Sl"/"Ge" or "Sltr"/"Geld" flag over on the right side, and hotkey labels on the bottom row just to the right of the ones DFHack already adds ("l: Manage Labors (DFHack)" and "q: Search").

On the stocks page (z->Animals) yes the slaughter/geld options and flags are there, what's missing on that page is the restrained/caged/pastured status indicator, which I think there's be plenty of room for alongside the existing flags ("D" for Domesticated, "T" for train, "W" for war; just add "R" for restrained, "C" for caged, "P" for pastured?).
« Last Edit: August 08, 2018, 11:24:11 am by taleden »
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1383 on: August 08, 2018, 10:19:09 pm »

  • "Slaughter" (and possibly "Geld"?) hotkeys and corresponding flag indicators to the (u)Units:Pets/Livestock page
This would be relatively easy (haven't looked at other pages). For hotkeys, just add these into dfhack.init:
Code: [Select]
keybinding add S@unitlist/Livestock ":lua dfhack.gui.getSelectedUnit().flags2.slaughter = not dfhack.gui.getSelectedUnit().flags2.slaughter"
keybinding add X@unitlist/Livestock ":lua if(not dfhack.units.isFemale(dfhack.gui.getSelectedUnit())) then dfhack.gui.getSelectedUnit().flags3.unk29 =  not dfhack.gui.getSelectedUnit().flags3.unk29 end"
These keys are also used by native suspend job/remove worker hotkeys, but my pets don't do jobs.

Making it properly scrollable, clickable ui is bit annoying (I've done two recently for jobs and death dates, but it's a bit much when there's already dwarf therapist - kinda replicating existing stuff there), but for just hotkeys that I can give you with just two lines (well, 1 after smushing) utilizing gui/indicator_screen:
Code: [Select]
keybinding add U@dwarfmode/Default ":lua dfhack.script_environment('gui/indicator_screen').getScreen({{text =  function() if(dfhack.gui.getCurFocus():find('Livestock')) then return 's' else return '' end end, color = (8+COLOR_RED), notEndOfLine=true}, {text =  function() if(dfhack.gui.getCurFocus():find('Livestock')) then return ': slaughter  ' else return '' end end, color = function() if (#df.global.gview.view.child.child.units[df.global.gview.view.child.child.page]>0 and dfhack.gui.getSelectedUnit().flags2.slaughter) then return COLOR_YELLOW else return COLOR_WHITE end end}},{x=47, y = -3, width=14}):show()  dfhack.script_environment('gui/indicator_screen').getScreen({{text = function() if(dfhack.gui.getCurFocus():find('Livestock')) then return 'x' else return '' end end, color = COLOR_LIGHTRED, notEndOfLine=true}, {text =  function() if(dfhack.gui.getCurFocus():find('Livestock')) then return ': geld            ' else return '' end end, color = function() if (#df.global.gview.view.child.child.units[df.global.gview.view.child.child.page]<1) then return COLOR_DARKGREY else if (dfhack.gui.getSelectedUnit().flags3.unk29) then return COLOR_YELLOW elseif(dfhack.units.isFemale(dfhack.gui.getSelectedUnit()) or dfhack.units.isGelded(dfhack.gui.getSelectedUnit())) then return COLOR_DARKGREY else return COLOR_WHITE end end end}},{x=62, y = -4, width=16}):show()"
(Also into dfhack.init)
Tbh checking for units state already makes it rather longer than 1-2 lines oughta, but ah well.

  • "Slaughter" (and possibly "Geld"?) hotkeys and corresponding flag indicators to the (q)Building menu of a built cage
This one already exists as "tweak cage-slaughter". The rest would be possible, although possibly hard to fit in the UI, and I'm not sure if just setting the relevant flags is enough to trigger jobs.
Yeah, I've gelded and butchered people (pfft) just by setting the flag. (flags3.unk29, flags2.slaughter)

||
||
« Last Edit: August 08, 2018, 10:28:00 pm by Fleeting Frames »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1384 on: August 08, 2018, 11:40:04 pm »

If unk29 is the geld flag, that should be changed to a proper name (and ideally you would mention it rather than just using it in scripts). As for the long line - yeah, you're probably better off giving that as a script, because it's awfully hard to troubleshoot something like that.

Edit: ok, flag 28 is called "gelded". Is flag 29 "to be gelded" or something, or did we just get 28 wrong entirely?

Taleden, maybe I was mistaken about how to exit embark-assistant, but it does replace vanilla functionality and has an "exit" option of some kind, which would be confusing if an "enter" action wasn't taken. I put the UI option idea in the issue tracker, so hopefully I remember to get to it. Also, keybindings wouldn't be as good as UI additions because they wouldn't be visible to the user in-game at all.

I think even at 80 columns the unit list has enough space to stick a little 2 or 4 character "Sl"/"Ge" or "Sltr"/"Geld" flag over on the right side, and hotkey labels on the bottom row just to the right of the ones DFHack already adds ("l: Manage Labors (DFHack)" and "q: Search").

On the stocks page (z->Animals) yes the slaughter/geld options and flags are there, what's missing on that page is the restrained/caged/pastured status indicator, which I think there's be plenty of room for alongside the existing flags ("D" for Domesticated, "T" for train, "W" for war; just add "R" for restrained, "C" for caged, "P" for pastured?).
Drawing indicators in the middle of the unit list is a bit tricky because of highlighting (and figuring out where dwarves are displayed on the screen). Fitting in the options at the bottom shouldn't be hard, now that I'm actually looking at the screen.
For the "z" -> Animals screen, that makes a lot more sense, since gelding and butchering options and flags are already displayed. However, it does not appear be trivial to figure out where individual animals or the column with flags are displayed on-screen, let alone how many flags are displayed next to each unit. We might also need to put a legend somewhere to avoid confusion, since the displayed flags currently are only related to training status.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1385 on: August 08, 2018, 11:45:04 pm »

How hard would it be to display a warning every time an unk of anon variable is referred to via script?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1386 on: August 09, 2018, 02:57:28 am »

How hard would it be to display a warning every time an unk of anon variable is referred to via script?
Not a good idea!
I use unk variables for five reasons:
1. Because I'm trying to figure out what they do (which may eventually lead to a pull request for naming).
2. Because the pull request for the naming of the fieldI've submitted hasn't materialized in a new DFHack release yet.
3. Because I want scripts to support older version where the variable wasn't yet named (using variant pathing).
4. A pull request naming the field hinges on restructuring the mess the relevant part of the XML is, but nobody is willing to discuss it, so it will probably happen only when someone else makes the pull request to fit it into the existing mess, which can take time.
5. Because I don't understand what it does, but whoever wrote it originally seems to get it right but didn't name it (e.g. prospector's usage of an unk field for ocean biomes to determine whether they are rock or soil supporting. Prospector is a plugin, not a script, though, but my usage of the logic shows up both in scripts and in a plugin).

You're free to make a tool to scan scripts (and code) for "unk" indications, look at the results, and bug those you can find behind the scrips/code about the issue, though.
Logged

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1387 on: August 09, 2018, 03:19:35 am »

If unk29 is the geld flag, that should be changed to a proper name (and ideally you would mention it rather than just using it in scripts). As for the long line - yeah, you're probably better off giving that as a script, because it's awfully hard to troubleshoot something like that.

Edit: ok, flag 28 is called "gelded". Is flag 29 "to be gelded" or something, or did we just get 28 wrong entirely?
...
unk 29 in flags3 is set to true when gelded is toggled through the normal DF ui.

After a citizen takes a flagged unit to the farmer's workshop to be gelded, unk 29 in flags3 is set to false, appropriate changes are made in body, and gelded in flags3 is set to true. Setting gelded in flags3 to false lets you reorder gelding in the DF ui. Going by that, it looks like the variable gelded aka flag 28 is "has been gelded", and unk 29/flag 29 is "marked for gelding".

By the way, the changes in body include "23" in body.components.body_part_status[1] being set to "true".  Since there is also a gelding wound in the wounds section to the same body part(1), which I assume to be the lower torso of the dog I was testing this on, and I can't see any named variable that would correspond to a gelding injury in the body part status, I think 23 may be the body part status flag for that body part suffering a gelding blow.  In any case, it serves some sort of purpose related to gelding.
Logged
Fallout Equestria Redux - that's right, it's back

Saiko Kila

  • Bay Watcher
  • Dwarven alchemist
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1388 on: August 09, 2018, 05:21:58 am »

About the modtools/extra-gamelog.lua... I love the soundsense utility, and am relying on this script to make better use of soundsense. I commented about issues with this script some moths ago, but then modified my own version and used it since. Recently I tested the version in current release (0.44.12-r1), and noticed that it still doesn't work mostly, unfortunately.

The main issues are:
  • it tries to use a timer before it is initialises, so it doesn't run more than once and only partially (the event_loop() doesn't trigger, so log_nobles(), log_siege() and log_buildings() never run)
  • it tries to uses some variables which are out of scope (should be either global, or local in another localisation)
  • the log_buildings() function uses an impossible condition, so it could never run even if the timer was initialised

There are also some minor issues, like logging everything at once (once the other issues are resolved), which is particularly troublesome with nobles and with buildings built, and logging a specific line when besieged, regardless if this line is appropriate (undead sieges have different line).

For these reasons I suggest to change the script to something like this:
Spoiler (click to show/hide)
(The line 170 171 can be integrated into the next if statement, it's excluded here to show better.)

This causes every part to trigger when necessary, it seems, with some caveats:
  • log_siege() writes two lines if siege is present: one is for compatibility with current setup of many soundsense users, the other gives them ability to trigger separate "battle music" when the save with ongoing siege is loaded
  • log_nobles() is delayed by 5 seconds, to allow this battle music to be noticed before it's muted temporarily by logs from log_nobles(); it could be also redone in a way I redid log_buildings() (to prevent logging fake mayor election on load), but this is a bit simpler solution
  • log_buildings() doesn't log already built buildings at all on game load. Instead it silently creates a list of buildings present, and then logs only newly built buildings when needed afterwards. Also, it works now.


EDIT: replaced the script, in previous version I managed to include the older version (specifically the log_siege() was old, it wasn't working correctly with load and reload of save without exiting the game).
« Last Edit: August 09, 2018, 01:44:29 pm by Saiko Kila »
Logged

taleden

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1389 on: August 09, 2018, 11:02:31 am »

Taleden, maybe I was mistaken about how to exit embark-assistant, but it does replace vanilla functionality and has an "exit" option of some kind, which would be confusing if an "enter" action wasn't taken. I put the UI option idea in the issue tracker, so hopefully I remember to get to it. Also, keybindings wouldn't be as good as UI additions because they wouldn't be visible to the user in-game at all.

Yeah, looking more closely at the embark-assistant site finder options, it would need a few more tweaks to ensure that it is strictly an enhancement and completely replicates all vanilla functionality (i.e. right now it cannot search by elevation as such, although it can search for waterfalls or for flat embark zones). But if that were done then I think it would not need the "exit" option at all any more, since the only vanilla functionality that it masks is "f: Find Desired Location"; it might need a toggle to display the more detailed layer/ore information to satisfy folks who consider that a spoiler, but it could otherwise just stay on.

Meanwhile, when I suggested the interim hotkeys or keybinding to toggle it on, I meant to also imply the UI addition to make the user aware of the option, i.e. "a: Enable Advanced Finder"; I agree of course a hotkey with no on-screen label would be no better than the current situation, the whole idea there was to make more users aware of the existence of the tool. :)
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1390 on: August 09, 2018, 11:51:13 am »

Taleden, maybe I was mistaken about how to exit embark-assistant, but it does replace vanilla functionality and has an "exit" option of some kind, which would be confusing if an "enter" action wasn't taken. I put the UI option idea in the issue tracker, so hopefully I remember to get to it. Also, keybindings wouldn't be as good as UI additions because they wouldn't be visible to the user in-game at all.

Yeah, looking more closely at the embark-assistant site finder options, it would need a few more tweaks to ensure that it is strictly an enhancement and completely replicates all vanilla functionality (i.e. right now it cannot search by elevation as such, although it can search for waterfalls or for flat embark zones). But if that were done then I think it would not need the "exit" option at all any more, since the only vanilla functionality that it masks is "f: Find Desired Location"; it might need a toggle to display the more detailed layer/ore information to satisfy folks who consider that a spoiler, but it could otherwise just stay on.

Meanwhile, when I suggested the interim hotkeys or keybinding to toggle it on, I meant to also imply the UI addition to make the user aware of the option, i.e. "a: Enable Advanced Finder"; I agree of course a hotkey with no on-screen label would be no better than the current situation, the whole idea there was to make more users aware of the existence of the tool. :)
My "hotkey with no on-screen label" remarks were about Fleeting Frames' slaughter/geld suggestions, not related to yours at all.

I'm confused about why an "a: Advanced Finder" option isn't good enough (from your comments in the embark-assistant thread). embark-assistant isn't an always-on tool that needs to be enabled once - it's a tool that users run specifically when they want it. It's like manipulator - I have no problem whatsoever adding an option to an existing screen to use it, but replacing the units screen with manipulator would be confusing. It's possible that Patrik wasn't familiar with how to modify existing screens - not all plugin authors do it.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

taleden

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1391 on: August 09, 2018, 12:06:29 pm »

I think "a: Advanced Finder" is certainly good enough. It's the only good approach right now while embark-assistant has issues at < 35 rows and doesn't fully replicate *all* vanilla finder options, and on reflection you're probably right that an explicit toggle will always be preferable to just running it all the time, since the vanilla finder should always remain available as a fallback option in case a bug is found in embark-assistant. But even in that case I think it could use some tweaks to UI element placement (including removal of "q: Exit" since it could be replaced with "a" as a toggle), hence my comment in its thread.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1392 on: August 09, 2018, 03:25:27 pm »

As indicated, I don't know how to modify existing screens, just how to overlay things on top of it. I was aware that it was possible, but haven't looked into how it's done, partially because I thought it safer to use an active opt-in before having any idea if the tool would be well received or not. An integrated toggle sounds like a good idea, though.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1393 on: August 09, 2018, 04:54:28 pm »

@lethosor: Once it becomes a script (or needs troubleshooting), there's less justification to make it a proper handling UI :P

I've never seen the location of dwarves/animals/etc. in unit list change, though. It's always been scrollable list, maximum length of df height - 9, sorted into pages (for scrolling, I've used both changing text on scrolling and adjusting its y1 position with currentpage*pagelength). Are there exceptions I'm not aware of?

hotkeys with no on-screen label...It works fine for me for some things like toggle water level or set job material, but I've forgotten about sort-units so thoroughly I noticed I didn't account for it in relations-indicator when sorting units by death date and displaying these dates (oops *tosses to the growing TODO pile*).


@known unk#s

Not aware of what I suggested though. Submitting a pull request with naming unk29?

I've known about unk29 since months before releasing relations-indicator (had to have some way to test for sterility), but I cba to log into github for something so minor. The script would still have to use the flag for reasons PatrikLundell said.

On a whim, I might mention that other known unit unk#s might be, by any chance, found in Gorlak dancer, please join us.

While oldmansutton supposedly posted a year ago, gui/gm-editoring a visitor in 44.10 I still notice obvious flags like flags3.unk31.
« Last Edit: August 09, 2018, 04:56:06 pm by Fleeting Frames »
Logged

bwbill

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1394 on: August 10, 2018, 08:57:33 am »

I think "a: Advanced Finder" is certainly good enough.

Just about anything but "a", please! I already hit that key accidentally on occasion in worldgen, and don't want to train my fingers to seek it any more than they already do. I'd suggest shift-f instead.
Logged
Pages: 1 ... 91 92 [93] 94 95 ... 244