Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 191 192 [193]

Author Topic: DFHack 0.47.05-r1  (Read 413022 times)

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2880 on: April 01, 2021, 09:44:25 am »

What exact version of IDA are you running? I've got 7.0.191002 and it runs that script just fine, though I'm not running it from within IDA's "idc" directory - I'm running it directly from where I cloned the df_misc repo, which is on a different drive and is right next to my DFHack and DF directories.

Also, what is the exact file size of the script, and what sort of line endings does it have? Mine is 27,133 bytes and has DOS line endings, but IDA still seems to handle it just fine even when it has UNIX line endings (and is 26,049 bytes long).

Didn't know I needed the whole df_misc repo. Looks like that fixed it.

Now how do I find my way into DF's game loop?
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)?

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2881 on: April 02, 2021, 11:42:15 am »

Spoiler: quotes (click to show/hide)

Note: Solved.

Was talking of regular software updates to whole system. I don't really keep track of system updates for, say, past month, though there's probably a way to find the log for them somewhere - but I'm unsure how I could tell something is meaningful. And yeah, I can imagine introducing a bug - ah what the heck, let me recompile with debug setting on, see what I find....

...Well never mind, I find PEBCAK for ➂ >///< - When I was narrowing down what was causing the crash, one of the first things I did was removing init files. These init files which included things like workshop transparency. Which I forgot isn't enabled by default and is required to keep track of workshop building tiles. Oops.

As for crash issue, seems it's been lurking in code since May 2020 going by testing. Pretty rare, but I do know what code I added back then -

Quote
"While your at it, make it not randomly crash :P" - Rose, back then.

- but a better solution was using the tip you provided some months ago to run with -g. Turns out, this time it told me exactly in which function the crash was in.

Anyway, 1/2 turned out to have been caused by rare plant_growth items (a cherry, a desert lime, a bayberry - harvested after falling, perhaps?) had anon_1/print_type set to -1 (which makes them take the withered leaf symbol). Since this was used as an array index that would ordinarily start from zero, well....it'd hit undefined behaviour whenever unit walked on a tile where freshest item was one of those.


Anyway, seems that was it. Ah, DF, will you ever stop providing new things to learn about you?

Buckley

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2882 on: April 06, 2021, 05:25:21 pm »

Back to playing DF after a few months.  Sometime in the last few releases of DF Hack someone took time to tweak the exportlegends behavior (I think) to dump files into a file instead of loose.  It also appears they added a message in the console when it's done. "Done exporting."

Thanks.  Little quality of life thing that made me very happy.  I'm often updating my legends file as a play and it's so much easier moving the files to where I keep them now.

 ;)
Logged

Moeteru

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2883 on: April 08, 2021, 12:25:44 pm »

My most recent fort has suffered from some very severe military equipment corruption (thankfully not the crash-causing kind) which has left half my military unable to dress themselves. The basic problem is that DF will assign the same item to multiple dwarves.

I've made some significant progress towards writing a dfhack script to fix the problem. The script searches through the global list of all items, builds up a list of candidate items sorted by quality, then matches them to the uniforms assigned to each squad position. After overwriting the item assignments in both position.assigned_items and position.uniform, the dwarves happily drop any incorrect items and pick up the new ones. 69 out of 70 military dwarves will now dress themselves properly without any fiddly micromanagement.

The one thing I couldn't figure out is how to deal with different sized armor for my single human squad member. How do I check if a particular piece of armor will fit a particular unit? Toady gives the numerical constraints in this FOTF reply, but I can't find where those size values are stored in the item_armorst (or similar) structures.
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2884 on: April 08, 2021, 01:24:03 pm »

The one thing I couldn't figure out is how to deal with different sized armor for my single human squad member. How do I check if a particular piece of armor will fit a particular unit? Toady gives the numerical constraints in this FOTF reply, but I can't find where those size values are stored in the item_armorst (or similar) structures.

The maker_race value of an item marks it as being sized for a particular creature race. This size is numerically the adultsize of the race in question. In other words:

Code: [Select]
local size = df.creature_raw.find(item.maker_race).adultsize
(Confirmed this by spawning a dragon equipped with a helm in arena mode, taking control of a dwarf, and viewing the helm before and after changing the adultsize of dragons to that of dwarves; the helm lost its "large" descriptor after the change).
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

Moeteru

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2885 on: April 08, 2021, 08:18:22 pm »

Awesome, thanks a lot.
My code is still rather brittle and probably doesn't handle edge-cases properly, but it seems to work. For the first time in a very long time I have a fully equipped military even down to the correct flasks and backpacks.
Here it is in case anyone is curious. I wouldn't recommend running it without making a full save backup first. I really can't guarantee that it won't cause corruption. https://ghostbin.co/paste/qwph54
Also there are a bunch of TODO notes for functionality which I don't personally need. Things like quivers, the partial match setting, individual choice weapons, etc.
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2886 on: Today at 12:56:56 am »

Do we know how to make an item fall? Writing a script to deal with floating webs.
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)?
Pages: 1 ... 191 192 [193]