Veracity's Garden Harvester

Veracity

Developer
Staff member
I detected it myself when I saw it was not harvesting a colossal free-range mushroom, even though it had previously done that with no problems.
 

taltamir

Member
Revision 237 adds support for Your Mushroom Garden.

Along with all the other garden crops, you can include one of the following crops for that garden:

free-range mushroom
plump free-range mushroom
bulky free-range mushroom
giant free-range mushroom
immense free-range mushroom
colossal free-range mushroom

If you have the appropriate mushroom in your garden, it will fight through piranha plans (using "garden pick") and pick it.
If you have a lesser mushroom in your garden, it will fight through piranha plants (using "garden fertilize") and fertilize it.

The built-in "garden" command does all the work: pre-fight restoration, combat using your chosen battle action (or CCS), between battle script, and so on.
It works like a charm if you've been visiting Your Mushroom Garden via KoLmafia and therefore know the actual state of your garden.
If not, you may be farther along than KoLmafia knows. I suppose I could reproduce that logic and pick if you are actually at the desired goal.
But sans that, KoLmafia will synch up when it sees The Mushy Center, so you'll be good to go tomorrow.
A thing to note on mushroom garden is that it has a completely separate counter. one that does not reset when changing gardens.

So if you own mushroom + beer and want to be growing mushroom. you can do the following:
harvest 1 day from beer
switch to mushroom
fertilize mushroom
switch to beer
rollover
harvest 1 day from beer
switch to mushroom
fertilize mushroom
switch to beer
rollover

It does not work in the reverse though. The regular gardens like beer do lose their growth when you switch gardens.
 

Magus_Prime

Well-known member
I just wanted to say that the addition of handling for the mushroom garden is very much appreciated.
 
Last edited:

Veracity

Developer
Staff member
Today I migrated this from sourceforge using SVN to github using GIT.
Future updates (like the rock garden) will be pushed only to the latter.

I suggest you delete the SVN version (make sure you have KoLmafia r27304!) and then install it via GIT:

Code:
git checkout Veracity0/garden
 

Veracity

Developer
Staff member
Done.

Revision #3:

Add support for the Rock Garden.

This has 3 different plots, which are configured individually.
Code:
// Rock Garden (plot 1)
//    "groveling gravel"                day 1: 1 groveling gravel
//    "2 groveling gravel"              day 2: 2 handfuls of groveling gravel
//    "3 groveling gravel"              day 3: 3 handfuls of groveling gravel
//    "fruity pebble"                   day 4: 1 fruity pebble
//    "2 fruity pebbles"                day 5: 2 fruity pebbles
//    "3 fruity pebbles"                day 6: 3 fruity pebbles
//    "lodestone"                       day 7+: lodestone
// Rock Garden (plot 2)
//    "milestone"                       day 1: 1 milestone
//    "2 milestones"                    day 2: 2 milestones
//    "3 milestones"                    day 3: 3 milestones
//    "bolder boulder"                  day 4: 1 bolder boulder
//    "2 bolder boulders"               day 5: 2 bolder boulders
//    "3 bolder boulders"               day 6: 3 bolder boulders
//    "molehill mountain"               day 7+: molehill mountain
// Rock Garden (plot 3)
//    "whet stone"                      day 1: 1 whet stone
//    "2 whet stones"                   day 2: 2 whet stones
//    "3 whet stones"                   day 3: 3 whet stones
//    "hard rock"                       day 4: 1 hard rocks
//    "2 hard rocks"                    day 5: 2 hard rocks
//    "3 hard rocks"                    day 6: 3 hard rocks
//    "strange stalagmite"              day 7+: strange stalagmite
As always, specify your desired crops in VGH.GardenCrops.

A setting that will harvest all the normal aftercore crops:
Code:
set VGH.GardenCrops="pumpkin|peppermint sprout|skeleton|3 beer labels|frost flower|15 cornucopias|very tall grass|colossal free-range mushroom|lodestone|molehill mountain|strange stalagmite"
 

GwynMyrddin

New member
Done.

Revision #3:

Add support for the Rock Garden.

This has 3 different plots, which are configured individually.
Code:
// Rock Garden (plot 1)
//    "groveling gravel"                day 1: 1 groveling gravel
//    "2 groveling gravel"              day 2: 2 handfuls of groveling gravel
//    "3 groveling gravel"              day 3: 3 handfuls of groveling gravel
//    "fruity pebble"                   day 4: 1 fruity pebble
//    "2 fruity pebbles"                day 5: 2 fruity pebbles
//    "3 fruity pebbles"                day 6: 3 fruity pebbles
//    "lodestone"                       day 7+: lodestone
// Rock Garden (plot 2)
//    "milestone"                       day 1: 1 milestone
//    "2 milestones"                    day 2: 2 milestones
//    "3 milestones"                    day 3: 3 milestones
//    "bolder boulder"                  day 4: 1 bolder boulder
//    "2 bolder boulders"               day 5: 2 bolder boulders
//    "3 bolder boulders"               day 6: 3 bolder boulders
//    "molehill mountain"               day 7+: molehill mountain
// Rock Garden (plot 3)
//    "whet stone"                      day 1: 1 whet stone
//    "2 whet stones"                   day 2: 2 whet stones
//    "3 whet stones"                   day 3: 3 whet stones
//    "hard rock"                       day 4: 1 hard rocks
//    "2 hard rocks"                    day 5: 2 hard rocks
//    "3 hard rocks"                    day 6: 3 hard rocks
//    "strange stalagmite"              day 7+: strange stalagmite
As always, specify your desired crops in VGH.GardenCrops.

A setting that will harvest all the normal aftercore crops:
Code:
set VGH.GardenCrops="pumpkin|peppermint sprout|skeleton|3 beer labels|frost flower|15 cornucopias|very tall grass|colossal free-range mushroom|lodestone|molehill mountain|strange stalagmite"


Thank you!!
 

AlbinoRhino

Active member
Veracity, I noticed yesterday that now that the script's name is "Garden Harvester.ash" that typing that into the CLI will fail (I believe due to the 'garden' cli command only accepting 'pick' as a parameter)...the failure is silent and of course I at first assumed the script wasn't working. After trying 'call Garden Harvester.ash' and the script worked fine, I realized what was going on. Just thought I'd let you know in case anyone else uses the cli and thinks the script isn't working.
 

adeyke

Member
I noticed that the script sees my ginormous pumpkin (house) as a ginormous pumpkin (crop) and thus thinks it's harvest time. I actually have a rock garden.
 

Veracity

Developer
Staff member
Huh. I wonder if it does that with a Giant Pilgrim Hat or a Mushroom House, too?
I wonder if this is a KoLmafia issue or just a Garden Harvester issue.

1) What does it it say if you type "garden" in gCLI? (i.e., KoLmafia's command to report on your garden.)
2) I won't be able to work on this until I get home in a couple weeks, but if you could post a DEBUG log of visiting your campsite, it will make it easier to write tests.

I have multis with no gardens at all, and I should be able to test some things on my own.

Thanks for the report.
 

adeyke

Member
I think it's specific to the pumpkin. For other two, there's a harvestable item that, when used, gives you the housing item (in one as a drop from a fight). It's only with the pumpkin that the housing item is harvested directly.

I suppose it is a KoLmafia issue in the sense that the output of get_campground() is ambiguous, but I don't see an obvious solution that wouldn't break things. My campground does have a ginormous pumpkin in it, and that's getting accurately reported.

I have the garden harvester in by login script. When I ran my turns earlier today, it harvested the tier 1 items. I started KoLmafia again for the purpose of this post, and it tried to harvest but got nothing.

The output of "garden" output is currently:
Your rock garden has nothing in it.

get_campground() says:
Returned: aggregate int [item]
meat golem => 1
spooky scarecrow => 1
Certificate of Participation => 1
Dramatic™ range => 1
Queue Du Coq cocktailcrafting kit => 1
chef-in-the-box => 1
bartender-in-the-box => 1
pagoda plans => 1
clockwork maid => 1
Discount Telescope Warehouse gift certificate => 7
ginormous pumpkin => 1
saltwaterbed => 1
tin roof (rusted) => 1
potted tea tree => 1
haunted doghouse => 1
Witchess Set => 1
Source terminal => 1
model train set => 1
packet of rock seeds => 0
groveling gravel => 0
milestone => 0
whet stone => 0

And I've attached the debug log.
 

Attachments

  • DEBUG_20230503.txt
    14.2 KB · Views: 1

Veracity

Developer
Staff member
Your campground has:

/otherimages/campground/resta.gif

The "resta" means your dwelling is the Ginormous Pumpkin
KoLmafia puts a ginormous pumpkin into get_campground()

Since you have a rock garden, it also has:

/otherimages/rockgarden/a0.gif
/otherimages/rockgarden/b0.gif
/otherimages/rockgarden/b0.gif

Indicating you have a rock garden with 3 empty plots.
KoLmafia puts a packet of rock seeds (0) into my_campground()
The (0) means all of the plots are empty. If it were (1), at least once patch has something.
KoLmafia also puts groveling gravel (0), milestone (0), and whetstone (0) into my_campground

If you had a pumpkin patch, my_campground() would contain packet of pumpkin seeds (X), X = 5 if ginormous pumpkin.

So, basically, the seed packet indicates which garden you have and the count indicates the progress.
Apparently this script is looking for ginormous pumpkin directly.

Should be fixable.

More on the ambiguity:
ginormous pumpkin (1) + packet of pumpkin seeds (5) => you have the crop
ginormous pumpkin (1) + (any other seed packet) => you have the dwelling
ginormous pumpkin (2) + packet of pumpkin seeds (5) -> you have both?

That MIGHT be how it works. If so, that would be extra work for a script that wants to see which dwelling you have.
I don't see a solution in KoLmafia itself.
 

Veracity

Developer
Staff member
Yeah.

get_dwelling: ginormous pumpkin
get_campground: packet of pumpkin seeds (5) & ginormous pumpkin

get_dwelling: giant pilgrim hat
get_campground: packet of thanksgarden seeds (7) & megacopia

get_dwelling: house sized mushroom
get_campgroun: packet of mushroom spores (11) & colossal free range mushroom

Scripts concerned with dwelling use get_dwelling.
Scripts concerned with gardens can use get_campground and the seed packets.
 

adeyke

Member
The seeds will be at 11 for ginormous pumpkin, not 5 (that's just a huge pumpkin, referred to as giant in the image name).

Also, I think if you have both, the get_campground() count for ginormous pumpkin will still just be 1, since KoLmafia treats dwellings differently from other campground stuff.

I've decided to plant the pumpkin seeds and disable the garden script, so in 11 days, I'll be able to confirm what the behavior there is.
 

Veracity

Developer
Staff member
Revision 4:

In order to fix the ginormous pumpkin problem, I needed to refactor this script.

Previous structure:

1) Validate properties: learn what to harvest from each kind of garden.
2) Take one pass through get_campground()
- If it is a "crop", check what we configured to do for that kind of garden
- If your bone garden has a skulldozer, fight it if so-configered
- If should harvest this crop:
-- (optional/configurable fertilization, for grass patches)
-- harvest entire garden - unless rock garden - and stop loop
-- harvest single plot - if rock garden - continue to look for more crops
- If should not harvest this crop:
-- (fertilize mushroom garden)
-- done!

New structure:

1) Validate properties: learn what to harvest from each kind of garden.
2) Take one pass through get_campground()
- If we see "seeds", save item/count to identify garden type + progression
- If we see "crops", save item/count in a map (rock gardens can have three crops)
-- exception: do not save ginormous pumpkin as a "crop"
2a) If "seeds" are "pumpkin" and progression is 11+ days, save ginormous pumpkin as crop.
3) If you don't have a garden, say so and punt.
4) Based on "seeds" and "crops", see if we need to harvest anything. If not:
- (fertilize mushroom garden)
- done!
5) If we have crops to harvest:
- If skulldozer, fight it
- If grass patch, pre-fertilize, harvest, post-fertilize/harvest, as configured
- If no "plots", harvest all
- If "plots" - harvest plots one at a time
-- done!

I have tested with a Peppermint Patch:

Code:
> call Garden Harvester.ash

Your Peppermint Patch has 3 peppermint sprouts in it.
You want to harvest peppermint sprout
It's time to harvest!

Harvesting your garden
You acquire peppermint sprout (3)

immediately followed by:

Code:
> call Garden Harvester.ash

Your Peppermint Patch has 0 peppermint sprouts in it.
You want to harvest peppermint sprout
Let it grow some more.

I have tested with a Mushroom Garden

Code:
> call Garden Harvester.ash
Your Mushroom Garden has 1 immense free-range mushroom in it.
You want to harvest colossal free-range mushroom
Let's fertilize your mushroom so it will grow.

[37791] Your Mushroom Garden
Encounter: piranha plant
Round 0: Veracity wins initiative!
...
This combat did not cost a turn

[37791] Your Mushroom Garden
Encounter: The Mushy Center
Took choice 1410/1: Fertilize the mushroom
choice.php?whichchoice=1410&option=1&pwd
Let it grow some more.

And the next day:

Code:
> call Garden Harvester.ash

Your Mushroom Garden has 1 colossal free-range mushroom in it.
You want to harvest colossal free-range mushroom
It's time to harvest!

[38239] Your Mushroom Garden
Encounter: piranha plant
Round 0: Veracity wins initiative!
...
This combat did not cost a turn

[38239] Your Mushroom Garden
Encounter: The Mushy Center
Took choice 1410/2: Pick the mushroom
choice.php?whichchoice=1410&option=2&pwd
You acquire an item: colossal free-range mushroom

I have tested with a Rock Garden.

Today, on day 2:

Code:
> call Garden Harvester.ash

Your Rock Garden plot 1 has 2 handfuls of groveling gravel in it.
You want to harvest 2 groveling gravel
Your Rock Garden plot 2 has 2 milestones in it.
You want to harvest 3 bolder boulders
Let it grow some more.
Your Rock Garden plot 3 has 1 whet stone in it.
You want to harvest whet stone
It's time to harvest plot1!
Harvesting plot1: groveling gravel (2)
You acquire groveling gravel (2)
It's time to harvest plot3!
Harvesting plot3: whet stone
You acquire an item: whet stone

immediately followed by:

Code:
> call Garden Harvester.ash

Your Rock Garden plot 1 has 0 handfuls of groveling gravel in it.
You want to harvest 2 groveling gravel
Let it grow some more.
Your Rock Garden plot 2 has 2 milestones in it.
You want to harvest 3 bolder boulders
Let it grow some more.
Your Rock Garden plot 3 has 0 whet stones in it.
You want to harvest whet stone
Let it grow some more.

I'd still like to test (myself, or with your help. ;))

- grass patch
- bone garden with and without skulldozer

Those were the only other gardens that have special handling at harvest time.

And, I suppose:

- pumpkin garden with/without pumpkin house with/without ginormous pumpkin

I may have time to test the grass patch this week, before I dive into my six Legacy of Loathing runs to (finally) collect factoids next week.
Other testing will have to wait until later.

I'm releasing this now so that you-all can try it out now for a few days before I make another release in a few days: I'm going to rename it from "Garden Harvester" to "GardenHarvester".
- No need to "call Garden Harvester"; you can now use "GardenHarvester" without clashing with KoLmafia's built-in "garden" command.
- This will allow me to have optional command-line parameters, should I so desire. I have no specific ideas, yet, but it'd be nice to have the option.
- I will need to make a VMF release at the same time to use the new script name.

I'll be interested to see how git handles this. If you have local changes, will it rename that file in your local repository and then merge? How about in the "scripts directory"? Will you end up with both the old and new names?
 

fronobulax

Developer
Staff member
I have only a bone garden. I don't do anything with it but wait for and fight the skulldozer. At some point I set parameters so that VMF would do that for me. If you want me to do something different in order to test these changes just let me know.
 

Veracity

Developer
Staff member
Just tell me if fighting the skulldozer works as before.
I expect it will, but if not, we can fix it.

Harvesting skeltons (before they merge into a skulldozer) should work like any other normal garden, so I don't need any special testing for that.

Ooh. I see a bug with the bone garden...
 

adeyke

Member
I can report that it's successfully allowing my rock garden to grow, despite my ginormous pumpkin dwelling.
 
Top