Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack script to delete cave spider webs?  (Read 1965 times)

DwarfStar

  • Bay Watcher
    • View Profile
DFHack script to delete cave spider webs?
« on: April 28, 2021, 11:53:02 pm »

I have over 30k cave spider webs in my caverns, which is so many that my stocks screen hangs for several seconds every time I scroll past the Thread category. Any advice is welcome, really...maybe I should flood the caverns with magma...? Collecting them, just to dump them in magma, would take my dwarves years.

But I was specifically hoping someone had a script for DFHack that would just delete then all. Or, if it's relatively easy and someone could point me to the general functions I'd need, I can try to create it myself. I'd also be interested in opinions about whether it's actually possible/practical to do this with a script.
Logged

Ulfarr

  • Bay Watcher
  • Going on a pilgrimage to Mars
    • View Profile
Re: DFHack script to delete cave spider webs?
« Reply #1 on: April 29, 2021, 01:38:18 am »

I would advise against dumping magma over them. The fps drop from having a cavern on fire was too much, at least for my computer, and it also led to lots of pauses due to collapsing mushrooms.

You might be able to destroy the webs with DFHack's autodump script or the clean script, though I'm not sure if they affect webs. Alternatively you could try having a unit (pet, military, etc) walk over them which destroyes them.
Logged
Bring Kobold Kamp to LNP! graphics compatibility fix.

So the conclusion I'm getting here is that we use QSPs because dwarves can't pilot submarines.

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack script to delete cave spider webs?
« Reply #2 on: April 29, 2021, 07:18:22 am »

Here you go:

Code: [Select]
for i = #df.global.world.items.other.ANY_WEBS-1, 0, -1 do
  dfhack.items.remove(df.global.world.items.other.ANY_WEBS[i])
end

Paste this into a text editor, save it as a .lua file in the hack\scripts folder, and run from the DFHack console by entering the file name as a command.

The fps drop from having a cavern on fire was too much, at least for my computer, and it also led to lots of pauses due to collapsing mushrooms.

Just in case you're unaware, entering "extinguish -all" in the DFHack console will instantly put out all fires across the map, which should resolve the fps issue and stop trees from degrading further. See the documentation here.
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. 

Ulfarr

  • Bay Watcher
  • Going on a pilgrimage to Mars
    • View Profile
Re: DFHack script to delete cave spider webs?
« Reply #3 on: April 29, 2021, 10:36:48 am »

I didn't know about the extiguish script. Thanks AC  :)
Logged
Bring Kobold Kamp to LNP! graphics compatibility fix.

So the conclusion I'm getting here is that we use QSPs because dwarves can't pilot submarines.

DwarfStar

  • Bay Watcher
    • View Profile
Re: DFHack script to delete cave spider webs?
« Reply #4 on: April 29, 2021, 06:46:03 pm »

Hooray that worked! If someone that maintains DFHack is reading this, may I suggest this script might be useful enough to include in the standard distribution.

My favorite kind of DFHacks are the ones that primarily fix bugs in the game, and it's got to be considered a bug that the stocks screen hangs for five seconds every time you scroll thru, while it counts up 30k cave spider webs.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack script to delete cave spider webs?
« Reply #5 on: July 04, 2021, 08:56:47 pm »

If someone that maintains DFHack is reading this, may I suggest this script might be useful enough to include in the standard distribution.
Looks like I ran across this thread after a couple months. In the future, it's best to report things like this to us directly at one of these places: https://docs.dfhack.org/en/latest/docs/Support.html

Atomic Chicken implemented this here, so it'll be in the next release: https://github.com/DFHack/scripts/pull/285
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.