Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: DFHack script: The Librarian  (Read 2324 times)

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack script: The Librarian
« Reply #15 on: May 24, 2018, 01:38:36 am »

Why are the directories in that report switching between '/' and '\'?
Logged
THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. Was this inevitable (Y/y)?

Rafatio

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #16 on: July 11, 2018, 07:09:22 pm »

Midgame this script suddenly stopped working for me. There aren't many books yet, so I only used it once before on this fortress, worked fine just like on the previous one. Is this actually a librarian problem or should I be worried about my creatures doing things out of bounds?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #17 on: July 12, 2018, 03:29:19 am »

Thanks for the error report.
Looking at the error text, I see that the index is -1, which DF uses as a null value. From other cases, creatures can be considered to be of an unknown race when they have been considered unimportant historical figures, and thus have been removed from the game (there's a world gen switch for this).
Thus, it looks like the script needs to be updated to handle the case of unknown races. I'll be back with an updated version shortly.

Edit: I've modified the script and uploaded it to Github (the link in the first post), but I can't test it since I don't have your situation.
« Last Edit: July 12, 2018, 03:41:49 am by PatrikLundell »
Logged

Rafatio

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #18 on: July 12, 2018, 05:41:32 am »

Thanks for the speedy fix, it's working again.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #19 on: July 12, 2018, 05:59:57 am »

Thanks for testing and reporting back.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack script: The Librarian
« Reply #20 on: July 12, 2018, 08:55:03 am »

Does the script open a UI ingame, a pop-up?

If yes, I could easily supply a little workshop, so that a dwarf can trigger it. Player builds the "Librarian's Office", dwarf "read up on current collection" and the script runs.

I did something similar for the script that opens legends mode.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #21 on: July 12, 2018, 09:31:12 am »

Does the script open a UI ingame, a pop-up?

If yes, I could easily supply a little workshop, so that a dwarf can trigger it. Player builds the "Librarian's Office", dwarf "read up on current collection" and the script runs.

I did something similar for the script that opens legends mode.
Try ;)

It opens a view on top of DF in the same basic way gui/gm-editor does, so it's a lot larger than a single pop-up window.
If you want to create such a custom workshop you're very welcome to do so, although personally I wouldn't like to wait for it to appear, but I'm not that great on the role playing aspect.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack script: The Librarian
« Reply #22 on: July 12, 2018, 01:29:39 pm »

Reactions:
Code: [Select]
[OBJECT:REACTION]

[REACTION:LIBRARIAN]
[NAME:Read the book index]
[BUILDING:LIBRARIANS_OFFICE:CUSTOM_B]

[REACTION:OPEN_LEGENDS]
[NAME:Read the legends of this world]
[BUILDING:LIBRARIANS_OFFICE:CUSTOM_L]

Onload.init:
Code: [Select]
#librarians office
modtools/reaction-trigger -reactionName OPEN_LEGENDS -command [ open-legends ]
modtools/reaction-trigger -reactionName LIBRARIAN -command [ librarian ]

entity additions:
Code: [Select]
[PERMITTED_BUILDING:LIBRARIANS_OFFICE]
[PERMITTED_REACTION:OPEN_LEGENDS]
[PERMITTED_REACTION:LIBRARIAN]

workshop:
Code: [Select]
building_librarian

[OBJECT:BUILDING]

[BUILDING_WORKSHOP:LIBRARIANS_OFFICE]
[NAME:Librarian's office]
[NAME_COLOR:7:0:1]
[BUILD_LABOR:ARCHITECT]
[BUILD_KEY:CUSTOM_SHIFT_G]
[DIM:3:3]
[WORK_LOCATION:2:2]
[BLOCK:1:0:0:0]
[BLOCK:2:0:0:0]
[BLOCK:3:0:0:0]
[TILE:0:1:32:32:234]
[TILE:0:2:32:227:32]
[TILE:0:3:32:43:32]
[COLOR:0:1:0:0:0:0:0:0:6:0:1]
[COLOR:0:2:0:0:0:7:0:1:0:0:0]
[COLOR:0:3:0:0:0:7:0:0:0:0:0]
[TILE:1:1:32:32:234]
[TILE:1:2:32:227:43]
[TILE:1:3:234:43:32]
[COLOR:1:1:0:0:0:0:0:0:6:0:1]
[COLOR:1:2:0:0:0:7:0:1:7:0:0]
[COLOR:1:3:6:0:1:7:0:0:0:0:0]
[TILE:2:1:234:32:234]
[TILE:2:2:43:227:43]
[TILE:2:3:32:43:234]
[COLOR:2:1:6:0:1:0:0:0:6:0:1]
[COLOR:2:2:7:0:0:7:0:1:7:0:0]
[COLOR:2:3:0:0:0:7:0:0:6:0:1]
[TILE:3:1:234:43:234]
[TILE:3:2:43:227:43]
[TILE:3:3:234:43:234]
[COLOR:3:1:6:0:1:7:0:0:6:0:1]
[COLOR:3:2:7:0:0:7:0:1:7:0:0]
[COLOR:3:3:6:0:1:7:0:0:6:0:1]
[BUILD_ITEM:4:STATUE:NONE:NONE:NONE][CAN_USE_ARTIFACT]
[BUILD_ITEM:1:CABINET:NONE:NONE:NONE][CAN_USE_ARTIFACT]

That's it. A little librarians office that either opens the librarian script, looking at all the books; or runs open-legends and you can read through that. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #23 on: July 13, 2018, 03:20:54 am »

I added a link to your post to the first page.
Logged

Rafatio

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #24 on: July 14, 2018, 10:25:06 am »

I have another error, this time it's not fatal, librarian seems to work fine for what I'm doing (browse the values page to find books to forbid), but when I check back to the dfhack window later, there often is all this error text. Same fort, still playing 44.10, as unmodded as I get to claim in this subforum.
Spoiler (click to show/hide)
Always these three repeats together if it happens, but sometimes there are no errors. No idea what makes the difference.
« Last Edit: July 14, 2018, 11:07:36 am by Rafatio »
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #25 on: July 14, 2018, 11:51:04 am »

Thanks for the report. I've been able to replicate the bug and fix it. It's caused by line 2635 using "- 1" rather than "- 4", so it's trying to reference a value strength that doesn't exist (they run from -3 to 3, but indices go from 1 to 7). I've fixed it and uploaded the script to the repo.
Logged

Rafatio

  • Bay Watcher
    • View Profile
Re: DFHack script: The Librarian
« Reply #26 on: July 14, 2018, 01:22:31 pm »

You're fixing these faster than I can save and reload, no red text anymore.
Logged
Pages: 1 [2]