Here is how
garbo handles it, where it picks the most valuable item from the cabinet (and it always considers Extrovermectin because it spends lots of turns indoors, and so it knows it will be available to pick up later)
This is not ash, but typescript, and it is typescript using the libram library which adds in some additional features, but I think the point gets across.
JavaScript:
function coldMedicineCabinet(): void {
if (getWorkshed() !== $item`cold medicine cabinet`) return;
if (
property.getNumber("_coldMedicineConsults") >= 5 ||
property.getNumber("_nextColdMedicineConsult") > totalTurnsPlayed()
) {
return;
}
const options = visitUrl("campground.php?action=workshed");
let i = 0;
let match;
const regexp = /descitem\((\d+)\)/g;
const itemChoices = new Map<Item, number>();
if (!globalOptions.noBarf) {
// if spending turns at barf, we probably will be able to get an extro so always consider it
itemChoices.set($item`Extrovermectin™`, -1);
}
while ((match = regexp.exec(options)) !== null) {
i++;
const item = descToItem(match[1]);
itemChoices.set(item, i);
}
const bestItem = argmax(Array.from(itemChoices.keys()).map((i) => [i, mallPrice(i)]));
const bestChoice = itemChoices.get(bestItem);
if (bestChoice && bestChoice > 0) {
visitUrl("campground.php?action=workshed");
runChoice(bestChoice);
}
}