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

heeheehee

Developer
Staff member
(Obviously, I never tested that line. I don't think it works -- Mafia doesn't seem to differentiate between separate parameters. Alias-writing time!)
 
Last edited:

illarion

Member
Sounds like it might be fixed:
------------------------------------------------------------------------
r8271 | jasonharper | 2010-03-14 22:18:47 +0000 (Sun, 14 Mar 2010) | 4 lines

Fix external lookup of ASH functions, as used by CLI invocation of a
namespace script, or to find a combat filter function. Previously, functions
with more than one parameter could never be found.


 
Except I tried it in 8277. Jason's fix was for something else. (I.e. if you are "using" a script with functions that have more than one parameter, those functions didn't actually show up in the namespace. Jason fixed it so they do. You still can't specify all their parameters in the CLI, though.)
 

codster62

Member
Hi, I was wondering if it's possible to have eatdrink.ash do something. When using farm.ash, it calls eatdrink.ash and usually almost 100% of the time picks out lo meins. Now that might be best adventure wise, but this last month, I have almost always seen hi meins at min. price that richer folk place out. For example, Senam had min. priced goods, and BigBlueEyes has spooky and cold hi mein at min. price with a limit of 3. If eatdrink.ash would search for those and buy the min. priced ones, that would be alot more cost affective. Is there a way it can be changed to search for and buy those items?
 

slyz

Developer
It won't be more cost effective, since you could buy them at min price, sell them in your store, and buy adventure effective food with that meat. If you are not getting more than your valueofadventure setting per adventure, your diet won't be more optimal because of min priced items.
 

codster62

Member
That's not what I meant. I did not mean re-sell the min. priced items, I meant for it to use them when available instead of buying other stuff at normal mall price.
 

Bale

Minion
If those hi meins are only available in limited quantities, then EatDrink isn't capable of noticing them. mall_price() returns the price for the 5th purchasable item. Since those hi meins are limit 3, EatDrink sees a higher purchase price for hi mein.
 

heeheehee

Developer
Staff member
Yeah, as has been pointed out many times before, A Moron is Me™. Your best bet would be to write a short script that imports eatdrink, then calls the function eatdrink() using those parameters.
 

slyz

Developer
See this thread to see an example of heeheehee's suggestion. Alternatively, the shortest way would be to alias this if you always use the same parameters:
Code:
alias eatdrink = ashq import <EatDrink.ash> eatdrink(15, 19, 15, false);
This method won't check to see if you have enough full/drunk/spleen left or not though, so accidentally using it twice will probably make you overdrink. For a script that checks this, check the link.
 

Winterbay

Active member
Isn't that alias declaration missing an ">"?
Also, I think the eat/drink script checks your current level against the target and should not overdrink if you run it twice with 19 as the drunkeness parameter.

Edit: That alias actually only calls the simulation of the eating and drinking. Is there any way to get it to actually set simulation to off as well?

Edit, edit:
This seems to actually do something as well. Since I'm already at 15/19/15 it passed all three, but when the false at the end changed to a true it drank a night-cap so it should in theory also work from 0/0/0.

Code:
alias eatdrink => ashq import <EatDrink_modified.ash>; SIM_CONSUME=false; eatdrink(15, 19, 15, false);
 
Last edited:

slyz

Developer
SIM_CONSUME is controlled by a zlib variable, and can be set once and for all via zlib eatdrink_simConsume = false. Thanks for pointing out the missing >, I always forget that one.

And you are right, I misunderstood the variables (I never actually used EatDrink ^^). What you put in is the target fulness/drunkness/spleen, not the amount to use.
 

icon315

Member
Is there a way to make it so that it only eat, drinks, etc. til it gets a certain amount of adv.?
EX: Eatdrink.ash til adv=200-maximize adv
 

heeheehee

Developer
Staff member
Run it a bunch of times, increasing fullnesslimit/inebrietylimit/spleenlimit slowly until you reach your goal for adventures (a while loop might be useful here, if you want to script it).
 

slyz

Developer
maximize adv won't give you a number, so you will have to

1) maximize adv
2) store the number of rollover advs:
Code:
int ROadvs = 40 + numeric_modifier("Bonus Rollover adventures");
Maybe adding the RO advs coming from your clan too.
3) run EatDrink.ash in a loop, as heeheehee said, increasing your maxfull/maxdrunk etc... until this condition is true:

my_adventures( ) + ROadvs >= 200
 

adeyke

Member
Of course, if you do it stepwise, you might end up getting less and/or spending more. That is, if you call it 15 times with 1 open fullness each time, it'll pick the best 1-fullness food each time, while if you call it once with 15 open fullness, it can instead use foods with 2 or more fullness, if they're better.
 

Winterbay

Active member
COuld anyone explain the following output from the script?

Code:
Loading drink map from Mafia's datafiles
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:

It seems to be rather redundant...
 

Muhandes

Member
This script is broken by "8382: Detect modification of a map within a foreach loop and throw a runtime error". You get the error:

Map modified within foreach (EatDrink.ash, line 1088)
 

Iaoth

New member
This script is broken by "8382: Detect modification of a map within a foreach loop and throw a runtime error". You get the error:

Map modified within foreach (EatDrink.ash, line 1088)

Anyone know how to fix this or what the problem is?
 
Top