Skip to content

Add zprospectanalyzer #1465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

unboundlopez
Copy link

@unboundlopez unboundlopez commented Jun 12, 2025

zprospectanalyzer
Goal: Filter and print stones that are worth 3 points.

Features
Output Parsing: Automatically runs prospect all and parses the text output.

Section Filtering: Optionally filters materials by specific sections like ores or gems.

Presets: Running zprospectanalyzer without parameters will only run the preset of 3-point stones.

Missing Materials Reporting: Displays next to any requested material that doesn't appear in the output.

Usage
zprospectanalyzer [material1] [material2] ...
zprospectanalyzer claystone granite ruby tetrahedrite

@unboundlopez
Copy link
Author

pre-commit.ci autofix

@unboundlopez unboundlopez changed the title Add zprospectanalyzer script and documentation Add zprospectanalyzer Jun 12, 2025
if #args == 0 then args = { "blocks" } end
local presets = {
blocks = {
"Alabaster", "Alunite", "Andesite", "Anhydrite", "Basalt",
Copy link
Member

@quietust quietust Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be hardcoding - it should fetch the actual stone IDs from the current world's inorganic material definitions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized I didn’t put the initial purpose of the program. The goal is to output stone that is worth 3 points in the embark shop menu.

I’ll review the program today. I can clean it up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no guarantee even that any of those stones exist in any given world, or if they do that they're worth 3 points in the embark menu. For that you need to pull the material definitions out of the world

DFHack tools should, to the extent practical, work even with radically modified raws

Copy link
Author

@unboundlopez unboundlopez Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yesterday I tried looking for the skill point value of items and failed. I don’t like the way I’m doing it now but can’t seem to find way to achieve a preset of blocks worth 3 points. I’ll try searching again today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should (a) make the target value or values a script argument (what exactly is magical about 3 points?)
and (b) use the material definitions in the game to identify which minerals qualify

i'm restating this to add it here as a review blocker


local zprospectanalyzer = {}

--- Scans the world using the `prospect` command and returns a table of materials.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of running the prospect command and grubbing through its output, you should add (or requested added) an API to the prospect plugin that will return the requested data

scraping is always a fragile approach and creates undocumented dependencies - if someone later changes the prospect tool's output, even in the slightest way, this tool will break

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't thought about prospect updating.

I haven't been able to figure out where the block point values are defined, and I haven’t had any luck locating them in gui/gm-editor either. What’s special about 3-point blocks? It’s helpful to know on the embark screen which blocks are worth 3 points, so I (the user) can make informed decisions and aim for a consistent material when making rock blocks. I usually bring around 180 stones to turn into blocks, so it's frustrating to start a large project with, say, rock salt, only to discover that chert is more abundant and at a higher tighter elevation.

I do want to switch to using the actual stone IDs in my presets, but without first uncovering where the point values are defined, I can't justify moving away from using the names.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope you're able to test what I'm referring to. If you run prospect, it takes a while to make an informed decision about which stones to bring. But if you run my program, you can significantly cut down the time needed to decide.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to search for the point values of items anymore. I feel I've exhausted all avenues through gui/gm-editor and using lua.

if #args == 0 then args = { "blocks" } end
local presets = {
blocks = {
"Alabaster", "Alunite", "Andesite", "Anhydrite", "Basalt",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should (a) make the target value or values a script argument (what exactly is magical about 3 points?)
and (b) use the material definitions in the game to identify which minerals qualify

i'm restating this to add it here as a review blocker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants