Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Removing All the Trader Flags  (Read 3041 times)

Leonidas

  • Bay Watcher
    • View Profile
Removing All the Trader Flags
« on: July 04, 2020, 08:08:43 pm »

DFHack's gui/gm-editor will remove the trader flag one item at a time. The Librarian Script is a more efficient option for books. I'm wondering if there's anything faster, like a script that'll set the trader flag to false on every item in the fortress.

Here's why I need it:

1) Some adventurers acquired a couple hundred books from a local library and a necromancer tower. They're considering acquiring a couple thousand more from other libraries and towers. They've been depositing these books into a retired fortress that is destined to be the great library of its age. But on that fort's unretirement, it turned out that many of these books had been marked with the trader flag. I figure it's like a sticker that says "Property of the Snarlingsummer Public Library".

2) I've also had the situation where a caravan gets spooked and dumps many dozens of items, which become unmovable. Picking through those with gui/gm-editor would be slow and tedious.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Removing All the Trader Flags
« Reply #1 on: July 05, 2020, 05:16:41 am »

Assuming you're somewhat knowledgeable about DFHack scripts, here's a script I use monthly:
Spoiler (click to show/hide)
It does report the status of a number of things and removes the Trader flag from scrolls on the ground (specifically), to claim the scrolls dropped when visitors die (of old age when entering and realizing they're past their expiration date, killed by invaders, visitors dying [typically of old age] in the cavern, etc.
Logged

Leonidas

  • Bay Watcher
    • View Profile
Re: Removing All the Trader Flags
« Reply #2 on: July 05, 2020, 10:02:34 am »

This is the sort of base that I was hoping for. Thanks, Patrik!
Logged

Leonidas

  • Bay Watcher
    • View Profile
Re: Removing All the Trader Flags
« Reply #3 on: August 05, 2020, 01:20:44 am »

I stripped that script down to something very simple to just flush the trader flag off every item on the map.
Spoiler (click to show/hide)
Logged

Kuria

  • Bay Watcher
    • View Profile
Re: Removing All the Trader Flags
« Reply #4 on: August 04, 2023, 09:40:05 am »

This is exactly what I'm looking for in a reclaim embark. It seems like a lot of discovered items are ignored and I'm wondering if it's the trader flag. Can I just put this script in a .lua file and drop it in the scripts folder? Is the filename the script activation command in DFHack? (Sorry for the necro, I couldn't find anything else that does this one thing.)
Logged

myk

  • Bay Watcher
    • View Profile
Re: Removing All the Trader Flags
« Reply #5 on: August 05, 2023, 02:21:15 am »

gui/autodump has an option to clear the trader flag from teleported items, but the script in this thread will do it without moving the items.

You can copy the text of that script into a file called dfhack-config/scripts/clear-trader.lua and invoke it by running clear-trader from gui/launcher.
Logged