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

slyz

Developer
Am I missing something here or should that map have more than 403 items in it ?
fullness.txt contains some foods that aren't items (they don't have item numbers), like sushis and food no longer accessible in the game.

Since temp_map is defined as
PHP:
fullness_file_entry [item] temp_map
anything that turns into $item[ none ] when using to_item() overwrites temp_map[ $item[ none ] ] instead of being added with its own index.

Could you try again, but add
PHP:
remove temp_map[ $item[ none ] ];
before the foreach?
 

Bale

Minion
The whole price thing is somewhat opaque to me but if it can't find an item at a reasonable price it also eliminates it from consideration. So the folks who read code might look at those places for me.

A lot of EatDrink is pretty opaque to me also and I'm fairly decent at the "read code" thing.
 

Theraze

Active member
fullness.txt contains some foods that aren't items (they don't have item numbers), like sushis and food no longer accessible in the game.

Since temp_map is defined as
PHP:
fullness_file_entry [item] temp_map
anything that turns into $item[ none ] when using to_item() overwrites temp_map[ $item[ none ] ] instead of being added with its own index.

Could you try again, but add
PHP:
remove temp_map[ $item[ none ] ];
before the foreach?

Something else to try if that doesn't work... replace the Genalen line with this:
Code:
    if (it != $item["Genalen™ bottle"] && it != $item[none])
Basically, only consider the item if it's not a Genalen bottle or not a 'none' item.

But try slyz's change first. :D
 

tebee

Member
Although I'm not doing it professorially anymore (doing 3-d stuff now) I've been a professional programmer since the mid 70's ( IBM 360 assembler !) and I find EatDdrink to be too obtuse to even be bothered trying to work out how it works and I'm the sort of boy who pulls all his new toys apart just to see what makes (made?) them tick.

Anyway before I fell asleep last night I thought I'd have one last go at running my two characters that this was failing on. Now I was on a different machine ( my laptop, in bed, one of the nice things about working for yourself on computers is you can work in bed !) but the entire mafia directory tree is automatically mirrored between my two PC's so all files and mafia versions should be the same.

So what did I find? it worked perfectly ! I'd not done the change suggested above or any other changes but I noticed the number of entries is different this time.

Here is the log

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 . 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 <b>600 meat</b>. Muscle subpoint is 5.0. Nonprime stat subpoint is 1.0. Hagnk pulls are limited and their 'cost' is incorporated.
> Pass 1: food.
> food: At 0, consuming to 15.
> Loading food map from Mafia's datafiles
 > Loading fullness.txt.
 > fullness.txt loaded successfully.
> 395
 > Importing mafia info for 3vi1 pr0n m4nic0tti
 > Importing mafia info for a dance upon the palate
 > Importing mafia info for abominable snowcone
 > Importing mafia info for ancient frozen dinner
 > Importing mafia info for ancient unspeakable fruitcake
 > Importing mafia info for angel-food cake
 > Importing mafia info for antique packet of ketchup
 > Importing mafia info for asparagus lo mein
 > Importing mafia info for asparagus stir-fry
 > Importing mafia info for babycakes
 > Importing mafia info for badass pie
................
 

Raven434

Member
Try "update clear" from the CLI.

Exit mafia completely.

Restart.

9174 was acting in the same manner various folks have been having problems with. Did the above and it stopped hanging on the booze computations.

It never had a problem with food or spleen. It would always "red code" on the booze.
 

tebee

Member
OK more weirdness today . Tried the two characters that failed on one machine yesterday but worked on the other. Rand the both on the PC that worked yesterday.

First one

Code:
> Pass 1: food.
> food: At 0, consuming to 15.
> Loading food map from Mafia's datafiles
 > Loading fullness.txt.
 > fullness.txt loaded successfully.
> 398
 > Importing mafia info for 3vi1 pr0n m4nic0tti
 > Importing mafia info for a dance upon the palate
but on the other running on the same machine at the same time

Code:
Pass 1: food.
food: At 0, consuming to 15.
Loading food map from Mafia's datafiles
Loading fullness.txt.
fullness.txt loaded successfully.
397
Importing mafia info for 4956
Map modified within foreach (EatDrink.ash, line 990)
 
Last edited:

Bale

Minion
Although I'm not doing it professorially anymore (doing 3-d stuff now) I've been a professional programmer since the mid 70's ( IBM 360 assembler !) and I find EatDdrink to be too obtuse to even be bothered trying to work out how it works and I'm the sort of boy who pulls all his new toys apart just to see what makes (made?) them tick.

Thanks. That makes me feel better about not being able to understand dj_d's coding better than I do. I recently tried to rewrite his farm.ash to account for maximize(string, true) and olfaction... It proved easier to write an entirely new program from scratch without borrowing a single line of code.
 

Theraze

Active member
OK more weirdness today . Tried the two characters that failed on one machine yesterday but worked on the other. Rand the both on the PC that worked yesterday.

First one

Code:
> Pass 1: food.
> food: At 0, consuming to 15.
> Loading food map from Mafia's datafiles
 > Loading fullness.txt.
 > fullness.txt loaded successfully.
> 398
 > Importing mafia info for 3vi1 pr0n m4nic0tti
 > Importing mafia info for a dance upon the palate
but on the other running on the same machine at the same time

Code:
Pass 1: food.
food: At 0, consuming to 15.
Loading food map from Mafia's datafiles
Loading fullness.txt.
fullness.txt loaded successfully.
397
Importing mafia info for 4956
Map modified within foreach (EatDrink.ash, line 990)

tebee, did you try slyz and/or my suggestions on the character where it failed?
 

tebee

Member
tebee, did you try slyz and/or my suggestions on the character where it failed?

Not yet. The reason is I tired logging off and restarting mafia - the problem did not re-occur ! But it does seem to reoccur if you just try rerunning the script without doing this.

If I have the problem again tomorrow I'll try your suggestion, but I'm beginning to think this may be a mafia error rather than a scripting problem.
 

Theraze

Active member
Yes/no. It's possible that it's caused by an old historical price on an item, or something similar, where after the exit/restart, that item is updated and out of the list of items that need it. Or something similar.

Anyways, if it happens again, update the script file with slyz's line, rerun the EatDrink. If it still happens, update the script file with my line, rerun EatDrink. Hopefully one or the other should fix it. But without knowing if it can be avoided somehow, we can't work around it in the future or say if we think that it actually might be an issue with the fullness/inebriety/speenhit data files.
 

Winterbay

Active member
Thanks. That makes me feel better about not being able to understand dj_d's coding better than I do. I recently tried to rewrite his farm.ash to account for maximize(string, true) and olfaction... It proved easier to write an entirely new program from scratch without borrowing a single line of code.

I don't find farm.ash that hard to understand and I'm not that experienced as a coder. Admittedly I have not tried adding Olfaction (don't have it and won't for a while since I fail at collecting lucre, current speed is roughly 1/5 days at max) but the change to maximize wasn't that hard to implement.
 

Winterbay

Active member
Really? That made me buggy before I finally decided I'd just make a better script from scratch. I guess you're better at reading his stuff than I am.

Well, it appears to be working and the testing of gear and equipment is a lot faster now than it was before which I guess means that it is not hitting the servers. It did take a few tries before i found all the palces I needed to add stuff though and I have not even tried to poke at the mood management part of the script because that scares the hell out of me :)
 

Bishy

New member
Try "update clear" from the CLI.

Exit mafia completely.

Restart.

9174 was acting in the same manner various folks have been having problems with. Did the above and it stopped hanging on the booze computations.

It never had a problem with food or spleen. It would always "red code" on the booze.


this worked for me: i was having the 969 error with mafia using9191 and new downloads of my scripts.
 

tebee

Member
That worked for me too so the next time it happened I tried just logging off and logging back in again without doing the "update clear" and that too worked!

Not had the problem for a couple of days now ( running 4 Id's), but seeing as you have it on a latter build, I'll upgrade mine as well
 

Theraze

Active member
So that suggests that you had bad booze item override files, probably from Drunksgiving. Not the script's fault, not mafia's fault. Though I was under the impression that updating mafia itself should wipe out your old override files... maybe not, but that's based on someone wanting to keep some sort of override and having mafia automatically delete them because it knew they were out of date...
 

Veracity

Developer
Staff member
I'd love to understand how override files are "bad". I'm not being defensive; it's just that they are intended to be exactly like the built-in data files, whenever that has been untrue, it's a bug and I've fixed it and, well, they work perfectly for me every time.

If we find a new booze, we add it to tradeitems and to itemdescs, but we do not enter it into inebriety, since we don't know anything about it other than level requirement; without knowing the amount of drunkenness (at least) or the adv and stat gains (ideally), what can we show you in the Booze panel?

So, when we discover a new booze item, it is in tradeitems.txt but NOT in inebriety.txt

Perhaps eatdrink does not handle that correctly, where "correctly" would be "ignore booze with no consumption data".

Edit: I just looked at eatdrink. It reads fullness and inebriety - which KoLmafia never overrides - but does not seem to look at tradeitems.

As has been mentioned elsewhere, it should skip $item[none], since those are things in cafes or sushi or such which do not have item numbers. I also don't see why it skips genalin bottles; breaking because there is a funny character in the name is a bug that should be fixed, rather than avoided, in my opinion.
 
Last edited:

Theraze

Active member
Agreed on skipping and Genalin both... unfortunately, it takes having out of date overrides - broken files, if you will - to be able to have the issue, and even with them, it's not a guarantee of success... or failure, as our desire happens to be.

I may try changing it to only avoid $item[none] instead of the Genalen bottles, and see what happens... if it continues to work as it should, great. If I suddenly get new errors, hopefully they'll be replicable.
 

tebee

Member
I don't think it has anything to to with having out of date overrides - last time I had the problem all I did was log out of Mafia, restart it ant it then worked! I've also had occasion where I have been running two instances of mafia on the same computer at the same time - eatdrink has worked perfectly on one and crashed on the other !
 

Theraze

Active member
Starting EatDrink.ash (version 3.1.1).
Consuming up to 15 food, 19 booze, and 15 spleen
Considering food from inventory Hagnk's . Per-item budget cap is 12500.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 1000 meat. Mysticality subpoint is 10.0. Nonprime stat subpoint is 2.0. Hagnk pulls are limited and their 'cost' is incorporated.
food: At 1, consuming to 15.
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
1: nutty organic salad lev:11 gain:3.0 adv:13.5 musc:0.0 myst:35.5 mox:0.0 meat:2240 own:2 value:3871
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
2: nutty organic salad lev:11 gain:3.0 adv:13.5 musc:0.0 myst:35.5 mox:0.0 meat:2240 own:2 value:3871
EatDrink encountered an error: You don't have a nutty organic salad and you're not able to shop.
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
3: Genalen™ Bottle lev:10 gain:1.0 adv:3.0 musc:22.5 myst:22.5 mox:0.0 meat:170 own:2 value:3100
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
4: Genalen™ Bottle lev:10 gain:1.0 adv:3.0 musc:22.5 myst:22.5 mox:0.0 meat:170 own:2 value:3100
EatDrink encountered an error: You don't have a Genalen™ Bottle and you're not able to shop.
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
5: handful of walnuts lev:10 gain:1.0 adv:3.0 musc:0.0 myst:0.0 mox:25.0 meat:146 own:3 value:2904
EatDrink encountered an error: You don't have a handful of walnuts and you're not able to shop.
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
6: strawberry pie lev:2 gain:3.0 adv:6.0 musc:0.0 myst:0.0 mox:9.0 meat:100 own:5 value:1972
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
7: lime lev:2 gain:1.0 adv:2.0 musc:0.0 myst:0.0 mox:0.0 meat:200 own:23 value:1800
EatDrink encountered an error: You don't have a milk of magnesium and you're not able to shop.
8: lime lev:2 gain:1.0 adv:2.0 musc:0.0 myst:0.0 mox:0.0 meat:200 own:23 value:1800
spleen: At 7, consuming to 15.
Best find was none with a value of 0. That's no good, so not consuming and moving on.
Finished.
Spent 80 meat. Gained Fullness: 14. Inebriety: 0. Spleen: 0. Adventures: 51. Muscle: 34. Moxie: 41. Mysticality: 98.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
Just changed the Genalen check to a 'none' check. Apparently the data file works fine now... not sure what the issue used to be.
 
Top