Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 228 229 [230] 231 232 ... 243

Author Topic: DFHack 50.13-r1  (Read 809385 times)

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: DFHack 50.08-r1
« Reply #3435 on: May 23, 2023, 02:59:41 pm »

Does anyone know much about pets and war animals?  I'm looking at the ties between pets and owners, with the aim of automating assignment of war animals to soldiers.  I've found:
  • A pet or assigned working animal has a name.  Strays don't.
  • War animals have a unit.profession == 99 TRAINED_WAR.
  • unit.relationship_ids.Pet is set to the owner's unit id.
  • The unit has an associated historical figure.  Stray's don't.
  • War animals' historical_figure.profession is also == 99 TRAINED_WAR
  • historical_figure.histfig_links has a record of type histfig_hf_link_pet_ownerst.

I cannot find links from an owner to their pets/assigned animals.  Not in the owning unit or their historical_figure.

I can replicate all of this except the pet unit's name.  Is there a known way to get DF to generate a random unit name?

I suspect that the historical_figure is needed to allow the unit to leave the map and come back e.g. following a soldier on a raid.  Manually creating a new historical figure looks possible but hard.

historical_figures without names exist, so that's not an error state.

If I manually create a nemesis_record, how would I set the .save_file_id (unit_chunk) field?  Just assign it from df.global.unit_chunk_next_id and increment that?

And similar for a new historical_figure?  Append it to world.history.figures[], increment df.global.hist_figure_next_id?

And similar for a nemesis record.  Append it to world.nemesis.all and world.nemesis.bad, increment df.global.nemesis_next_id?

I guess I'm asking too many obscure questions.  I'll experiment.


Thinking about it, is there a way to parse the gui and manually call the routine that would be called when a button is clicked?  That might be an easier route.
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 50.08-r1
« Reply #3437 on: May 25, 2023, 02:55:05 pm »

Nomad Script or hey this loads map chunks like how adv mode does it script for traveling the world... in fort mode.


old recording of the script as I realize the script probably doesn't need FTgo's surface and cavern fast travel adv mode functions

and here's the end result ... from a different fort as this process takes a bit too long to fully capture.
Code: ("nomad.lua") [Select]
--script using warmist spellbook code to make a cheap gui for expanding and contracting a player fort.
-- this script is pretty dangerous in that it reveals the expanded map chunk, and when contracting it culls anyone in that map chunk.
-- so far probably best to use this with the void fort scripts as it allows one to expand and explore the world while keeping your site.
--oh warning if you're about to collapse a map chunk make sure to clear any stockpiles and civ zones you made in that map chunk.
--oh and don't retire unless you're back to the original fort embark size or the game will corrupt that fort and or crash.
--also it will take a while for any results to happen. I have no idea on speeding up the process.
--if you use this for some nomad playstyle best learn how to haul goods across map and burrowing folks.
--as you might lose folks while traveling.
 
local dlg=require("gui.dialogs")

function GoN()
local Site=df.global.plotinfo.main.fortress_site
local Nor=Site.global_min_y-1
Site.global_min_y=Nor
end

function NoN()
local Site=df.global.plotinfo.main.fortress_site
local Nor=Site.global_min_y+1
Site.global_min_y=Nor
end
function GoS()
local Site=df.global.plotinfo.main.fortress_site
local Sor=Site.global_max_y+1
Site.global_max_y=Sor
end
function NoS()
local Site=df.global.plotinfo.main.fortress_site
local Sor=Site.global_max_y-1
Site.global_max_y=Sor
end
function GoE()
local Site=df.global.plotinfo.main.fortress_site
local Eor=Site.global_max_x+1
Site.global_max_x=Eor
end
function NoE()
local Site=df.global.plotinfo.main.fortress_site
local Eor=Site.global_max_x-1
Site.global_max_x=Eor
end
function GoW()
local Site=df.global.plotinfo.main.fortress_site
local Wor=Site.global_min_x-1
Site.global_min_x=Wor
end
function NoW()
local Site=df.global.plotinfo.main.fortress_site
local Wor=Site.global_min_x+1
Site.global_min_x=Wor
end

function Go()
for k,v in pairs(df.global.world.armies.all) do
if v.flags[0]== true  then
local Nor=v.pos.y-1
v.pos.y=Nor
end
end
end
function doNothing()
print("doing nothing real good but here have a site")
--require("plugins.dfusion.adv_tools").addSite(nil,nil,nil,nil,nil,nil,df.global.world.units.active[0].civ_id)
end
function doNothing2()
dlg.showMessage("Travel-Hack","Bypassing Message to access FastTravel")
df.global.ui_advmode.message=""
--require("plugins.dfusion.adv_tools").addSite(nil,nil,nil,nil,nil,nil,df.global.world.units.active[0].civ_id)
end

function greetAndStuff()
dlg.showMessage("Greetings", "Seasons greatings and lols")
end
MOVEMENT_KEYS = {
    A_CARE_MOVE_N = { 0, -1, 0 }, A_CARE_MOVE_S = { 0, 1, 0 },
    A_CARE_MOVE_W = { -1, 0, 0 }, A_CARE_MOVE_E = { 1, 0, 0 },
    A_CARE_MOVE_NW = { -1, -1, 0 }, A_CARE_MOVE_NE = { 1, -1, 0 },
    A_CARE_MOVE_SW = { -1, 1, 0 }, A_CARE_MOVE_SE = { 1, 1, 0 },
    --[[A_MOVE_N = { 0, -1, 0 }, A_MOVE_S = { 0, 1, 0 },
    A_MOVE_W = { -1, 0, 0 }, A_MOVE_E = { 1, 0, 0 },
    A_MOVE_NW = { -1, -1, 0 }, A_MOVE_NE = { 1, -1, 0 },
    A_MOVE_SW = { -1, 1, 0 }, A_MOVE_SE = { 1, 1, 0 },--]]
    A_CUSTOM_CTRL_D = { 0, 0, -1 },
    A_CUSTOM_CTRL_E = { 0, 0, 1 },
    CURSOR_UP_Z_AUX = { 0, 0, 1 }, CURSOR_DOWN_Z_AUX = { 0, 0, -1 },
    A_MOVE_SAME_SQUARE={0,0,0},
    SELECT={0,0,0},
}
ALLOWED_KEYS={
    A_MOVE_N=true,A_MOVE_S=true,A_MOVE_W=true,A_MOVE_E=true,A_MOVE_NW=true,
    A_MOVE_NE=true,A_MOVE_SW=true,A_MOVE_SE=true,A_STANCE=true,SELECT=true,A_MOVE_DOWN_AUX=true,
    A_MOVE_UP_AUX=true,A_LOOK=true,CURSOR_DOWN=true,CURSOR_UP=true,CURSOR_LEFT=true,CURSOR_RIGHT=true,
    CURSOR_UPLEFT=true,CURSOR_UPRIGHT=true,CURSOR_DOWNLEFT=true,CURSOR_DOWNRIGHT=true,A_CLEAR_ANNOUNCEMENTS=true,
    CURSOR_UP_Z=true,CURSOR_DOWN_Z=true,
}

listofspells={
{text="nothing", spell=doNothing,icon='*'},
{text="expand: North+", spell=GoN,key="CUSTOM_W"},
{text="expand: South+", spell=GoS,key="CUSTOM_S"},
{text="expand: East+", spell=GoE,key="CUSTOM_D"},
{text="expand: West+", spell=GoW,key="CUSTOM_A"},
{text="Contract: North-", spell=NoN,key="CUSTOM_W"},
{text="Contract: South-", spell=NoS,key="CUSTOM_S"},
{text="Contract: East-", spell=NoE,key="CUSTOM_D"},
{text="Contract: West-", spell=NoW,key="CUSTOM_A"},
}
 
dlg.showListPrompt("Directions","Choze Direct",nil, listofspells,function(index,choice) choice.spell() end)

so here's the nomad script for the dfhack required nomad playstyle and probably adding another way to play with void forts as this cuts down embarking twice and allows void forts to interact with larger pre-generated sites like towns and forest retreats although you're probably be a bit lost figuring out where the structures would be or where everyone is currently at.
big warning the game might reveal chunks of the map and one might require to deal with the DF50's new special map feature pop ups.
I been using this lua command for most part to clear them as depending on how big you expand the fort you might end up with like 50 to 300+ of these warnings.
Code: [Select]
:lua df.global.world.status.popups:resize(0) hmm I guess one could write a lua script that turns off the announcement pop up for that so you can ignore them
oh yeah one probably want to use revflood if they want to hide the expanded map chunks


now I normally just use gm-editor to do this via going into
Code: [Select]
gui/gm-editor df.global.plotinfo.main.fortress_site then messing with the global min/max x and y coords

another big warning with using this is you can store drinks and items offsite and they won't spill over if you unload the map chunk containing them and retire... then unretire the fort.
you do need to expand into the location you store the drinks or you will end up forcing your fort to go with out drinks until the game finally expand into the drink storage.
oh and you could unload the entire fort and send everyone into the void which will cause the game to consider that a "fort end" so probably best remember to kill the process if that ever happens to revert back to a previous save.
well anyway this is pretty fun if you want to explore the world you generated and possibly harvest said world for resources and units and gear and crafts to build a large empire.

it's also possible to say with returning to the right embark size with retiring, one could take over other spots in the world map and with void fort move around the world map with the map chunk you stole.
so if you like the hills in a hilltop you could swipe that and build your fort there, or you had plans on an ocean fort this could help, wanna do an Oregon trail like fort session where you stop at some destination? would take some getting use to constantly moving and you might need to figure out how to keep your tools and gear with you but yeah that's possible.

oh yeah another big warning probably backup your saves before and after using this, and I don't know if this let you do raids?
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

A_Curious_Cat

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3438 on: May 25, 2023, 03:34:44 pm »

Logged
Really hoping somebody puts this in their signature.

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3439 on: May 25, 2023, 06:45:08 pm »

It marks how the tile is "occupied", e.g. is it part of the footprint of the building? is it passable by units or are units blocked from moving through that tile? etc.
Logged

xzaxza

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3440 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.
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3441 on: May 28, 2023, 09:14:51 pm »

checking for stockpile assignment is a good idea, if the flags check doesn't already mask those wheelbarrows out. This might be an issue for the upcoming gui/autodump as well. Could you file an issue on Github? https://github.com/DFHack/dfhack/issues

Btw, the commented out code you were looking at is for an unrelated "autodump" function that marks items brought to a stockpile for dumping. The code is being migrated to a new "logistics" plugin. That code does, as you said, check for stockpile assignment before marking the item.
Logged

xzaxza

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3442 on: May 28, 2023, 10:26:49 pm »

It's actually the stockpile functionality that is in question. But yeah, ok.
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.

A_Curious_Cat

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3443 on: May 29, 2023, 01:56:13 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?
Logged
Really hoping somebody puts this in their signature.

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3444 on: May 29, 2023, 03:26:00 am »

normally, dwarves will bring items marked for dumping to the garbage dump zone, but autodump actually doesn't teleport items to the garbage dump zone. it teleports them to the cursor.

the confusion here is that the autodump plugin has historically been two very separate tools. There's the item teleportation code that teleports items marked for dumping to the cursor, and then there's the stockpile monitor that lets you register stockpiles for "autodump". Items brought to that stockpile will be marked for dumping, then dwarves will move those items to the garbage dump.

@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
Logged

feelotraveller

  • Bay Watcher
  • (y-sqrt{|x|})^2+x^2=1
    • View Profile
Re: DFHack 50.08-r1
« Reply #3445 on: May 29, 2023, 04:49:15 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.

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?
Logged

xzaxza

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3446 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.
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.

xzaxza

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3447 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.
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r1
« Reply #3448 on: June 01, 2023, 03:54:46 pm »

Logged

xzaxza

  • Bay Watcher
    • View Profile
Re: DFHack 50.08-r2
« Reply #3449 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.
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.
Pages: 1 ... 228 229 [230] 231 232 ... 243