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

Theraze

Active member
One more modification to the EatDrink script, based on Banana Lord realizing that some variables conflict with OCD. Changed the name of MAKE and SHOP to EAT_MAKE and EAT_SHOP. This allows the attached version of EatDrink to be imported along with OCD without conflicts.
 

Attachments

  • EatDrink.ash
    60 KB · Views: 26
I doubt it make a difference to me at this point in my ascension, but for early stages of SC/HC it might. Will the current version, if it winds up being most cost effective, use the snack vouchers from the new IOTM to get pockey/saki and consume it? I can understand not wanting to program in similar functionality with lucre food but if eatdrink doesn't currently visit the snack shop could it be programed into the next update?
 

fronobulax

Developer
Staff member
Just out of curiously, why is it EatDrink that needs to be adjusted? Both scripts fail to use a naming convention that avoids name conflicts and EatDrink has actually been around longer. Just sayin'.

And for the record, OCD and EatDrink are playing nicely for me so the conflict is caused by the way people are using the scripts and not either script inherently.
 

fronobulax

Developer
Staff member
V3.1.1 has the name change and Theraze's elimination of moods to control Ode.

@RedWulf - I have always had this uneasy sensation that EatDrink does not know about certain food and drink options that mafia does know about. However I have not had the time to confirm, and possibly fix, that. I'll keep your comments in mind when that changes.
 

illarion

Member
3.1.1 overdrank for me. Assuming it wasn't simply Mafia being out of sync with my real drunkenness, which I'll test tomorrow, there may be an issue there.
 

Theraze

Active member
Hasn't overdrunk for me, but there have been a few reports of people having mafia overdrink when they weren't telling it to, going back to version 3.0... The assumption we came up with then was that it was either lag causing the item consumption to not be properly logged, or bad inebriety datafiles on a seldom-picked item. Do you know which items it picked for your consumption? Without that, it's hard to tell which happened...
 

illarion

Member
In my case, I noticed that it was repeatedly trying (and failing) to drink primitive beer (failing because I was already at 15 drunk). Here's the session log, from invocation of EatDrink:

EDIT: Hmm, spoiler tag doesn't seem to work. Should I remove this, or is a big block of log ok?

cast 1 The Ode to Booze
> Checking for updates (running EatDrink ver. 3.1.1)...
> You have a current version of EatDrink.
> Loading favorite consumables from user settings...
> adding favorite: rockin' wagon
> adding favorite: pr0n chow mein
> adding favorite: twinkly wad
> Starting EatDrink.ash (version 3.1.1).
> Consuming up to 15 food, 14 booze, and 20 spleen
> Considering food from inventory Hagnk's the mall. Per-item budget cap is 25000.0.
> Price will be a factor if you own it already. Hagnk's pulls (if enabled) will cost 3000 meat each.
> An adventure has the value of <b>1000 meat</b>. Moxie subpoint is 10.0. Nonprime stat subpoint is 0.0.
> Pass 1: food.
> food: At 0, consuming to 15.
> Loading food map from Mafia's datafiles
> Filtering by type
> Filtering by level
> Finding prices
> Setting values
> Choosing food to consume.
> <b>rat appendix chow mein</b> lev:7 gain:5.0 adv:25.0 musc:0.0 myst:0.0 mox:72.5 meat:4750 own:0 value:4195
> Waiting to consume...
> Shopping for a rat appendix chow mein in 3 seconds
> budgeting 5937 for 1 additional rat appendix chow mein. You have 3605912 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 rat appendix chow mein for 4750 each from 2136994 on 20110315
You acquire an item: rat appendix chow mein
> You now have a total of 1
> Purchased 1 rat appendix chow mein for 4750 meat.

use 1 milk of magnesium
> 0: <b>milk of magnesium</b> price: 937 value: 4063.0

eat 1 rat appendix chow mein
You gain 30 Adventures
You gain 70 Cheek
> 1: <b>rat appendix chow mein</b> lev:7 gain:5.0 adv:25.0 musc:0.0 myst:0.0 mox:72.5 meat:4750 own:0 value:4195
> Choosing food to consume.
> <b>rat appendix chow mein</b> lev:7 gain:5.0 adv:25.0 musc:0.0 myst:0.0 mox:72.5 meat:4750 own:0 value:5195
> Waiting to consume...
> Shopping for a rat appendix chow mein in 3 seconds
> budgeting 5937 for 1 additional rat appendix chow mein. You have 3601162 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 rat appendix chow mein for 4750 each from 2136994 on 20110315
You acquire an item: rat appendix chow mein
> You now have a total of 1
> Purchased 1 rat appendix chow mein for 4750 meat.

eat 1 rat appendix chow mein
You gain 31 Adventures
You gain 70 Cheek
> 2: <b>rat appendix chow mein</b> lev:7 gain:5.0 adv:25.0 musc:0.0 myst:0.0 mox:72.5 meat:4750 own:0 value:5195
> Choosing food to consume.
> <b>spooky lo mein</b> lev:6 gain:4.0 adv:18.0 musc:0.0 myst:0.0 mox:33.5 meat:1660 own:0 value:5168
> Waiting to consume...
> Shopping for a spooky lo mein in 3 seconds
> budgeting 2075 for 1 additional spooky lo mein. You have 3596412 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 spooky lo mein for 1660 each from 2015495 on 20110315
You acquire an item: spooky lo mein
> You now have a total of 1
> Purchased 1 spooky lo mein for 1660 meat.

eat 1 spooky lo mein
You gain 23 Adventures
You gain 32 Roguishness
> 3: <b>spooky lo mein</b> lev:6 gain:4.0 adv:18.0 musc:0.0 myst:0.0 mox:33.5 meat:1660 own:0 value:5168
> Choosing food to consume.
> Favorite pr0n chow mein is too fattening (4.0)- removing from consideration.
> <b>handful of nuts and berries</b> lev:12 gain:1.0 adv:4.0 musc:0.0 myst:55.0 mox:0.0 meat:690 own:1 value:4310
> Waiting to consume...
> You have at least one handful of nuts and berries in inventory.
> Shopping for a milk of magnesium in 3 seconds
> budgeting 1171 for 1 additional milk of magnesium. You have 3594752 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 milk of magnesium for 937 each from 1877436 on 20110315
You acquire an item: milk of magnesium
> You now have a total of 1
> Purchased 1 milk of magnesium for 937 meat.

eat 1 handful of nuts and berries
You gain 4 Adventures
You gain 66 Magicalness
> 4: <b>handful of nuts and berries</b> lev:12 gain:1.0 adv:4.0 musc:0.0 myst:55.0 mox:0.0 meat:690 own:1 value:4310
> Pass 2: drink.
> drink: At 0, consuming to 14.
> Loading drink map from Mafia's datafiles
> Filtering by type
> Filtering by level
> Finding prices
> Setting values
> Choosing drink to consume.
> <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Waiting to consume...
> Shopping for a rockin' wagon in 3 seconds
> budgeting 1743 for 1 additional rockin' wagon. You have 3593815 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 rockin' wagon for 1395 each from 598713 on 20110315
You acquire an item: rockin' wagon
> You now have a total of 1
> Purchased 1 rockin' wagon for 1395 meat.

equip shirt tuxedo shirt

drink 1 rockin' wagon
You gain 16 Adventures
You gain 36 Smarm
You gain 4 Drunkenness

equip shirt sea salt scrubs
> 1: <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Choosing drink to consume.
> <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Waiting to consume...
> Shopping for a rockin' wagon in 3 seconds
> budgeting 1743 for 1 additional rockin' wagon. You have 3592420 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 rockin' wagon for 1395 each from 598713 on 20110315
You acquire an item: rockin' wagon
> You now have a total of 1
> Purchased 1 rockin' wagon for 1395 meat.

equip shirt tuxedo shirt

drink 1 rockin' wagon
You gain 20 Adventures
You gain 35 Smarm
You gain 4 Drunkenness

equip shirt sea salt scrubs
> 2: <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Choosing drink to consume.
> <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Waiting to consume...
> Shopping for a rockin' wagon in 3 seconds
> budgeting 1743 for 1 additional rockin' wagon. You have 3591025 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 rockin' wagon for 1395 each from 598713 on 20110315
You acquire an item: rockin' wagon
> You now have a total of 1
> Purchased 1 rockin' wagon for 1395 meat.

equip shirt tuxedo shirt

drink 1 rockin' wagon

equip shirt sea salt scrubs
> 3: <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Waiting to consume...
> Shopping for a cup of primitive beer in 3 seconds
> budgeting 512 for 1 additional cup of primitive beer. You have 3589630 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 cup of primitive beer for 410 each from 1945689 on 20110315
You acquire an item: cup of primitive beer
> You now have a total of 1
> Purchased 1 cup of primitive beer for 410 meat.

drink 1 cup of primitive beer
You gain 3 Adventures
You gain 52 Strongness
You gain 13 Mojo Points
You lose 11 hit points
You gain 1 Drunkenness
> 4: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Waiting to consume...
> Shopping for a cup of primitive beer in 3 seconds
> budgeting 512 for 1 additional cup of primitive beer. You have 3589220 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 cup of primitive beer for 410 each from 1945689 on 20110315
You acquire an item: cup of primitive beer
> You now have a total of 1
> Purchased 1 cup of primitive beer for 410 meat.

drink 1 cup of primitive beer
You gain 5 Adventures
You gain 57 Beefiness
You gain a Muscle point!
You gain 14 Mojo Points
You lose 11 hit points
You gain 1 Drunkenness
> 5: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Waiting to consume...
> Shopping for a cup of primitive beer in 3 seconds
> budgeting 512 for 1 additional cup of primitive beer. You have 3588810 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 cup of primitive beer for 410 each from 1945689 on 20110315
You acquire an item: cup of primitive beer
> You now have a total of 1
> Purchased 1 cup of primitive beer for 410 meat.

drink 1 cup of primitive beer
You gain 5 Adventures
You gain 59 Strengthliness
You gain 13 Mojo Points
You lose 12 hit points
You gain 1 Drunkenness
> 6: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> Favorite rockin' wagon is too fattening (4.0)- removing from consideration.
> <b>Supernova Champagne</b> lev:8 gain:3.0 adv:9.5 musc:10.0 myst:10.0 mox:10.0 meat:535 own:0 value:4021
> Waiting to consume...
> Shopping for a Supernova Champagne in 3 seconds
> budgeting 668 for 1 additional Supernova Champagne. You have 3588400 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 Supernova Champagne for 535 each from 473703 on 20110315
You acquire an item: Supernova Champagne
> You now have a total of 1
> Purchased 1 Supernova Champagne for 535 meat.
> Invoking Ode to Booze.

cast 1 The Ode to Booze

drink 1 Supernova Champagne
> Supernova Champagne price updated from 535 to 535.
> FAIL: <b>Supernova Champagne</b> lev:8 gain:3.0 adv:9.5 musc:10.0 myst:10.0 mox:10.0 meat:535 own:0 value:4021
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Waiting to consume...
> Shopping for a cup of primitive beer in 3 seconds
> budgeting 512 for 1 additional cup of primitive beer. You have 3587865 meat. You have 0 in inventory already.
> Looks like you have enough meat to buy it
> You have 0 right now

buy 1 cup of primitive beer for 410 each from 1945689 on 20110315
You acquire an item: cup of primitive beer
> You now have a total of 1
> Purchased 1 cup of primitive beer for 410 meat.

drink 1 cup of primitive beer
> cup of primitive beer price updated from 410 to 410.
> FAIL: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Waiting to consume...
> You have at least one cup of primitive beer in inventory.

...and then it loops on the last P.B
 
Last edited:

Theraze

Active member
Yeah... you drank 3 4-inebriety items, then 3 1-inebriety items, then... wait, found it. Your third rockin' wagon was lost by mafia... I'll edit this post later after I clean up the log more, but it was listed as drunk, but doesn't have adventure information on it. Because of that, mafia thought you were 4 inebriety lower than you were, making it overdrink by 1 before deciding that a 3 inebriety would still be safe (the supernova champagne).

Edit: Badly quoted section, with bolded failed-update drink, follows:
> Pass 2: drink.
> drink: At 0, consuming to 14.
> Loading drink map from Mafia's datafiles
> Filtering by type
> Filtering by level
> Finding prices
> Setting values
> Choosing drink to consume.
> <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
drink 1 rockin' wagon
You gain 16 Adventures
You gain 36 Smarm
You gain 4 Drunkenness
equip shirt sea salt scrubs
> 1: <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Choosing drink to consume.
> <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
drink 1 rockin' wagon
You gain 20 Adventures
You gain 35 Smarm
You gain 4 Drunkenness
equip shirt sea salt scrubs
> 2: <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Choosing drink to consume.
> <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
drink 1 rockin' wagon
equip shirt sea salt scrubs
> 3: <b>rockin' wagon</b> lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:1395 own:0 value:4238
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
drink 1 cup of primitive beer
You gain 3 Adventures
You gain 52 Strongness
You gain 13 Mojo Points
You lose 11 hit points
You gain 1 Drunkenness
> 4: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
drink 1 cup of primitive beer
You gain 5 Adventures
You gain 57 Beefiness
You gain a Muscle point!
You gain 14 Mojo Points
You lose 11 hit points
You gain 1 Drunkenness
> 5: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
drink 1 cup of primitive beer
You gain 5 Adventures
You gain 59 Strengthliness
You gain 13 Mojo Points
You lose 12 hit points
You gain 1 Drunkenness
> 6: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> Favorite rockin' wagon is too fattening (4.0)- removing from consideration.
> <b>Supernova Champagne</b> lev:8 gain:3.0 adv:9.5 musc:10.0 myst:10.0 mox:10.0 meat:535 own:0 value:4021
drink 1 Supernova Champagne
> Supernova Champagne price updated from 535 to 535.
> FAIL: <b>Supernova Champagne</b> lev:8 gain:3.0 adv:9.5 musc:10.0 myst:10.0 mox:10.0 meat:535 own:0 value:4021
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
drink 1 cup of primitive beer
> cup of primitive beer price updated from 410 to 410.
> FAIL: <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Choosing drink to consume.
> <b>cup of primitive beer</b> lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:410 own:0 value:4090
> Waiting to consume...
> You have at least one cup of primitive beer in inventory.
 
Last edited:

Theraze

Active member
Code or quote are the standard ones. Php is good if you're doing something with brackets. Anyways, your problem was a server glitching... it didn't see one of your rockin' wagons. I highlighted the missed drink above.
 

fronobulax

Developer
Staff member
What Theraze said. I'm posting +1 because after I spent the time figuring out what the log was saying it feels like the effort was wasted if I don't post something.
 
Hasn't overdrunk for me, but there have been a few reports of people having mafia overdrink when they weren't telling it to, going back to version 3.0... The assumption we came up with then was that it was either lag causing the item consumption to not be properly logged, or bad inebriety datafiles on a seldom-picked item. Do you know which items it picked for your consumption? Without that, it's hard to tell which happened...

The one time it happened to me according to my logs mafia resisted everything about my drinks except that it decided one of them gave me 0 drunkenness.
 

tebee

Member
I've been using the latest version of eatdrink for a couple of days but today it has started crashing with an error I've never seen before - Map modified within foreach (EatDrink.ash, line 989)

Code:
Starting EatDrink.ash (version 3.1.1).
Consuming up to 15 food, 0 booze, and 0 spleen
Considering food from inventory closet Hagnk's the mall. Per-item budget cap is 12500.0.
Price will be a factor if you own it already. Hagnk's pulls (if enabled) will cost 1800 meat each.
An adventure has the value of 600 meat. Mysticality subpoint is 5.0. Nonprime stat subpoint is 1.0.
Already updated from http://nixietube.info/mallprices.txt in this session.
Pass 1: food.
food: At 0, consuming to 15.
Loading food map from Mafia's datafiles
Map modified within foreach (EatDrink.ash, line 989)
 

fronobulax

Developer
Staff member
I've been using the latest version of eatdrink for a couple of days but today it has started crashing with an error I've never seen before - Map modified within foreach (EatDrink.ash, line 989)

Which version of KoLmafia are you running? I thought similar errors were introduced and fixed several months ago.
 

tebee

Member
I updated to r1972 yesterday - has some bug been re-introduced then?

The .exe on the builds page seems to be way out of date though - it appears to be r8934
 

Veracity

Developer
Staff member
"Map modified within foreach" always indicates a bug within a script, not KoLmafia. So, you are asking if a bug in EatDrink has been re-introduced? Have you recently started running a different version of the script?
 

Theraze

Active member
Doesn't that mean that an item got removed from the map while it was being run? I believe that could happen if you run out of meat while you're running the script, so it no longer is able to use one of the items it's decided it should use.
 

Chad Sexington

New member
I'm having the same issue now. I just grabbed the updated ascend files (after backing up the set of scripts I was running for a while). Now I get that same foreach problem. I tried updated kolmafia, tried going back to the previous eatdrink I was using, and it's still throwing the error on the same code.
 

Theraze

Active member
What version of mafia are you running?

Edit: Ohhh... looks like that's an issue with Genalen bottles. Can both of the people with problems confirm you have these in your inventory?
 
Last edited:
Top