Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - xzaxza

Pages: [1] 2 3
1
Utilities and 3rd Party Applications / Re: DFHack 50.08-r2
« on: June 08, 2023, 07:28:18 am »
In short, emigration.lua worked in past, but no longer works. I fixed it. Do you want it?

Please! Could you open a PR against the scripts repo? https://github.com/DFHack/scripts/pulls
We can discuss it over the code review.

Took a while, but I got around to do it. https://github.com/DFHack/scripts/pull/735 for 0.47.05 branch, https://github.com/DFHack/scripts/pull/736 for current version. The latter will require some changes, dunno about the former.

2
Utilities and 3rd Party Applications / Re: DFHack 50.08-r2
« on: June 05, 2023, 12:35:22 pm »
So, a while back I posted in this issue: https://github.com/DFHack/dfhack/issues/1784

In short, emigration.lua worked in past, but no longer works. I fixed it. Do you want it?

In the issue people didn't seem to believe that it's broken, but I also made a test script that can be used with a more debug-friendly version.

I found that my solution works with merchants and without merchants, but leaving with diplomats didn't seem to work work + there was an announcement about a diplomat leaving unhappy, so I commented that part out. Another pitfall is that it's tested only on 0.47.05, so dunno if stuff's changed since. My solution also attempts to find a new group for the emigrants to join, and a new site, and it has your own civilization as fallback. I only tried it with merchants from own civ, though. I also am not exactly sure if the units travel to their new homes after they leave the embark, or what happens to them.

The script could also use some optimizing, but I didn't do a complete rewrite. Also, I don't know if the algorithm could use some tuning. I mean, 250k stress is when there's 50% chance for a dwarf to join merchants of your own civilization, and at that point they're already going insane. Maybe the chance should rise faster, since it runs only once per month. At 50k stress it's still at about 90% chance to stay, despite it causing mental breakdowns. But maybe the fact that it runs monthly compensates for the percentages. Sometimes even a slightly stressed dwarf leaves if the roll is a 100.

I also implemented the solution in a script that allows choosing a dwarf for emigration, because I wanted a world where my dwarves make a gazillion babies and then send them to the world at adulthood.

3
Utilities and 3rd Party Applications / Re: DFHack 50.08-r1
« on: May 29, 2023, 07:02:22 am »
I though garbage dumps and stockpiles were two separate things, and dumping (including autodumping) moved things to the closest garbage dump regardless of where those items were.  Isn’t this just regular behavior?
Yeah, they're two separate thinks, but I have a following setup:

Code: [Select]
F F F
F Q F
F F F
Where the F's are a stone stockpile, in this case set to receive only one of the main layer stones on the map, and Q is a 1x1 stockpile and also a dump zone. So, the process is essentially this:

1. dwarves haul stones to the feeder stockpile (F)
2. the stones in F are marked for dumping
3. lots of forbidden stones in Q

The end goal is that eventually, there are no cluttered stones all over fortress. There is the additional plus that if you reclaim the stones in Q and build a mason/stonecrafter next to it, then you have easy access to just one type of stone, which can be neat and handy.

4
Utilities and 3rd Party Applications / Re: DFHack 50.08-r1
« on: May 29, 2023, 06:55:37 am »
@xzaxza, so to clarify, you're saying that the stockpile autodump feature (presumably in 0.47.05 since that feature is still in an open PR for v50) is sometimes marking wheelbarrows that are ostensibly owned by the stockpile? Yeah, I'm not sure what's going on there. A github issue would be appreciated so I can remember to look into it when I finish https://github.com/DFHack/dfhack/pull/3285
Yes, I'm talking about the stockpile integration functionality of autodump, not the magical item mover/destroyer part. I made one: https://github.com/DFHack/dfhack/issues/3430

Uh, I recently started using autodump for a bunch of feeder stockpiles surrounding a quantum stockpile... and the problem I have is that occasionally the wheelbarrow assigned to the stockpile gets dumped. Dunno why, but I guess it could be because a hauling job involving the wheelbarrow was interrupted and the wheelbarrow had to be hauled back.

I don't think that autodump is responsible here.  At least this happens in the base game without autodump (or even dfhack).  All evidence I've seen points to job interruption causing the behaviour, as you suspect.  Unfortunately once it starts the wheelbarrow often gets stuck in a cycle of being dumped into the quantum stockpile and then returned to the feeder stockpile endlessly.  (The way to break the cycle is to temporarily forbid the wheelbarrow so that it's stockpile assignement gets reset.) 

Although I guess it's possible that autodump could be triggering whatever in the base game causes the problem?
Hmm, I didn't notice it before I enabled autodump. I'm 27 years and 6000+ stones in, and all that time before enabling autodump I dumped all the stones manually, and I didn't really see wheelbarrows marked for dumping and/or them ending up forbidden in quantum stockpiles. Of course it's always possible the root cause is something else, but it looks like autodump to me.

5
Utilities and 3rd Party Applications / Re: DFHack 50.08-r1
« on: May 28, 2023, 10:26:49 pm »
It's actually the stockpile functionality that is in question. But yeah, ok.

6
Utilities and 3rd Party Applications / Re: DFHack 50.08-r1
« on: May 28, 2023, 01:35:12 am »
Uh, I recently started using autodump for a bunch of feeder stockpiles surrounding a quantum stockpile... and the problem I have is that occasionally the wheelbarrow assigned to the stockpile gets dumped. Dunno why, but I guess it could be because a hauling job involving the wheelbarrow was interrupted and the wheelbarrow had to be hauled back.

Perhaps there should be a check if the item is assigned to the stockpile. I see the stockpile interface section is commented out in the repository currently, so maybe the stockpiles plugin will handle it, or maybe it does already, dunno.

7
Can masterwork beds be encrusted?
yes, ofc

8
DF Dwarf Mode Discussion / Re: Good setup for encrusting furniture?
« on: May 23, 2023, 01:28:17 pm »
It's not THAT much of a hassle actually, I managed to get all the beds encrusted.
tbh it sounds like a ridiculous amount of hassle

9
DF Dwarf Mode Discussion / Re: Good setup for encrusting furniture?
« on: May 22, 2023, 09:06:45 am »
you could cut the gems in the same jeweller's where you encrust them.

or, you could remove the stockpile links altogether if you aren't picky. or, if you are, you can do job manipulation with dfhack. that's what I do personally.

like this, when I want to encrust only rutile coffers:
Code: [Select]
job item-type 2 BOX
job item-material 2 RUTILE

so `job list` shows as such:
Code: [Select]
Job 821907: EncrustWithGems (repeat working quality=4)
    material: tsavorite
    item: none (furniture)
    figure: 0
  Input Item 1: cut gem
    material: tsavorite
  Input Item 2: box/bag
    material: rutile
    flags1: improvable furniture not_bin
    flags3: unimproved

10
DF Suggestions / crafts production quality vs. quantity
« on: May 22, 2023, 06:13:12 am »
Long I've been annoyed by the spam of masterworks by my legendary dwarves - imo they're far too common, so much that they become unremarkable. Dunno if anything has been done about that (I still play 0.47.05), but last night I had an epiphany. What if there was an option in each job to focus on quantity over quality, or vice versa? Focusing on quantity would reduce job timer but produce basic quality items, while the other option would go slower (perhaps even way slower?) and produce higher quality stuff. Lore-wise, if I just want to mass-produce something, it kinda makes no sense that dwarves spend so much time and effort on those items.

Also, is it something that personality/values affect? Does a dwarf who "views craftsdwarfship with disgust and would desecrate a so-called masterwork or two if they could get away with it" create a masterwork?

11
This is probably the umpteenth question regarding Linux and MacOS, but I've got to ask. So, I tried running Legends Viewer in wine, but many parts of the program end up broken that way (showing blank tabs and not letting me see some statistics, etc.). I was thinking - I know coding, so why not try to make a Legends Viewer clone or port?

However, I imagine that a project like this is relatively big. I don't know quite where to start. Is there any documentation on how the legends xml files work and do you have any tips on where to start?
I'm not the dev, but you know the source is out there on Github: https://github.com/Kromtec/LegendsViewer

Also, since it's apparently C#, it might be easy-ish to rewrite it to use Mono, which should provide compatibility.

However, there's also LegendsBrowser 2, which is already cross-platform: http://www.bay12forums.com/smf/index.php?topic=179848.0

12
Utilities and 3rd Party Applications / Re: DFHack 50.07-r1
« on: April 24, 2023, 12:43:44 am »
Are you essentially trying to get gui/workorder-details working for the Steam version? Or is this still for 0.47.05 and the existing gui/workorder-details meets your needs?
Nah, I'm in no hurry to try 0.50. I didn't get workorder-details to work with 0.47.05-r5, but it appears to work, and function as needed with r8. So, the problem I had with my Dwarf Fortress experience has been resolved (thanks!), it was more about me trying to learn why the approach I took with DFHack didn't work, and lethosor cleared that up. Thanks!

13
Utilities and 3rd Party Applications / Re: DFHack 50.07-r1
« on: April 23, 2023, 05:31:39 am »
I was trying to get a manager workorder to use only rock nuts for paste-making to avoid running low on hemp seeds, so I tried to copy "job_item" of a workshop job I'd adjusted with `job item-material`, and add it to the the workorder's "items" element (which happens to be nil for that specific order). Dunno if it'd even work, but I saw that for many work orders, items is a vector with "job_item" elements in it, so I thought it'd be worth a shot.

That was also before I learned of gui/workorder-details, since I've been using DFHack version 0.47.05-r5.

Code: [Select]
local help = [====[
======================

]====]

utils = require('utils')
--debug.setmetatable(nil, {__index = function()end})
function findworkorder(workorder_id)
-- does something like this exist? df.global.world.manager_orders.find(workorder_id)
for _, mgr_order in ipairs(df.global.world.manager_orders) do
if mgr_order.id == workorder_id then
return mgr_order
end
end
qerror('not found')
end
function processworkorder(workorder_id)
--df.global.world.manager_orders
local workorder
local job
local mode = 1 -- for quickly switching between different approaches to the problem
local workorder_jobitems = {}

if pcall(findworkorder, workorder_id) then
workorder = findworkorder(workorder_id)
else
qerror('Work order not found')
end
job = dfhack.gui.getSelectedJob(true) or qerror('No job selected')

print("test")
if mode == 1 then
table.remove(workorder,'items')
workorder['items'] = workorder_jobitems
workorder.items = utils.clone(job.job_items, true)
else
--workorder.items = {}
workorder['items'] = workorder_jobitems
for _, copy_job_item in ipairs(job.job_items) do
--workorder.items:insert('#', copy_job_item)
table.insert(workorder.items, copy_job_item)
end
end
end


-- main script
local opt = ...
if opt and opt ~= "" then
if tonumber(opt) then
if tonumber(opt) >= 0 then
processworkorder(math.floor(tonumber(opt)))
else
print("The number should be non-negative.")
end
return
else
print(help)
end
else
print("No work order provided, here's a list of existing work orders:")
for _, mgr_order in ipairs(df.global.world.manager_orders) do
if mgr_order.reaction_name ~= nil and mgr_order.reaction_name ~= "" then
print(mgr_order.id .. ": " .. df.job_type[mgr_order.job_type] .. " (" .. mgr_order.reaction_name .. ")")
else
print(mgr_order.id .. ": " .. df.job_type[mgr_order.job_type])
end
end
end

14
Utilities and 3rd Party Applications / Re: Work order manipulation
« on: April 22, 2023, 09:39:42 am »
Thanks. I'm still at 0.47.05, should this work with it? I receive an error:

./hack/lua/dfhack.lua:759: gui/workshop-job: Cannot be used as a module

Code: [Select]
DFHack version 0.47.05-r5 (release) on x86_64

15
In general, you can protect yourself from errors with pcall. For example:
Code: [Select]
local ok, ret = pcall(function()
    -- do something sketchy
end)

but in this case, you'd probably be best off with testing the type of the pointer before trying to access fields that only exist in some types.

Code: [Select]
local bld = thebuidlinginquestion
if bld:getType() == df.building_type.Workshop then
    -- access workshop fields
elseif bld::getType() == df.building_type.Stockpile then
    -- access stockpile fields
end
Yeah, I had a similar structure in the end. But thanks, pcall's been useful elsewhere.

Another sort of Lua question: if a value in game data is set to nil, how does one set it to something other than nil? I've given it a couple of tries, and an error message like this appears: Cannot write field: null and autovivify not requested.

I guess I could just create a new entry and copy the other fields and insert a non-null value there, and remove the old one, but is there a better way?

Pages: [1] 2 3