EatDrink.ash: Optimize your daily diet (and see how your old diet stacks up).

key lime pies

I've been working on a modification to this script which will more accurately price key lime pies. Just as the TPS drinks are re-priced if the TPS is in inventory, the key lime pies would be re-priced if the reusable key is already in inventory. My preliminary tests reveal that even the re-priced key lime pies are almost always dominated by the the peach/pear/crimbo pies, which I find surprising.

Is anyone interested in these changes, and if so, what's the best format for me to produce them? Diffs?
 
You can just paste the changes in to the thread if you want - or upload a new version of the file as an attachment.
 
key lime changes

It's a small set of changes. I've included entire functions for context.

Code:
special_items[$item["boris's key lime pie"]] = true;
special_items[$item["jarlsberg's key lime pie"]] = true;
special_items[$item["sneaky pete's key lime pie"]] = true;

Code:
int special_prices(item it, int startprice)
{
  //These are unpriceable, so return a small number (that isn't reserved)
  if (it == $item["steel margarita"] && (item_amount(it) > 0))
    return 2;
  if (it == $item["steel lasagna"] && (item_amount(it) > 0))
    return 2;
  if (it == $item["steel-scented air freshener"] && (item_amount(it) > 0))
    return 2;

  int price1 = 0;
  int price2 = 0;

  // special pricing rules for key lime pies
  boolean JKEY = (item_amount($item[jarlsberg's key]) > 0);
  boolean BKEY = (item_amount($item[boris's key]) > 0);
  boolean SPKEY = (item_amount($item[sneaky pete's key]) > 0);
  boolean itsa_pie = false;

  if (it == $item["jarlsberg's key lime pie"] && (JKEY || (item_amount(it) > 0)))
     itsa_pie = true;
  else if (it == $item["boris's key lime pie"] && (BKEY || (item_amount(it) > 0)))
     itsa_pie = true;
  else if (it == $item["sneaky pete's key lime pie"] && (SPKEY || (item_amount(it) > 0)))
     itsa_pie = true;
  
  if (itsa_pie)
  {
    price1 = mall_price($item["lime"]);
    price2 = mall_price($item["pie crust"]);
    if ((price1 <= 1) || (price2 <= 1))
        return 0;
    else
	verbose("price of " + it + " is " + (price1 + price2));
        return (price1 + price2);  
  }

  //Special pricing rules for TPS drinks
  boolean TPS = false;
  TPS = (item_amount($item["tiny plastic sword"]) > 0);
  boolean checked = false;
  if (it == $item["bodyslam"] && (TPS || (item_amount(it) > 0)))
  {
    price1 = mall_price($item["bottle of tequila"]);
    price2 = mall_price($item["lime"]); 
    checked = true;
  }
  if (it == $item["cherry bomb"] && (TPS || (item_amount(it) > 0)))
  {
    price1 = mall_price($item["bottle of whiskey"]);
    price2 = mall_price($item["cherry"]);
    checked = true;
  }
  if (it == $item["dirty martini"] && (TPS || (item_amount(it) > 0)))
  {
    price1 = mall_price($item["bottle of gin"]);
    price2 = mall_price($item["jumbo olive"]); 
    checked = true;
  }
  if (it == $item["grogtini"] && (TPS || (item_amount(it) > 0)))
  {
    price1 = mall_price($item["bottle of rum"]);
    price2 = mall_price($item["lime"]);
    checked = true;
  }
  if (it == $item["sangria del diablo"] && (TPS || (item_amount(it) > 0)))
  {
    price1 = mall_price($item["boxed wine"]);
    price2 = mall_price($item["cherry"]);
    checked = true;
  }
  if (it == $item["vesper"] && (TPS || (item_amount(it) > 0)))
  {
    price1 = mall_price($item["bottle of vodka"]);
    price2 = mall_price($item["jumbo olive"]);
    checked = true;
  }
  if (checked)
  {
    if ((price1 <= 1) || (price2 <= 1))
      return 0;
    int bar = 0;
//    if (!have_bartender())
//    {
//      bar = mall_price($item["bartender-in-the-box"]);
//    }
    return (price1 + (price2 * 2) + bar);
  }
  return startprice;
}

Code:
boolean special_purchases(item it)
{
  boolean special = false;
  if (it == $item[bodyslam])
  {
    get_on_budget(2, $item[lime], mall_price($item[lime]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[bottle of tequila], mall_price($item[bottle of tequila]) * PRICE_FLEXIBILITY);
    create(1, $item[bodyslam]);
    special = true;
  }
  else if (it == $item[cherry bomb])
  {
    get_on_budget(2, $item[cherry], mall_price($item[cherry]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[bottle of whiskey], mall_price($item[bottle of whiskey]) * PRICE_FLEXIBILITY);
    create(1, $item[cherry bomb]);
    special = true;
  }
  else if (it == $item[dirty martini])
  {
    get_on_budget(2, $item[jumbo olive], mall_price($item[jumbo olive]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[bottle of gin], mall_price($item[bottle of gin]) * PRICE_FLEXIBILITY);
    create(1, $item[dirty martini]);
    special = true;
  }
  else if (it == $item[grogtini])
  {
    get_on_budget(2, $item[lime], mall_price($item[lime]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[bottle of rum], mall_price($item[bottle of rum]) * PRICE_FLEXIBILITY);
    create(1, $item[grogtini]);
    special = true;
  }
  else if (it == $item[sangria del diablo])
  {
    get_on_budget(2, $item[cherry], mall_price($item[cherry]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[boxed wine], mall_price($item[boxed wine]) * PRICE_FLEXIBILITY);
    create(1, $item[sangria del diablo]);
    special = true;
  }
  else if (it == $item[vesper])
  {
    get_on_budget(2, $item[jumbo olive], mall_price($item[jumbo olive]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[bottle of vodka], mall_price($item[bottle of vodka]) * PRICE_FLEXIBILITY);
    create(1, $item[vesper]);
    special = true;
  }
  else if (it == $item[jarlsberg's key lime pie] || it == $item[boris's key lime pie] || it == $item[sneaky pete's key lime pie])
  {
    get_on_budget(1, $item[pie crust], mall_price($item[pie crust]) * PRICE_FLEXIBILITY);
    get_on_budget(1, $item[lime], mall_price($item[lime]) * PRICE_FLEXIBILITY);
    create(1, it);
    special = true;
  }
  
  return special;
}
 
New version up - not revving the version # until I hear back that it's working OK though.

I have a question on line 137.

Reads
Code:
int VALUE_OF_ADVENTURE = to_int(get_property("valueOfAdventure"));
Changed to read
Code:
int VALUE_OF_ADVENTURE = to_int(vars["eatdrink_valueOfAdventure"]);

As it was written, it would not use the preferences value. The changed version does. What does the get_property() function actually retrieve?
 
Last edited:
It retrieves the property, "valueOfAdventure", which is a (relatively new) standard Mafia setting.

Ah, I just noticed that the script had started to ignore the value I had in my vars file for val-per-adv. Went in and changed the property in the settings file and now it works again.
 
Can you make it not eat Wet Stew, it was very annoying realizing that I had to re-farm it later because I only had 1 to pull, and it was apparently the best thing to eat for that occasion.

This was with use of Ascend.ash

Thank you, and I love your script.
 
Bazaaretw - try the attached version. It lets you exclude items, including wet stew by default.

This version is not compatable with Ascend.ash this error comes up

> call scripts\Ascend.ash

Function 'eatdrink( int, int, int, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, float, boolean, int, boolean, int, int, int, boolean, int, int, boolean, int )' undefined (Ascend.ash, line 62)

If I knew more about programming, or script coding I would help with a bug fix, but for now I'll keep dishing out little tidbits.

Also in case it's easier for you to just yell it at me, which file do I input these new functions where I can exclude items.

Thank you much,
Baz
 
Baz - you can add each item as a setting. You'll need the newest version of ascend.zip for it to work, though.
 
It retrieves the property, "valueOfAdventure", which is a (relatively new) standard Mafia setting.

Has anyone else been having trouble with this ever since EatDrink switched over to using it? It's set as 500 by default. I open my prefs file and change it to 1000. As soon as I run EatDrink, it's reset back to 500 again in the file. I can't figure out why.
 
Has anyone else been having trouble with this ever since EatDrink switched over to using it? It's set as 500 by default. I open my prefs file and change it to 1000. As soon as I run EatDrink, it's reset back to 500 again in the file. I can't figure out why.

You edit the mafia preference file while mafia is open? That won't work. What you want to do is type "set valueOfAdventure=X", replacing X with 1000 in this case. Or you could edit the preference file while mafia is closed.
 
hey on mine it says
"undifed reference to function 'modifier_eval'(zlib.ash, line 67)"
what is this and explain how to fix it in an easy to understand way im kinda new :)
 
hey on mine it says
"undifed reference to function 'modifier_eval'(zlib.ash, line 67)"
what is this and explain how to fix it in an easy to understand way im kinda new :)

modifier_eval() is a function that was added into kolMafia this month. To fix the problem, download a new version of kolMafia. I always download the latest build from here.
 
thanks an could you give me a step by step on how to edit it so it will look for the most adventure and not care about stat gain that is really making it make bad decitions for me to meat farm thanks in advance
 
thanks an could you give me a step by step on how to edit it so it will look for the most adventure and not care about stat gain that is really making it make bad decitions for me to meat farm thanks in advance

If you are looking for EatDrink.ash to not look at the stats, I do this by opening the vars file located at (at least on my machine) C:\Program Files\KoLMafia\data. Find the file named vars_XXXX.txt where XXXX is the character name. Find the following lines:
Code:
eatdrink_valueOfNonPrimeStat	2
eatdrink_valueOfPrimeStat	10
and change them to
Code:
eatdrink_valueOfNonPrimeStat	0
eatdrink_valueOfPrimeStat	0
This makes the script place no value on the stat gain from filling up.
P.S. Do this when Mafia is closed.
 
Back
Top