A great script! (Sorry for the long post.)
I think I might be missing something. EatDrink (v2.4 using Mafia v13.6) tried to pull from stash to create a drink, but the pull failed. The ingredient was in the stash but I did not have enough karma to make the pull. (Yeah, I know - donate to the clan stash and this is not an issue. What if I were not in a clan?)
The session log snippet is as follows:
remove from stash: 1 fermenting powder
FAIL: shot of blackberry schnapps lev:3 gain:1.0 adv:3.0 musc:6.0 myst:6.0 moxie:6.0 price:265 own:24 pull:false make:true value:2177
Calculating drink values.
Choosing drink to consume.
Attempting to consume...
Creating a shot of blackberry schnapps in 1 seconds
repeat - over and over and over
With the following settings, I assumed that the logic would do the following:
verify that I had access to all of the ingredients (if not, try next item),
would pull what was needed,
would verify that all of the ingredients were in inventory (pull successful),
then create the item and consume it.
Contrariwise, if the pull was unsuccessful (did not really have all of the ingredients):
would calculate the value of buying the missing ingredients against buying something else to eat/drink,
and do the appropriate thing.
// If true, you will buy food to consume that is not in inventory.
setvar("eatdrink_shop", true);
boolean SHOP = to_boolean(vars["eatdrink_shop"]);
// If true, you will make food if you have all the ingredients available.
setvar("eatdrink_make", true);
boolean MAKE = to_boolean(vars["eatdrink_make"]);
I can see five approaches:
set make to false
(easiest but not most cost effective)
donate to a clan
(lower middle - manually decide what to donate to get right karma level)
add a check for successful pull
(complicated - one chance or try next item - maybe like checking for all ingredients)
donate to a clan
(more complicated - automagically decide what to donate to get right karma level)
Decide whether to buy ingredients or move on
(most complicated - is it better to buy ingredient and make or buy something else)
CLI scripting I get. ASH I am still trying to understand. I guess that comes from programming in assembler instead of higher level languages -
Like BASIC.