Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 192 193 [194] 195 196 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1453730 times)

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2895 on: January 31, 2013, 12:39:24 am »

If you need silk, (save first!) you can pause, reveal, mark all the webs in the caverns for dumping, use autodump to bring it into the fort (next to your loom/wherever) and unreveal.  Voila.  Instant silk, very quick & easy.

thburns

  • Bay Watcher
  • I came, I saw..... It sucked!
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2896 on: January 31, 2013, 12:48:57 am »

Wish I could attempt that right now. I have a damn metal FB down there. And if I open them caverns up I'm toast. But I have pondered the idea already. I want to use a cave-in on it, but the world gened with tight maze-like caverns. Too many supporting walls. Eventually I will flood the darn thing with magma though :D
Logged
If only life and parenting were as easy as "Dwarf Fortress"

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2897 on: January 31, 2013, 12:49:40 am »

Wish I could attempt that right now. I have a damn metal FB down there. And if I open them caverns up I'm toast.

That method doesn't require any dwarves or cavern opening at all...

thburns

  • Bay Watcher
  • I came, I saw..... It sucked!
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2898 on: January 31, 2013, 12:52:37 am »

Ohh. Duh! Your right. I didnt read the autodump part. Too funny. Time to set up a new workshop. thanks!
Logged
If only life and parenting were as easy as "Dwarf Fortress"

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2899 on: February 01, 2013, 12:26:31 am »

So, are the structures for historical figure links inside the historical figure struct documented anywhere?  I don't see them in df-structures anywhere, but I can access them in DFHack itself through the Lua interface.  I'm pretty sure the only data inside the struct is just a historical figure id (or maybe a unit id, I don't remember which), but I can't access the property to fiddle with it since I don't know what the name of the property is.  I've only ever modified those values through a memory editor.

DFHack seems to understand what the type is though, it tells me that the first entry is a histfig_hf_link_deityst, which is correct.  Does it actually have the internal structure though?
Logged
Through pain, I find wisdom.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2900 on: February 01, 2013, 12:33:30 am »

Any way to detect a creature's body size?

TheKaspa

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2901 on: February 01, 2013, 02:40:14 am »

I have problem with autodump.
I designed a single tile as garbage dump, then designed the items to be dumped, then wrote 'autodump' in dfhack (I marked the position with the k interface). It says that 0 items were dumped, and now they are all marked as forbidden. How is it?
Logged
Tai'shar DwarfFortress

I've heard Minecart Airlines Express offers nice trips to nobility. Alternative trips include a voyage over the volcano. Call 1-800-I-THE-GUINEAPIG-VOLUNTEER and book now!
My fucking armok, you broke the game.

snooptodd

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2902 on: February 01, 2013, 10:12:17 am »

I have problem with autodump.
I designed a single tile as garbage dump, then designed the items to be dumped, then wrote 'autodump' in dfhack (I marked the position with the k interface). It says that 0 items were dumped, and now they are all marked as forbidden. How is it?
This is how I use autodump.

In the game d-b-d
Mark the items to be dumped.
Move the cursor to location where I want the items dumped.
Type autodump in dfhack.
in DF type c to change mode and press enter twice.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2903 on: February 02, 2013, 12:03:11 am »

Well, figured my own problem out.  The structure isn't documented anywhere that I can find, although I was able to finally figure out how to use Lua to get the property names.  Apparently it's called anon_1, presumably because it's not documented.

Well, no matter, I finished my first try at a Lua script.  Here's the Lua script for marrying any two dwarves (or whatevers).  I threw this together while teaching myself DFHack's API and Lua at the same time, so there is no error checking, and it doesn't use the fancy core suspension thing to make sure that the memory is consistent.  It hasn't crashed the game for me yet, but certainly has the potential to.  You've been warned.

Code: [Select]
-- Marries two specified creatures

local args = {...}

local victim1, historic_victim1
local victim2, historic_victim2

for key, value in pairs(df.global.world.units.all) do
-- The arguments are strings, but the structs contain numbers
if value.id == tonumber(args[1]) then
victim1 = value
end
if value.id == tonumber(args[2]) then
victim2 = value
end
end

print("Marrying " .. victim1.name.nickname .. " and " .. victim2.name.nickname)

historic_victim1 = df.global.world.history.figures[victim1.hist_figure_id]
historic_victim2 = df.global.world.history.figures[victim2.hist_figure_id]

local new_link1 = df.histfig_hf_link_spousest:new()
local new_link2 = df.histfig_hf_link_spousest:new()

-- Not documented, but this is the historical figure id
new_link1.anon_1 = victim2.hist_figure_id
new_link1.link_strength = 100

new_link2.anon_1 = victim1.hist_figure_id
new_link2.link_strength = 100

local link_count1 = #historic_victim1.histfig_links
local link_count2 = #historic_victim2.histfig_links

historic_victim1.histfig_links:resize(link_count1 + 1)
historic_victim1.histfig_links[link_count1] = new_link1
historic_victim2.histfig_links:resize(link_count2 + 1)
historic_victim2.histfig_links[link_count2] = new_link2

victim1.relations.spouse_id = victim2.id
victim2.relations.spouse_id = victim1.id

Just toss that in a file called marry.lua in your DFHack scripts folder.  To use it, you'll need to run this command:

marry unit_id1 unit_id2

So you need to get those unit ids.  The fastest way I know of to do that is to use the 'k' look around command and put it over each dwarf, then run this command inside the interactive Lua interpreter:

Code: [Select]
print(dfhack.gui.getSelectedUnit().id)
Do that for each dwarf, then run the marry command above and let the wedding bells ring.  There's a lot that could be done to tweak the script, especially error checking and sanity checking.  It will most certainly let you try to marry someone to multiple people (of either gender!), which will work for the relationships screen, but in the invisible relations section they're only really married to the last one you run through this command.

Next up is probably a divorce script, which should be pretty simple too.
Logged
Through pain, I find wisdom.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2904 on: February 02, 2013, 12:04:26 am »

Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.

EDIT: Getting an error from this line:

local strength = dfhack.units.getPhysicalAttrValue(selectedUnit, STRENGTH)/3550

attempt to call field 'getPhysicalAttrValue' (a nil value)
« Last Edit: February 02, 2013, 12:18:11 am by Putnam »
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2905 on: February 02, 2013, 12:23:36 am »

Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.

Probably.  I tested it out and yes, you can marry someone to themselves.  I haven't tried it adventure mode though, no idea what will happen.  I haven't tested to see what happens if you marry two women together either, but it's possible they'll get pregnant.  You can also marry someone to a deity this way I think, but they don't have units as far as I know, so pregnancy won't happen among other strange things.

As to the other problem, don't you need to specify which unit you're getting the attribute of?
Logged
Through pain, I find wisdom.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2906 on: February 02, 2013, 02:13:22 am »

So, apparently there's no getPhysicalAttrValue function?

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2907 on: February 02, 2013, 06:57:44 am »

Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.

Probably.  I tested it out and yes, you can marry someone to themselves.  I haven't tried it adventure mode though, no idea what will happen.  I haven't tested to see what happens if you marry two women together either, but it's possible they'll get pregnant.  You can also marry someone to a deity this way I think, but they don't have units as far as I know, so pregnancy won't happen among other strange things.

As to the other problem, don't you need to specify which unit you're getting the attribute of?
You can but nothing happen... you might end up with children due to the filter for pregnancy is marriage in DF. beware of having cross breeded children who you can't look at the detail or fear crashing.
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

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r2
« Reply #2908 on: February 02, 2013, 12:40:54 pm »

you might end up with children due to the filter for pregnancy is marriage in DF.
You won't - the marriage is only a restriction on top of the existing logic, so you still need both a male and female.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Lord_Phoenix

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2909 on: February 02, 2013, 02:25:29 pm »

Here's a little script I just cooked up to give proper spouse/parent last names to dwarves in the fort (only works if spouse/parent is actually at the fort), for those who like having family names.  Valid arguments are nothing or 0 for a patriarchal lineage (wives and children get father/husband last name), or 1 for a matriarchal lineage (husbands and children get mother/wife last name).  I just cobbled this together, so it's nothing perfect, might be builtin dfhack functions to do some stuff that I did, but I don't know cause there's very little documentation I could find on the properties and methods associated with each class, so I just had to go by key,value pairs to find properties and worked from there.  If anyone wants to do any improvements to it, that's fine by me.  Not even sure this would actually change their names in legends or what since there seems to be a separate historical id.

Oh, and does anyone know how to update the names when viewing unit status without giving them a nick and then removing it in game?

Spoiler (click to show/hide)
« Last Edit: February 02, 2013, 02:38:23 pm by Lord_Phoenix »
Logged
Pages: 1 ... 192 193 [194] 195 196 ... 373