Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 188 189 [190] 191 192 ... 243

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

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2835 on: March 06, 2021, 04:43:19 pm »

Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

HungThir

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2836 on: March 07, 2021, 11:47:39 pm »

Quote
lair

This command allows you to mark the map as a monster lair, preventing item scatter on abandon. When invoked as lair reset, it does the opposite.

hmm... is it known whether this works for adventurer camps?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2837 on: March 08, 2021, 12:04:50 am »

I think there's a decent chance, but trying it out yourself is the only way to know for sure. (And let us know what you find if you do - it would be good to document, as you've noticed.)
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2838 on: March 08, 2021, 09:19:21 am »

Quote
lair

This command allows you to mark the map as a monster lair, preventing item scatter on abandon. When invoked as lair reset, it does the opposite.

hmm... is it known whether this works for adventurer camps?
from my understanding you can put stuff on tables in adv camps to prevent scatter but also like adv camps don't really scatter stuff... outside of books and artifacts which bypass the item placement unless you place them on a table or pedestal.
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

ibanix

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2839 on: March 09, 2021, 04:27:51 pm »

Does dfhack have a way to unconvict someone of a crime? Or failing that, to force-cancel the job that chains up a dwarf for justice?
Logged

Schmaven

  • Bay Watcher
  • Abiding
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2840 on: March 09, 2021, 04:37:48 pm »

Does dfhack have a way to unconvict someone of a crime? Or failing that, to force-cancel the job that chains up a dwarf for justice?

I heard that sending a dwarf on a mission will null their pending sentences.  I have yet to test that, but if true, maybe there's a way to DFHack them into some sort of micro-mission?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2841 on: March 09, 2021, 06:46:41 pm »

Worth noting that the "confirm" plugin does add a confirmation dialog when convicting anyone of a crime (as of 0.47.04-r2: https://github.com/DFHack/dfhack/issues/1593).

I'm not aware of an easy way to "un-convict" someone, or of much research being done on the justice system in general, really. It would almost certainly be reversible in theory, but there could be a fair number of references to a dwarf/conviction/etc. that would need to be changed, depending on how DF implements it.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

ibanix

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2842 on: March 09, 2021, 07:17:35 pm »

Unfortunately, what happened is that I created a Captain of the Guard and didn't realize I had pending punishments. I removed the captain and even tried force-moving him as military via another squad, but he always ends up still trying to chain up some poor dwarf who just didn't meet a silly mandate.
Logged

feelotraveller

  • Bay Watcher
  • (y-sqrt{|x|})^2+x^2=1
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2843 on: March 09, 2021, 09:25:56 pm »

Is there a way to split stacks with dfhack?  If so how?

(Background: The immediate use would be to split a 70 stack of prepared food so that it can be stored in a container.  It was produced by an unfortunate-fortunate accident involving booze cooking.  In order not to vermin up the tavern it will otherwise spend the next couple of months sitting in the trade depot until, hopefully, a caravan arrives but that solution is far from ideal.)



Thanks Patrik for following up on the diamond issue,  Your efforts are Legend.  :)
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2844 on: March 09, 2021, 11:11:42 pm »

Is there a way to split stacks with dfhack?  If so how?

(Background: The immediate use would be to split a 70 stack of prepared food so that it can be stored in a container.  It was produced by an unfortunate-fortunate accident involving booze cooking.  In order not to vermin up the tavern it will otherwise spend the next couple of months sitting in the trade depot until, hopefully, a caravan arrives but that solution is far from ideal.)

Did a bit of searching: it looks like DF's base "item" class actually has a splitStack() virtual method (I didn't know this until now), which means that DFHack can call it too. It returns the new item, and reduces the stack size of the existing item. Here is the only use of it that I found, in C++. It looks like you would want to call categorize() too so that the new item gets inserted into the right vectors under world.items.

In Lua, this would translate as:
Code: [Select]
new_item = item:splitStack(stackSize, true)
if new_item then
    new_item:categorize(true)
end
(I'm not sure what "true" means for either, or whether stackSize is the number of items in the new or the old stack, so you'll probably need to experiment.)
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

feelotraveller

  • Bay Watcher
  • (y-sqrt{|x|})^2+x^2=1
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2845 on: March 10, 2021, 02:43:42 am »

Is there a way to split stacks with dfhack?  If so how?

(Background: The immediate use would be to split a 70 stack of prepared food so that it can be stored in a container.  It was produced by an unfortunate-fortunate accident involving booze cooking.  In order not to vermin up the tavern it will otherwise spend the next couple of months sitting in the trade depot until, hopefully, a caravan arrives but that solution is far from ideal.)

Did a bit of searching: it looks like DF's base "item" class actually has a splitStack() virtual method (I didn't know this until now), which means that DFHack can call it too. It returns the new item, and reduces the stack size of the existing item. Here is the only use of it that I found, in C++. It looks like you would want to call categorize() too so that the new item gets inserted into the right vectors under world.items.

In Lua, this would translate as:
Code: [Select]
new_item = item:splitStack(stackSize, true)
if new_item then
    new_item:categorize(true)
end
(I'm not sure what "true" means for either, or whether stackSize is the number of items in the new or the old stack, so you'll probably need to experiment.)

Fantastic.  :)  I figured DF was able to do this natively by observing how food tasked for eating was split from the stack before a dwarf collected it, but never would have found the C++ function, or been able to convert it to lua myself.  This is what I came up with:

Spoiler (click to show/hide)

I'm not a coder so I just cobbled together some bits and piece from other scripts until it worked 'well enough' for the case I wanted.  It works okay (as far as I can tell) for food items, and can even multiply raw mussels  ;) but testing other materials shows strange behaviour, bones copy regardless of stack size supplied rather than split (splitstack 5 on cat bone [4] produces another stack of cat bone [4]), and thread and cloth can be 'split' into stacks of multiple items.  No doubt someone who actually knows what they are doing could sanitise it.

To answer your one of your questions, the stackSize variable is the new stack (I'm pretty sure/as far as I can tell) and it inherits the properties of the original stack (e.g. forbidden status).

(It would be relatively easy to limit the behaviour to only splitting by checking if the stack was of sufficient size but sorting out the material variability would be for me much more time than I am willing to dedicate.)
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.47.05-r1
« Reply #2846 on: March 10, 2021, 09:24:46 am »

In Lua, this would translate as:
Code: [Select]
new_item = item:splitStack(stackSize, true)
if new_item then
    new_item:categorize(true)
end
(I'm not sure what "true" means for either, or whether stackSize is the number of items in the new or the old stack, so you'll probably need to experiment.)
If you look in df-structures, the 2nd parameter of "splitStack" is named "preserve_containment", and it controls whether the newly-split stack will be placed in the world in the same location as its parent item (i.e. if you set it to false then you need to explicitly place it in the world, just like the "createitem" plugin does).
Similarly, the paramter for "categorize" is named "in_play", and it controls whether or not the item gets added to world.items.other[IN_PLAY].

As for the "stackSize" parameter, disassembly indicates that it's the number of items you get in the new stack.
« Last Edit: March 10, 2021, 09:35:23 am by Quietust »
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.

HungThir

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2847 on: March 10, 2021, 10:41:19 pm »

from my understanding you can put stuff on tables in adv camps to prevent scatter but also like adv camps don't really scatter stuff... outside of books and artifacts which bypass the item placement unless you place them on a table or pedestal.

ohh, that's really helpful, thanks.  i had made a bookcase and placed it in a room (with advfort), but was unable to [p]ut my books into it, so i just dropped them onto the same tile's, and then they were scattered when i came back from a walk.  i usually keep food/items/etc in camps in containers, not just on the floor, and so when those don't scatter i had assumed it was because they were contained, not because only books/artifacts scatter.  so that's one detail now understood.  and it hadn't occurred to me that tables were useful, but i'll start building them from now on.  thanks!
Logged

Quantum Drop

  • Bay Watcher
  • Deep Sixed.
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2848 on: March 11, 2021, 05:49:58 am »

Having used advfort to build a smelter in adventure mode, I attempted to select the 'melt a metal item' option in the workshop menu. Despite having both fuel (coal) and a metal item (several candy bolts and coins; also tested with an iron sword) to melt, this did not seem to do anything (no reagents-products screen; the menu just vanished after I selected it and pressed enter). Am I doing something wrong here, and if so, does anyone know what to do with it?
« Last Edit: March 11, 2021, 12:40:17 pm by Quantum Drop »
Logged
I am ambushed by humans, and for a change, they do not drop dead immediately. I bash the master with my ladle, and he is propelled away. While in mid-air, he dies of old age.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r1
« Reply #2849 on: March 11, 2021, 07:32:31 pm »

the menu just vanished after I selected it and pressed enter
Sounds like a possible script error. Is there any red text printed to the DFHack console when this happens? If so, could you paste it here?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.
Pages: 1 ... 188 189 [190] 191 192 ... 243