Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 214 215 [216] 217 218 ... 242

Author Topic: DFHack 50.11-r6  (Read 795626 times)

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3225 on: October 03, 2022, 02:31:09 am »

What told you there would be iron, and how did you decide there wasn't any?

DF has a bug that causes it to report the presence of deep resources that aren't actually available if they're present in layers that are specified to be at depths deeper than the bottom of the magma sea. However, DF only declares the presence of metal, not the specific kind(s) of metal, so presumably some DFHack tool(s) was used to determine iron presence.

Apart from that, the pre embark logic can't "know" that what it reports actually is going to be there, because the content hasn't actually been generated yet, but remains a prediction. It is theoretically possible for a layer to specify veins of something that then doesn't actually show up in an embark because veins of "competing" materials were generated instead, in particular if the presence is for a single mid level tile ("embark tile"), the layer is only a single Z level deep, and abundance is set very high (so there is a lot of competition for the limited number of veins that can be generated [I don't remember the details, but it's something like a maximum of 4 veins per mid level tile and Z level]).
Logged

A_Curious_Cat

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3226 on: October 03, 2022, 04:23:33 am »

What told you there would be iron, and how did you decide there wasn't any?

Embark-Assistant told me there was iron.  None of the layers I dug through had any iron ore that I could see.  Of course, I didn’t run prospect, so there could have still been some.  Just not where I was digging.  On another note, I had plenty of cassiterite.  I should try my hand at making bronze sometime.   Also, I forgot to run 3dveins when I first embarked on that fortress.  I need to remember next time.  Same thing with noting down the name of the local stream/river…



Also, why isn’t the name of the local stream/river available on the civ screen?
Logged
Really hoping somebody puts this in their signature.

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3227 on: October 03, 2022, 01:11:48 pm »

Just to be sure, you're using DFHack 0.47.05-r7, the version just released two days ago, correct? This issue was marked as fixed in -r7.

Yes, I made a fresh install just today for the sole purpose of trying this out.

I filed https://github.com/DFHack/dfhack/issues/2308 for this. I'll look into it for the next version. Thanks!
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3228 on: October 03, 2022, 01:28:39 pm »

And lethosor fixed the typo I introduced. You can edit the scripts/internal/gm-unit/editor_skills.lua file yourself if you don't want to wait until the next DFHack release:
On line 71, replace "ignore_keys" with "edit_ignore_keys"
« Last Edit: October 03, 2022, 01:30:54 pm by myk »
Logged

JPapas

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3229 on: October 04, 2022, 02:35:21 am »

And lethosor fixed the typo I introduced. You can edit the scripts/internal/gm-unit/editor_skills.lua file yourself if you don't want to wait until the next DFHack release:
On line 71, replace "ignore_keys" with "edit_ignore_keys"

Made this change and it works perfectly :)
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3230 on: October 04, 2022, 03:31:50 am »

@A_Curious_Cat: Embark-Assistant uses the same logic that Prospector does (the code is essentially copied and massaged slightly to fit into its more confined context). I'd try to use Prospect to see what it says, though, because it tells the truth of the situation post embark (as things have been defined at that time, so there's no longer any need for predictions).

However, you may just have gotten unlucky with the RNG such that no vein rolled the iron mineral, but rather something else instead.
I don't know if the vein (and cluster) RNG rolls are independent or if they are re-balanced after each allocation (in the first case a 25% A, 25% B, and 50% C in a case where you have 4 veins would allow for all veins being the same mineral if the rolls happened to be that way, while in the latter the probability of a mineral to get a second vein would be reduced, either with the full or a reduced weight, for each vein whose mineral is specified).
Logged

MaxTheFox

  • Bay Watcher
  • Лишь одна дорожка да на всей земле
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3231 on: October 12, 2022, 04:19:34 am »

World generation tends to ignore stop commands after it gets slow enough. Is there a way to use a script to force-stop worldgen at a certain year?
Logged
Woe to those who make unjust laws, to those who issue oppressive decrees, to deprive the poor of their rights and withhold justice from the oppressed of my people, making widows their prey and robbing the fatherless. What will you do on the day of reckoning, when disaster comes from afar?

myk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3232 on: October 12, 2022, 03:12:21 pm »

I believe DF only checks the "stop" flag once every few years. It doesn't ignore it, it just takes longer and longer to process that many years before it checks. That said, there might be a way to speed it up, but I don't know what it is.
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3233 on: October 12, 2022, 03:26:52 pm »

One solution is to wait for the premium release, where that's fixed.
Logged

Salmeuk

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3234 on: October 13, 2022, 01:44:21 am »

World generation tends to ignore stop commands after it gets slow enough. Is there a way to use a script to force-stop worldgen at a certain year?

Spoiler (click to show/hide)
at timing your stop entry just 4 years ahead of your intended date

Spoiler (click to show/hide)
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3235 on: October 13, 2022, 02:50:53 am »

As mentioned, DF has a tendency to not check input every year, so your logic to stop will have to account for that by stopping when the year is within a given range of the desired year (before, after, or around, depending on what you're aiming for).
https://github.com/PatrikLundell/scripts/blob/own_scripts/worldgen_breakout_box.lua is a web page with a lua script (NOT just the script iself) harness for breaking out of world gen at various points that may be of interest.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3236 on: October 13, 2022, 03:33:20 am »


ok so here's a script for a niche issue... where you couldn't use pets in the farmers workshop, well now you can... at least for milking so far I think the other jobs are possible when I figure out their general refs.
Code: [Select]
local Uni=dfhack.gui.getSelectedUnit()


  local buildings={}
for _,izm in pairs (df.global.world.buildings.all) do
if df.building_workshopst:is_instance(izm) and izm.type==1 then
milk=izm.jobs[0]
print(milk.id)
milk.general_refs:insert("#",{new=df.general_ref_unit_milkeest,unit_id=Uni.id})
end
end

this script works as follows, you make a milk animal job in the workshop, while the game is still paused you highlight the creature you want to be milked with the cursor which the game will go through the rest of the job process.



as seen in this gif.... and also seen in this gif best check the creature you want to milk is milk-able as you might end up dragging some poor sap to extract literally nothing

(they still end up getting the milked trait and have a milk counter if you do this)

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

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3237 on: October 18, 2022, 04:47:21 pm »

How expensive is Eventful?  Specifically for announcements/reports.

Not looking for precision here, just gut feelings.

I kind of want to have some code triggered by certain report types (specifically the migrant wave announcements).

I think I've figured out that Eventful doesn't trigger as reports are issued, but checks every n ticks after-the-fact for new reports.  True?

Then it will pass every new report to a script callback function, but it can't filter on e.g. D_MIGRANTS_ARRIVAL.  Also true?

So I would look at world.status.reports[id_number].type to check for D_MIGRANTS_ARRIVAL and similar.

Since I'm processing every report anyway, it doesn't matter too much if I just process them every tick?  Or would getting the reports in batches be less costly?  It's the same number of callbacks, but maybe not as much setup/teardown between C++ EventManager and eventful.

I haven't done any experimenting, I'm just looking at eventful.lua, eventful-client.lua, and annc-monitor.lua.


The other way I've thought of is to have an every-n-ticks callback that examines #world.units.active to see if the array size has changed since last time.  Any thoughts on whether that's less expensive?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3238 on: October 18, 2022, 10:36:03 pm »

The overhead between Lua and C++ is significantly smaller than the amount of processing done by just doing things in Lua

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r7
« Reply #3239 on: November 01, 2022, 09:18:11 pm »


ok so went and worked on a script that lets one force petitions to your fort.
kind of an alternative version to Makeown that forces the game to go through the citizenship process.
Code: ('force-petition.lua') [Select]
function petition()


local Shell=dfhack.gui.getSelectedUnit(true)
--local Shell=getCreatureAtPos(getxyz())
local Agree=df.global.world.agreements.all
Agree:insert("#",{new=true,id='-10',next_party_id=2,next_details_id=1})
local dd=Agree[#Agree - 1]
--for d,dd in ipairs(Agree) do
--if dd.id==(-10) then
--print('oh no')
dd.id = df.global.agreement_next_id
df.global.agreement_next_id = df.global.agreement_next_id + 1
dd.details:insert("#",{new=true,type=3})
dd.parties:insert("#",{new=true})
dd.parties:insert("#",{new=true})
dd.details[0].data.Citizenship=df.agreement_details_data_citizenship:new()
dd.details[0].data.Citizenship.applicant=0
dd.details[0].data.Citizenship.government=1
dd.details[0].data.Citizenship.site=df.global.ui.site_id
dd.parties[0].histfig_ids:insert("#",0)
dd.parties[0].histfig_ids[0]=Shell.hist_figure_id
dd.parties[1].id=1
dd.parties[1].entity_ids:insert("#",0)
dd.parties[1].entity_ids[0]=df.global.ui.group_id
df.global.ui.petitions:insert("#",dd.id)

end
function petition2()


local Shell=dfhack.gui.getSelectedUnit(true)
--local Shell=getCreatureAtPos(getxyz())
local Agree=df.global.world.agreements.all
Agree:insert("#",{new=true,id='-10',next_party_id=2,next_details_id=1})
local dd=Agree[#Agree - 1]
--for d,dd in ipairs(Agree) do
--if dd.id==(-10) then
--print('oh no')
dd.id = df.global.agreement_next_id
df.global.agreement_next_id = df.global.agreement_next_id + 1
dd.details:insert("#",{new=true,type=2})
dd.parties:insert("#",{new=true})
dd.parties:insert("#",{new=true})
dd.details[0].data.Residency=df.agreement_details_data_residency:new()
dd.details[0].data.Residency.reason=3
--dd.details[0].data.Residency.reason=48
dd.details[0].data.Residency.applicant=0
dd.details[0].data.Residency.government=1
dd.details[0].data.Residency.site=df.global.ui.site_id
dd.parties[0].histfig_ids:insert("#",0)
dd.parties[0].histfig_ids[0]=Shell.hist_figure_id
dd.parties[1].id=1
dd.parties[1].entity_ids:insert("#",0)
dd.parties[1].entity_ids[0]=df.global.ui.group_id
df.global.ui.petitions:insert("#",dd.id)

end
petition2()
petition()

just use the cursor and run the script, and unpause the game as it takes awhile for the petition option to show up.
now the original script had one(three) functions but with help of lethosor it was cut down to two(the other function is for residency after realizing granting citizenship might not always work)

probably should give out a warning as this script probably has some unseen bugs but so far pretty stable the most part of my tests.

you probably should not use this if you don't have a noble who can receive petitions as the game will prevent you from accepting/denying them.

this script opens the door to other agreement related mechanics you want to mess with.

edit: ok so here's an artifact spawner script that plops any artifact item into anyone's inventory... the kicker is you probably don't wanna drop this.

Code: ('itemsummon.lua') [Select]
local dlg=require("gui.dialogs")
-- ok so this script is made for summoning gods into DF, to make this work you need to nickname someone historical that would form an army.
-- so the best choice would be either another adventurer or adv follower if you want the god to show up after fast traveling or assign the DFCAT nickname on some random peasant you talk to once.
-- going to give a warning about how this script messes with nemesis and probably unstable.
-- so BEST not use this on any important saves you care about and just test this out on an disposable save.
-- oh and the gods you summon won't really talk back if you reply to them.
-- this script uses coding from spawn unit and gui scripting to make it work, don't think this works in fort mode as this was made and tested in adv mode.
-- hopefully you have a better time getting gods to fight each other better than I did.

--that been edited to spawn items so it less likely to crash and corrupt saves hopefully
function deitysummoning()
local Ark={}
for k,v in pairs(df.global.world.artifacts.all) do
if v.item.flags.artifact==true or v.flags.artifact_mood==true then
BoaName=dfhack.TranslateName(v.name)
table.insert (Ark,{dfhack.TranslateName(v.name).." "..v.name.nickname,nil,v})
end
end
local f=function(Name,C)
  deitysummoning2(C[3])
end
dlg.showListPrompt("artifact list","Select your item for summoning",COLOR_RED,Ark,f)
end
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end

function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end
function getItemAtKPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.item.all -- load all items
local kickpos=df.global.world.units.active[0].pos
for i = 0, #vector-1 do -- look into all items offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==kickpos.x and cy==kickpos.y and cz==kickpos.z then --compare them
return vector[i] --return index
end
end
--print("item not found!")
return nil

end
function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil

end



function deitysummoning2(HistfigID)
Divineslot=HistfigID
 local horse=getCreatureAtPos(getxyz())
 print('God Nem ID',Divineslot.id)
 print('God Nem.figure ID',horse.id)
  horse.inventory:insert("#",{new=true,item=HistfigID.item,mode=2,body_part_id=0})
end

deitysummoning()





probably useful for getting a slab or a book or random trinkets from the world with out needing to search for it hard you do need to know the name of the artifact you're looking for.
also probably unstable I haven't tested how this works with saving yet.
« Last Edit: November 11, 2022, 09:26:11 am by Rumrusher »
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
Pages: 1 ... 214 215 [216] 217 218 ... 242