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

slyz

Developer
I can't seem to reproduce this by running EatDrink.ash or by copying only update_from_mafia() and all the required bits of code.

EDIT: I tried with a Genalen bottle in my inventory, but I still couldn't reproduce. In the version I just downloaded from the first opst of this thread, line 989 corresponds to a foreach in update_from_mafia(). At that point, the script doesn't do any check of your inventory.
 
Last edited:

tebee

Member
Nope I've no Genalen bottles in my inventory - but I would say I only run Eatdrink as part of ascend and I noticed the other person was having the problem there. I've also not had the problem today after eating and drinking manually yesterday.

For the rest of the time I run my own home-brewed script - it's probably not as efficient as eatdrink but as I wrote it I know what it does and I haven't had the time to investigate eatdrink.ash and understand what it is doing !

Oh and line 989 is " foreach it in temp_map" in my version of eatdrink.ash
 

slyz

Developer
In the version I downloaded from this thread, line 989 is the closing bracket for the foreach you mention. Are you sure you don't have another version of EatDrink.ash in your /data or /scripts subfolders?
 

Theraze

Active member
Not just data and scripts... anywhere in the mafia folders. I had issues when I tried to store a script in the root program folder temporarily to keep it out of reach... still ran. :)
 

Banana Lord

Member
I'm having the same issue with line 989:
Code:
Eating 1 handful of nuts and berries...
You gain 5 Adventures
You gain 59 Enchantedness
You lose some of an effect: Got Milk
Finished eating 1 handful of nuts and berries.
4: handful of nuts and berries lev:12 gain:1.0 adv:4.0 musc:0.0 myst:55.0 mox:0.0 meat:670 own:0 value:2105
Pass 2: drink.
drink: At 0, consuming to 19.
Loading drink map from Mafia's datafiles
Map modified within foreach (eatdrink.ash, line 989)
Script was running fine before I updated my build.
 

Theraze

Active member
Do you possibly have EatDrink in your mafia folders (anywhere in there) multiple times? REALLY wish it were possible to actually look at one of the cases where people are having the problem, but...

On the probable culprit side of things, do you either have Genalen bottles in your inventory, or are you currently SC/CC?
 

tebee

Member
In the version I downloaded from this thread, line 989 is the closing bracket for the foreach you mention.
Oops - I've just confirmed something I suspected for a while - I need a new reading glasses prescription in my vari-focal lenses - this line I gave you was 969 not 989! it's as you say in mine so we do appear to have the same version.
 

Chad Sexington

New member
I didn't expect so many replies so quickly, sorry for not responding earlier.

I don't have any genalen either. Also, I kicked off my daily run of ascend just now and it seems to be running eatdrink just fine. I didn't change anything since yesterday, so I don't know what the deal is. Either way, thanks for all the quick responses.
 

kain

Member
I've merged the mood code back into my current version of 3.1.1 ... personally, I liked the ability to shrug off a song to make sure booze fits, but I understand how your mood might get stuck.

If I wrote code to make using a mood optional, could it perhaps be added back into the official version? Perhaps with a default of false?
 

fronobulax

Developer
Staff member
@kain - configurable and optional sounds like a win. I'd be glad to include it.

@map modifiers - AFAIK that message means a script is looping over a map and it attempts to delete an entry in the map from within the loop. EatDrink shouldn't do that :) I am somewhat short of time at the moment, but I recall cases where EatDrink would put candidate items in a map and then delete them if they cannot be consumed. So I would look for the things that keep EatDrink from doing what it wants - running out of meat to buy ingredients, make consumables or repair boxen. 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.

Note that some of the above may depend upon mafia settings as well as character attributes.
 

slyz

Developer
Could someone who can reproduce the problem add this before the foreach on line 969:
PHP:
temp_map.count().print();
 

tebee

Member
tebee, SC/CC/post-NS?

SC, recently ascended character

I've got identical versions of eatdrink.ash in my /script directory and the directory I'm running ascend from - If I remember rightly the one it the root scripts directory is that one that would be used, I take this has not changed while I've been away?
 

fronobulax

Developer
Staff member
SC, recently ascended character

I've got identical versions of eatdrink.ash in my /script directory and the directory I'm running ascend from - If I remember rightly the one it the root scripts directory is that one that would be used, I take this has not changed while I've been away?

Dunno, but mafia really works best when it runs from a directory that has sub-directories named scripts and data and ALL of the scripts are in the former and the data is in the latter. I'd consider deleting the version of EatDrink in the root and trying things.

Probably in red herring territory, but I can construct a scenario where the data files are not found, no error is generated, but attempts to iterate over the supposed contents fail. I could probably look at the code to eliminate this as a possibility but it is much more fun to throw it out as speculation and get someone else to do the investigative work ;-)

This does suggest that the "install Ascend" instructions need to be clearer. The zip file I made was intended to use the sub-directories but there are ways to unzip a file and ignore directory information.
 

Banana Lord

Member
Level 26 pastamancer, no genalen, don't have another copy of eatdrink. Interestingly this problem only occurs when I use 9173. Using 9172 the script runs as expected.
 

tebee

Member
with the extra line and verbosity2 on
Code:
Pass 1: food.
food: At 0, consuming to 15.
Loading food map from Mafia's datafiles
Loading fullness.txt.
fullness.txt loaded successfully.
403
Importing mafia info for 5013
Map modified within foreach (EatDrink.ash, line 990)
 

slyz

Developer
On this line:
PHP:
verbose2("Importing mafia info for "+it);
"it" should be an item name, not an item number. 5013 is wasabi poky... I wonder why some people get an int instead of $item[ wasabi poky ].
 
Last edited:
Top