Veracity's Garden Harvester

Veracity

Developer
If you have more than one type of garden available to you, perhaps you have noticed that "breakfast" doesn't handle that as well as you might wish. Sure, you can say "Harvest Anything" and it will pick whatever is available, no matter what type of garden you have, but many of the gardens are worth waiting some number of days before harvesting.

Unfortunately, "breakfast" will only let you specify that for exactly one garden at a time and if you switch gardens, you have to adjust your breakfast settings.

Until now. Here is a script that will let you specify what you want from all six garden types. It will detect your garden type from the crop, will compare against what you want for that type of garden, and will harvest when appropriate.

You configure it with a single property - VGH.GardenCrops. Here is the documentation:

Code:
// ***************************
//       Configuration       *
// ***************************

// Pumpkin Patch
//    "pumpkin"			days 1-4: 1 pumpkin per day
//    "huge pumpkin"		days 5-10: 1 huge pumpkin
//    "ginormous pumpkin"	day 11+: 1 ginormous pumpkin
// Peppermint Patch
//    "peppermint sprout"	days 1-4: 3 peppermint sprouts per day
//    "giant candy cane"	day 5+: 1 giant candy cane
// Bone Garden
//    "skeleton"		days 1-5: 5 skeletons per day
//				day 6+: fight with skulldozer
// Beer Garden
//    "barley"			days 1-7: 3 handfuls of barley and 3 clusters of hops per day
//    "beer label"		day 3: + 1 fancy beer bottle and 1 fancy beer label
//    "2 beer labels"		day 5: + 2 fancy beer bottles and 2 fancy beer labels
//    "3 beer labels"		day 7+: + 3 fancy beer bottles and 3 fancy beer labels
// Winter Garden
//    "ice harvest"		days 1-7: 3 ice harvests and 3 snow berries per day
//    "frost flower"		days 3-7+: + 1 frost flower
// Thanksgarden
//    "cornucopia"		day 1: 1 cornucopia
//    "3 cornucopias"		day 2: 3 cornucopias
//    "5 cornucopias"		day 3: 5 cornucopias
//    "8 cornucopias"		day 4: 8 cornucopias
//    "11 cornucopias"		day 5: 11 cornucopias
//    "15 cornucopias"		day 6: 15 cornucopias
//    "magacopia"		day 7+: 1 megacopia
//
// You may specify one crop from each kind of garden, separated by "|".
// If you specify no crops, picking your garden will be deferred to
// breakfast.
//
// A setting that will harvest all the normal crops:
//
// "pumpkin|peppermint sprout|skeleton|3 beer labels|frost flower|15 cornucopias"
//
// You don't have to specify crops for all types of garden. If you do
// not include crops from a particular garden, this script will not
// harvest that kind of garden.

boolean [string] garden_crops = define_property( "VGH.GardenCrops", "string", "pumpkin|peppermint sprout|skeleton|3 beer labels|frost flower|15 cornucopias", "set" ).to_set_of_string();
Get the script via SVN.

Code:
svn checkout https://svn.code.sf.net/p/veracity0/code/garden
 

Bale

Minion
Only a few months ago, scripting was a thing you almost never did despite being the principle architect of ASH scripting language. Now you're really getting into it with script after script. Is it interesting finally getting involved with the language which you've worked so hard to create? I've enjoyed your creation very much, so I'm happy to see you indulging.
 

Veracity

Developer
It's my primary contribution, these days. I leave it to lost and Darzil to handle New Content and I focus on Bugs - and, as somebody who is actually scripting, ASH features that I now realize are useful to ASH scripters.

Also part of the motivation my sequence of scripts is that I really do want to be able run all my multis by doing: log in, press script button 3, log out when it completes. In other words, cut my real-life time running my testing multis by a lot.

And, yes - ASH is a real programming language, and I am enjoying it a lot.
 

Veracity

Developer
Also keep in mind that my focus is The One (farming) Script to Rule Them All - and a lot of the intention is to publish code that people can pull out and use for their own purpose - but some of that is so big and (potentialy) useful on its own, that I trouble to make it available by itself.

Using my own coding standards and libraries and such.

I could probably do the same with some other VMF modules, but the ones I published individually (vprops, VGC, VGH) are especially big and/or complicated that I want to support them individually.
 

Veracity

Developer
Registry info:

Code:
{
  "repo": "https://svn.code.sf.net/p/veracity0/code/garden/", 
  "author": "Veracity", 
  "name": "Veracity's Garden Harvester", 
  "forumThread": "http://kolmafia.us/showthread.php?21651", 
  "shortDesc": "Harvest any kind of garden", 
  "category": "action", 
  "longDesc": "This script lets you configure what you want from all possible gardens and will detect garden type and pick the right thing."
 }
Bale, notice something I did there:

Code:
"forumThread": "http://kolmafia.us/showthread.php?21651"
rather than, for example "http://kolmafia.us/showthread.php?21651-Veracity-s-Garden-Harvester", which incorporates the title of the thread. Or, at least, a title the thread once had, since you can edit the title. Or the URL, for that matter; "http://kolmafia.us/showthread.php?21651-Any-Old-Garbage" brings you straight to this thread.

You could similarly trim all such "forumThread" URLS in the registery, should you care to.
 

Bale

Minion
I know how that stuff works on this forum. I just like it when the link has informative information in the title.

I'll add this to the repository.
 

Veracity

Developer
Revision 95 adds support for Tall Grass.

Available crops:

tall grass - harvest anything
very tall grass - wait until the 8th growth to get Very Tall Grass

The default in VGH.GardenCrops is "very tall grass", which seems like a common aftercore default.
In any case, it is the default, and you can change it as desired.

I'm considering adding a setting for in-run harvesting, since you MAY want to harvest every day - especially for the grass plot - or not wait for 15 cornucopias, or whatever. If I did that, I might consider using this script in-run; at the moment, I harvest manually - or forget to harvest.
 

Veracity

Developer
Revision 96 adds support for Pokegrow fertilizer.

boolean use_fertilizer = define_property( "VGH.FertilizeGrassPatch", "boolean", "false" ).to_boolean();

default is false, but if you do this:

set VGH.FertilizeGrassPatch=true

it will do this:

- If your desired crop is "very tall grass", if you have enough fertilizer in inventory to grow your grass patch to that state (day 8), it will do that before harvesting
- If your desired crop is "tall grass" - i.e., harvest every day - after harvesting your garden in whatever state it is in, it will use up your fertilizer (in batches of 7) and will harvest all the tufts of tall grass.

(In aftercore, I have switched from "very tall grass" to "tall grass" and I caught me a Mu by doing that.)
 

Magus_Prime

Active member
The latest addition to Grass Patch handling is very much appreciated. Using it caught me a Mu after weeks of trying.
 
Last edited:

Aramada

Member
This script looks amazing! I look forward to trying it out.

I did have a question - You say "You configure it with a single property - VGH.GardenCrops." What does that mean, exactly? To configure it, do I need to type VGH.GardenCrops into the Graphical CLI? Or is that a file that I need to find somewhere, like when you edit .ash files? Something else entirely?

Thanks for the time, I appreciate it!

~Aramada
 

Veracity

Developer
I will elaborate on this comment soon. I see that I need to update the initial instructions with stuff for the Grass garden.

To address your comment (without examples) you need to do this in the gCLI:

set VGH.GardenCrops=<string>

where <string> specifies what you want to do with each potential kind of garden.

I'll get back, by and by (I've been up since 5 AM this morning and am very tired), but if you tell me what kinds of gardens you have available, I'll include those specific gardens in my examples.
 

Aramada

Member
Awesome, thank you Veracity!

I actually have all of the gardens (go, go completionism!)

As someone who crashed Friday night at 6:30pm, and woke up at 10am Saturday morning, I feel ya on the tired front and hope you got some very restful and restorative sleep!

~Aramada
 

Veracity

Developer
Here's what I use:

Code:
[color=green]> get VGH.GardenCrops[/color]

15 cornucopias|3 beer labels|frost flower|peppermint sprout|pumpkin|skeleton|tall grass

[color=green]> get VGH.FertilizeGrassPatch[/color]

true
pumpkins -> 1 pumpkin (harvest every day; do not go for huge or ginormous pumpkin)
peppermint -> peppermint sprout (harvest every day; do not go for giant candy cane)
skeleton -> skeleton (harvest every day; do not fight skulldozer - which is not supported by this script)
beer -> 3 beer labels (harvest on day 7 to get 3 beer bottles and 3 beer labels)
winter ice -> frost flower (harvest on day 3 to get 9 ice harvests, 9 snow berries, and a frost flower)
thanksgarden -> 15 cornucopias (harvest on day 6 to get 15 cornucopias)
grass -> tall grass (harvest every day

With a grass garden you get fertilizer drops. I have the script use up any fertilizer when harvesting. It is smart about that; since I want tall grass, rather than very tall grass, it will use it in batches, if necessary, up to 7 patches, harvest, and then repeat.

Like all my scripts, there is a Configuration section at the top of the script:

Code:
// Pumpkin Patch
//    "pumpkin"			days 1-4: 1 pumpkin per day
//    "huge pumpkin"		days 5-10: 1 huge pumpkin
//    "ginormous pumpkin"	day 11+: 1 ginormous pumpkin
// Peppermint Patch
//    "peppermint sprout"	days 1-4: 3 peppermint sprouts per day
//    "giant candy cane"	day 5+: 1 giant candy cane
// Bone Garden
//    "skeleton"		days 1-5: 5 skeletons per day
//				day 6+: fight with skulldozer
// Beer Garden
//    "barley"			days 1-7: 3 handfuls of barley and 3 clusters of hops per day
//    "beer label"		day 3: + 1 fancy beer bottle and 1 fancy beer label
//    "2 beer labels"		day 5: + 2 fancy beer bottles and 2 fancy beer labels
//    "3 beer labels"		day 7+: + 3 fancy beer bottles and 3 fancy beer labels
// Winter Garden
//    "ice harvest"		days 1-7: 3 ice harvests and 3 snow berries per day
//    "frost flower"		days 3-7+: + 1 frost flower
// Thanksgarden
//    "cornucopia"		day 1: 1 cornucopia
//    "3 cornucopias"		day 2: 3 cornucopias
//    "5 cornucopias"		day 3: 5 cornucopias
//    "8 cornucopias"		day 4: 8 cornucopias
//    "11 cornucopias"		day 5: 11 cornucopias
//    "15 cornucopias"		day 6: 15 cornucopias
//    "magacopia"		day 7+: 1 megacopia
// Tall Grass Patch
//    "tall grass"              days 1-7: 1 patch of tall grass per day
//    "very tall grass"         days 8+: 1 patch of very tall grass
//
// You may specify one crop from each kind of garden, separated by "|".
 

Aramada

Member
Please forgive my need to have things spelled out.

So, if I understood correctly need to put in my CLI the following (because those are the settings I would like it to have):

set vgh.gardencrops=15 cornucopias|3 beer labels|frost flower|peppermint sprout|pumpkin|skeleton|tall grass

and then

set vgh.fertilizergrasspatch=true

Is that correct?

You mention there is a Configuration section at the top of the script, but I'm not sure how you view that. When I went to Scripts -> Script Manager and then right clicked on the script, the only options it gave me were to Delete, Update, Refresh Script List, or Open Forum Thread.

~Aramada
 

Veracity

Developer
Capitalization matters.

set VGH.GardenCrops=15 cornucopias|3 beer labels|frost flower|peppermint sprout|pumpkin|skeleton|tall grass
set VGH.FertilizeGrassPatch=true

To look at the script, you need to open it in a text editor. You can find the script in the "scripts" folder of your KoLmafia installation.
 

Aramada

Member
Ah! Didn't realize capitalization matters.

And oh, duh, yeah, it would be in the scripts folder wouldn't it? ::facepalm::

Thank you again Veracity!

~Aramada
 

Veracity

Developer
Revision 233 adds a feature and fixes a bug.

If you have a bone garden, in addition to (instead of) "skeleton", you can use "skulldozer". Garden Harvester will wait 6 days before harvesting. That leads to a fight, which we will automate using your CCS.

If you have a plot of tall grass, we will use Poke-gro fertilizer appropriately reach your desired harvesting: up to "very tall grass", or to increase the patches of mere "tall grass" to harvest. The bug I fixed is to NOT use Poke-gro fertilizer from inventory unless you have a grass garden.
 

Veracity

Developer
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.
 

AlbinoRhino

Active member
I was just looking at this and I don't see any discussion of this trick, though you may be aware of it.

With the Grass garden in place (and multiple seed packets) you can:
Fertilize the Grass garden.
Switch to any other crop and pick the day 1 crop of the new garden.
Switch back to Grass.
Repeat for as many fertilizers as you care to spend.

I tried using multiple fertilizers a little but still only got a single day 1 crop from each new garden...although I didn't experiment with multiple fertilizations very extensively.

My meat-farming code uses this to keep itself in Cornucopias for the Thanksgetting buff (since I have a ton of fertilizer lying around). Although now that there's a new garden I guess my supply is no longer being replenished.

Haven't tried it with the mushroom garden yet. I am doubting it will work since there are free fights involved. After I am done collecting this year's Standard gear and not ascending so frequently I will probably experiment with it, if no one else has reported what happens by then.
 

Veracity

Developer
I had a bug in this while I was developing ASH's auto-coercion facility, which allows you to not explicitly call to_string() (for example) on a typedef. So, for example, if you had this:

Code:
typedef boolean [string] string_set;
string to_string( string_set x );

string_set set1;
boolean [string] set2;
then the following would hold:

Code:
print( set1.to_string() ); // calls the string_set version of to_string()
print( set2.to_string() ); // Also calls the string_set version, since they have the same base type
print( set1 );             // Auto-coerces set1 ro a string using the custom version of to_string()
print( set2 );             // *** calls default to_string, which displays as "aggregate boolean [string]"
That is because auto-coercion requires exact matches for typedefs (or records)..

Which is as intended - except this script used "boolean [string]" rather than the typedef provided by vprops and explicitly calls to_string() - which is fine - until I decided I could use my fancy new auto-coercion. and removed the explicit call to to_string() when "correcting" the setting for VGH.GardenCrops.

This resulted in that variable getting a new value - "aggregate boolean [string]".

Sorry about that.

As of revision 273

- VGH uses the string_set typedef, so the coercion works
- It detects if that property has been corrupted and resets it such that it will have the built-in defaults.

Those defaults are rational aftercore defaults, in my opinion, but if you have customized them - which is (one of) the points of this script - you'll need to fix them manually.

- If you were using the default setting:

pumpkin|peppermint sprout|skeleton|3 beer labels|frost flower|15 cornucopias|very tall grass|colossal free-range mushroom

You're fine; you'll be back to normal next time you run VGH.

But if you had "tall grass" rather than "very tall grass" (which, come to think of it, is superior) or "immense free range mushroom" (because you don't want an extra 6 days before you get something new), you will need to change it with a "set" command, just as you did when you first configured the script.

I am very sorry for the inconvenience.
 
Last edited:
Top