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

Theraze

Active member
Odd. Never had it happen for me yet, and I generally have several lucre in inventory and coinmasters are always enabled. How high do you have VoA set? Also, any chance you're using either autosell while ronin or ignore inventory price?
 

jtn2002

New member
I think my VoA is set at 1000, which is roughly what I get from castlefarming. I also don't think I changed either of those settings. Some of my accounts have yet to get the puppy and olfaction, others have both; so if a "use_lucre" boolean were implemented; that would be a huge help for me! Thanks, Theraze!
 

Theraze

Active member
It's a part of the using of coinmasters, since it's a... hmm...

// Some items are nontradable, so their price can't be calculated. These items
// tend to be very good (e.g. pan-galactic gargleblaster). You may not want
// to consume them lightly, so set this at MAXMEAT. If you do want to eat
// the very best food available regardless of value, set this to 0.
setvar("eatdrink_priceOfNontradeables", MAXMEAT);
Any chance you've changed eatdrink_priceOfNontradeables? This sets the value on anything that can't be purchased from the mall or npcs, and isn't a quest item. It defaults to MAXMEAT, which gets set earlier to
int MAXMEAT = 999999999;
999 million. Changing either MAXMEAT or eatdrink_priceOfNontradeables would potentially affect the selection of bounty hunter items.
 

Theraze

Active member
Well, least you're protected now. No clue how that got corrupted, but... if you want to be sure to avoid it in the future, you can set specific "avoid" values. Be good to know though if that gets screwed up, so you can not lose other invaluable items.
 

Tussosedan

New member
I'm only just starting to use EatDrink, and it looks awesome.
However, I can't understand some of the choices:

Starting EatDrink.ash (version 3.1.7).
Consuming up to 15 food, 14 booze, and 20 spleen and then finishing off with the stiffest drink we can find.
Considering food from inventory Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 250000.0.
Retrieval cap is 20000. Price will be a factor if you own it already.
An adventure has the value of 1200 meat. Moxie subpoint is 0.0. Nonprime stat subpoint is 0.0.
Simulating only; no purchases or food/drink/spleen consumption.
food: At 0, consuming to 15 with 1207827 meat.
0: milk of magnesium price: 1040 value: 16960
1: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 mox:0.0 meat:5000 own:0 value:5000
2: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 mox:0.0 meat:5000 own:0 value:5000
3: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 mox:0.0 meat:5000 own:0 value:5000
drink: At 0, consuming to 14 with 1175747 meat.
0: Ode to Booze price: 0 value: 16800
1: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
2: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
3: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
4: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
5: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
6: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
7: Gin Mint lev:2 gain:2.0 adv:11.5 musc:15.0 myst:15.0 mox:37.5 meat:5790 own:0 value:4005
spleen: At 0, consuming to 20 with 1094687 meat.
1: glimmering roc feather lev:4 gain:4.0 adv:8.0 musc:25.0 myst:25.0 mox:25.0 meat:4900 own:0 value:1175
2: glimmering roc feather lev:4 gain:4.0 adv:8.0 musc:25.0 myst:25.0 mox:25.0 meat:4900 own:0 value:1175
3: glimmering roc feather lev:4 gain:4.0 adv:8.0 musc:25.0 myst:25.0 mox:25.0 meat:4900 own:0 value:1175
4: glimmering roc feather lev:4 gain:4.0 adv:8.0 musc:25.0 myst:25.0 mox:25.0 meat:4900 own:0 value:1175
5: glimmering roc feather lev:4 gain:4.0 adv:8.0 musc:25.0 myst:25.0 mox:25.0 meat:4900 own:0 value:1175
At drunkenness of 14. Overdrinking with 1045687 meat.
1: corpse on the beach lev:5 gain:6.0 adv:22.0 musc:0.0 myst:73.0 mox:0.0 meat:10600 own:0 value:15800
choc: Checking non-filling crimbo chocolates - all 3 kinds
Best find was chocolate seal-clubbing club with a value of -700. That's no good, so not consuming and moving on.
Finished. You had -Ode to Booze in effect. Adventures listed above does not reflect that, but this does:
Spent 91670 meat for a value of 91670 meat. Gained Fullness: 15. Inebriety: 20. Spleen: 20.
Adventures: 252. Muscle: 452. Moxie: 384. Mysticality: 303.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).

Things that bother me (and please forgive me if it's been answered before -- I did search):
1. Why is lasagna not chosen (with field gar)?
2. Why is the glimmering roc chosen over coffee pixie sticks, which are much cheaper?
3. Why is the nightcap a corpse on the beach, and not a bucket of wine?

Thanks!
 

slyz

Developer
1. Why is lasagna not chosen (with field gar)?
I'm not sure EatDrink knows about field gar.
2. Why is the glimmering roc chosen over coffee pixie sticks, which are much cheaper?
Eating a glimmering roc feather will net you (adv*VoA-cost) meat, where VoA = value of adventure (1200 for you). Divide this by the amount of spleen used to get a basis to which you can compare other spleen items.

Glimmering roc feather value: (8*1200-4900)/4 = 1175 meat gained per spleen
Coffee pixie stick value : (7.5*1200-10*349)/4 = 1377.5 meat gained per spleen

I guess it should be buying coffee pixie sticks. Maybe there is a problem with the way items sold by coinmasters are valued?

Which version of EatDrink are you using? Maybe the problem has been fixed in one the versions Theraze posted recently?

3. Why is the nightcap a corpse on the beach, and not a bucket of wine?
For overdrinking, the value is the same except you don't divide by the drunkness when comparing different nightcaps.

bucket of wine value: 18*1200 - 8900 = 12700
corpse on the beach value: 22*1200 - 10600 = 15800

With a VoA of 1200 meat per adventure, a corpse on the beach will net you more meat.
 

Theraze

Active member
I don't think we have the special handling for field gar yet... we talked about that around posts 1362-1365. We trust mafia's information... does mafia update its stats if you drink the potion? That's part of what we need to know for making this work right.

Base for Knob chow mein: 25*3 = 75 adventures.
Base for gnat lasagna: 14*5 = 70 adventures.
Boosted for gnat lasagna: 19*5 = 95 adventures.

So yeah... without the field gar being considered, it makes more sense to pick the chow mein. With it, gnat lasagna (as the cheapest lasagna option) should have been picked, as long as mafia's adventure data updates when the effect is on. If it doesn't update when the effect is on, then we need to do our own override. And that's the answer to number 1.

Game grid tickets cost 349 and you need 10, so total cost is 3490. This provides 7.5 average adventures for 4 spleen.
The roc feather cost 4900 meat and provides 8 average adventures for 4 spleen.

Pixie sticks gave 7.5*1200=9000. 9000-3490=5510. 5510/4=1377.5.
Roc feather gives 8*1200=9600. 9600-4900=4700. 4700/4=1175.

Honestly, no clue why it picked the roc feathers over coffee pixie sticks. :) Would take more logging to show why. Any chance you can run these two lines and give me the results?
> ash import <eatdrink.ash> effective_price($item[coffee pixie stick], false)

> ash available_amount($item[coffee pixie stick].seller.item)
Those are the two checks used to:
1) decide how much the coffee pixie sticks will cost to completely acquire, and
2) decide if we have the ability to actually get the game grid tokens to purchase the pixie sticks.

Corpse on the beach... hmm... comparison time again!
Corpse is 22*1200=26400. Cost means 26400-10600=15800 total value, as shown.
Bucket is 18*1200=21600. Cost means 21600-8900=12700 total value, which is worse.

Problem with that logic is that for overdrinking, the value of ode actually matters, unlike with normal boozing. With normal boozing, doesn't matter if you use a bucket of wine to get from 0-10 or 10 imported beer, you're getting the extra adventure from ode. Actually in that comparison, the beer is better because you get 30 adventures for 2000 meat instead of 28 adventures for 8900 meat. But that's somewhat besides the point, which is that in normal boozing, you want the cheapest alcohol that, irregardless of ode, provies the most adventures. With nightcaps, you want the cheapest alcohol that, in concert with ode, provides the most adventures.

Guess that means I'm going to have to overload the value check for overdrinking and have it actually boost them both up to 28*1200 and then the value flip-flops. :) So that's why number 3 happened... because they're working off base drink adventure values, not bumped by ode. I'll need to look at that in the next day or two.
 

Tussosedan

New member
Thanks for the quick response!

I got:

> ash import <eatdrink.ash> effective_price($item[coffee pixie stick], false)
Returned: 2920

> ash available_amount($item[coffee pixie stick].seller.item)
Returned: 0

Looks like I need to actually own a game grid ticket for it to work:

> buy game grid ticket

Searching for "Game Grid ticket"...
Search complete.
Purchasing Game Grid ticket (1 @ 349)...
You acquire an item: Game Grid ticket
Purchases complete.

> ash available_amount($item[coffee pixie stick].seller.item)

Returned: 1

So since I usually don't have extra tickets, it won't consider buying them?
 

Theraze

Active member
On a positive note, do have the overdrink problem solved... fixed version attached to this post, but there'll probably be an edit or two today to try to get coinmasters fixed up. Unless people post after this, in which case I'll dump in a new post instead of editing. :D

Anyways, for people who care... the way I fixed up overdrink is by turning the milk_do_body_good, lunch_do_body_good, and ode_do_liver_good into booleans with a check variable passed into it. If you're checking, it will tell you whether or not you can get milk/lunch/ode for that size item. Then the value check, inside its overdrink check where it multiplies it back out into best-single-item checking adds the size of item*VoA to value. Tested and it wanted a bucket of wine, displayed value was properly at 26520 for my 1250 VoA with default stat values.

Regarding coinmasters... nope, means we need to change up that check. The available_amount I was hoping to look at mallables isn't. It would buy them if needed, but it eliminates it as a valid possibility because available_amount is less than the amount needed.

Edit: Try this version. Should fix the coinmaster issue. Changed from available_amount(coinmaster.item) to coinmaster.available_tokens and put a check for EAT_MALL as an alternative... if you have access to the mall, consider the tokens to be attainable. Not necessarily true, but in my brief testing this did get pixie sticks on an aftercore character and realized it was impossible for in-ronin characters. I'll need to consider how better to do the check to be more accurate later. :)

Edit2: This version should be even better. Threw in a check for effective_price(con.it.seller.item, false) > 0, so it should only try to use coinmaster items outside your inventory if you can actually acquire more and have access to the mall. This MIGHT have issues if they make a coinmaster whose items can always be purchased from an NPC shop with meat... but so far, so good. :)
 

Attachments

  • EatDrink.ash
    95.3 KB · Views: 43
Last edited:

Tussosedan

New member
Great! Now it does choose coffee pixie sticks and a bucket of wine for me.

Only the field gar thing left, and then I'll turn over my diet :cool:
But I suppose it's problematic, since it always needs to check the Arizona time to see if the effect is active.
 

Theraze

Active member
Yeah... that's been a long term project, but it got caught up in TheSea and other scripting projects. :)

That being said, I THINK I have a working check for mondays...
> ash numeric_modifier($item[tuesday ruby], "muscle percent")

Returned: 5.0
 

slyz

Developer
I forget where I stole it from, but I use the following in my consuming script:
PHP:
if ( now_to_string("EEE").contains_text( "lun" ) )
"lun" is for lundi (monday in french), so I guess it should be replaced with "mon". I'm not sure how this could be used to check for Arizona time though.
 

Theraze

Active member
Yeah... what I need to check is if the tuesday's ruby (which changes its modifier based on the day) changes based on rollover or based on the Arizona-day. If it's based on Arizona-day, full success... can just do
if (numeric_modifier($item[tuesday ruby], "muscle percent") == 5.0)
means that it's Monday.

If the first few hours of tomorrow's rollover are still with the new tuesday ruby modifier, then that's no good... I'll need to do some sort of blend of gametime_to_int() and the numeric modifier to make it right. Let's see... rollover is 8:30PM Arizona time, so it would be good from 3.5 hours into muscle percent until 3.5 hours into 3-7 mp restoration. More complicated, but it should work. Also, unlike using now_to_string(), it shouldn't cause problems for people using non-English localized computers. :D

Logic time...
> ash (86400000 / 24)

Returned: 3600000
So each hour is 3.6 million bits there. And since we want 3.5 hours, but we don't want to convert it into a float...
> ash (86400000 / 24 * 7 / 2)

Returned: 12600000
12.6 million in is our cutoff. If we put the gametime_to_int() check for >=12.6 million and muscle or <12.6 million and MP regen, we should be good. If we need to make it complicated, which I won't know until tonight, as long as I remember to check it. Meh. :)

Edit: Well, according to mafia, the field gar potion and Tuesday's ruby (Modifiers.java, override function) both use the same date check. As such, I should be able to use the simple muscle check listed above to decide if lasagna can be improved...

Edit2: Wiki's talk page says that people have tried it and it's definitely tied into Arizona day-time, not rollover. Will need to validate that all is well with Tuesday's ruby regarding that, but I'll start tweaking up the support. Does look like mafia's got it all sorted though. :)
 
Last edited:

Theraze

Active member
Main work is done... the problem is in predicting whether or not we'll be wanting multiple lasagnas. Here we hit a user-vote time:

Do we want to consider people eating multiple lasagnas as likely, if they're going for the effect, and work based on remaining fullness for EatDrink to consume / lasagna size, or to work individually?

Individually, the lasagnas are less likely to start going, since it currently costs 8900 for a field gar potion, and and it takes a VoA of over 1780 to make it worthwhile for a single lasagna.
Working as a maximum group, it will very often consume the potion if you're in aftercore, because 4-6 lasagnas and 20-30 bonus adventures are a good thing and definitely worth the 9-10k.

My current function runs as function(int lasagnas, boolean check), so I can tell it how many lasagnas of 5 bonus adventures to consider, so it's easy to tweak for later, but... either way it's likely to go off, either missing opportunities because it's considering them individually or by buffing when it's not as effective as it should be. My goal is to have it be as correct as possible, so that you don't even realize that it got confused. :D
 

xKiv

Active member
I suspect the optimal thing will be either garish + all [1] lasagnas, or no garish at all. One of those two.

[1] or rather, as many as can fit in the remaining stomach.
 

Theraze

Active member
Yeah... what I think I'll probably do is start with gar(floor(totalroom / 3)) lasagnas for the check, and follow up with gar(actual lasagna count) for the decision if we're actually going to get and use the potion. It MIGHT cause it to decide on lasagnas and fail to potion if you're RIGHT near the edge and are REALLY low on meat... as in, not enough to afford to get the lasagnas, milk, and gar potion... but shouldn't get noticed by most people, and gives the maximum chances for accuracy. Unless someone thinks of a better system soonish. :)

Edit: Just these three, right?
Code:
        if ($items[fishy fish lasagna, gnat lasagna, long pork lasagna] contains position[i].it)
          foodlasagna += 1;
 
Last edited:

Theraze

Active member
Okay... if anyone wants to try this one tonight 3.5+ hours over rollover...

Simulated to not be Monday by commenting out the get_gar date check and the lasagna_do_garfield_good date check:
Now, to recap...
******************************************
Starting EatDrink.ash (version 3.1.7).
Consuming up to 20 food, 14 booze, and 15 spleen
Considering food from inventory Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 12500.0.
Retrieval cap is 10000. Price will be a factor if you own it already.
An adventure has the value of 1250 meat. Mysticality subpoint is 10.0. Nonprime stat subpoint is 2.0.
Simulating only; no purchases or food/drink/spleen consumption.
food: At 0, consuming to 20 with 20000 meat.
0: milk of magnesium price: 1000 value: 24000
0: potion of the field gar price: 8900 value: 16100
1: long pork lasagna lev:10 gain:3.0 adv:19.0 musc:0.0 myst:50.5 mox:0.0 meat:4723 own:0 value:6510
2: long pork lasagna lev:10 gain:3.0 adv:19.0 musc:0.0 myst:50.5 mox:0.0 meat:4723 own:0 value:6510
3: long pork lasagna lev:10 gain:3.0 adv:19.0 musc:0.0 myst:50.5 mox:0.0 meat:4723 own:0 value:6510
4: long pork lasagna lev:10 gain:3.0 adv:19.0 musc:0.0 myst:50.5 mox:0.0 meat:4723 own:0 value:6510
5: hot hi mein lev:7 gain:5.0 adv:25.0 musc:73.0 myst:17.5 mox:32.5 meat:5474 own:0 value:5232
6: super ka-bob lev:11 gain:3.0 adv:13.5 musc:34.0 myst:0.0 mox:0.0 meat:1800 own:6 value:5047
choc: Checking non-filling crimbo chocolates - all 3 kinds
Best find was chocolate pasta spoon with a value of -1000. That's no good, so not consuming and moving on.
Finished.
Spent 18892 meat for a value of 9900 meat. Gained Fullness: 20. Inebriety: 0. Spleen: 0.
Adventures: 134. Muscle: 107. Moxie: 32. Mysticality: 217.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
Those two commenting-outs removed:
Now, to recap...
******************************************
Starting EatDrink.ash (version 3.1.7).
Consuming up to 20 food, 14 booze, and 15 spleen
Considering food from inventory Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 12500.0.
Retrieval cap is 10000. Price will be a factor if you own it already.
An adventure has the value of 1250 meat. Mysticality subpoint is 10.0. Nonprime stat subpoint is 2.0.
Simulating only; no purchases or food/drink/spleen consumption.
food: At 0, consuming to 20 with 20000 meat.
0: milk of magnesium price: 1000 value: 24000
1: spooky hi mein lev:7 gain:5.0 adv:25.0 musc:17.5 myst:73.0 mox:32.5 meat:5445 own:0 value:5327
2: spooky hi mein lev:7 gain:5.0 adv:25.0 musc:17.5 myst:73.0 mox:32.5 meat:5445 own:0 value:5327
3: spooky hi mein lev:7 gain:5.0 adv:25.0 musc:17.5 myst:73.0 mox:32.5 meat:5445 own:0 value:5327
4: pr0n chow mein lev:7 gain:4.0 adv:19.5 musc:23.0 myst:0.0 mox:23.0 meat:3412 own:0 value:5263
5: Genalen™ Bottle lev:10 gain:1.0 adv:3.0 musc:22.5 myst:22.5 mox:0.0 meat:170 own:5 value:3850
choc: Checking non-filling crimbo chocolates - all 3 kinds
Best find was chocolate pasta spoon with a value of -1000. That's no good, so not consuming and moving on.
Finished.
Spent 27805 meat for a value of 1000 meat. Gained Fullness: 20. Inebriety: 0. Spleen: 0.
Adventures: 117. Muscle: 96. Moxie: 119. Mysticality: 241.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
 

Attachments

  • EatDrink.ash
    98.2 KB · Views: 29
Last edited:

Tussosedan

New member
Tested today, using the latest mafia build (10849):

At 11:27pm Monday (MST) - Time in Phoenix, AZ, USA:

> ash numeric_modifier($item[tuesday ruby], "muscle percent")

Returned: 0.0

But KoL shows:

Enchantment:
+5% Muscle

And the new EatDrink chooses lasagnas.

At 12:08am Tuesday (MST) - Time in Phoenix, AZ, USA:

Same results, but KoL shows:

Regenerate 3-7 MP per adventure

So I suppose mafia's check for the ruby is no good?
Didn't check if it actually disallows using the field gar potion.

Edit: filed a bug report.

Edit 2:
Now that I took a closer look at your results, shouldn't it choose 6 lasagnas and a stomach turnover instead of the 4 lasagnas with hot hi mein and super ka-bob for you?
 
Last edited:

Theraze

Active member
Yes, incorrect Arizona day-detection would be a mafia bug, detecting those based on rollover time rather then Arizona time. Should be easy to fix, just changing the GMT-3.5 to a GMT-7... if nobody's come up with one soonish, I'll try to proffer a patch that the devs can check on.

The reason for stopping after 4 lasagnas is because I set stepmeat to 20k, and it costs 4.7k to buy a lasagna. After 4 lasagnas, I've spent all but 1,108 of my meat, so the hot hi mein and super ka-bob are what it managed to get from my inventory or spending that much meat. For maximum adventures, set stepmeat to -1 and it will keep spending until it hurts. :)

Also, attaching a slightly more better-er version of the EatDrink here. I realized eventually that the existing one tries to get the potion during the check, before we actually know if we want it or not... if we can get it, we probably want it, but the above version might cause problems for people who have the summon clip art skill and don't have access to making lasagna. That's bad. And hence, the attached version of ED. :)
 

Attachments

  • EatDrink.ash
    98.3 KB · Views: 34
Top