Becoming an Omnivore

Donavin69

Member
Omnivore 1.0

This script requires ZLib

This script is designed to list all items you haven't consumed, the output is sorted by fullness/inebriety, and then by mall price. (it won't show you items that you can't buy)

Any suggestions, let me know.

Revision History:
0.1 Initial release (Nov 27, 2011)
0.2 Added Vars for eat, drink, usemilk, and limit. Will automatically consume if set to true.
0.3 Changed Acquire to Retrieve_item, added Total counters, and add up both total, and within limit items
0.4 Changed Total price counters to Float
0.5 Misc Tweaks to fix minor issues
0.6 Remove eating/drinking for items that hit both (Drunki-bears)
0.7 Removed the Retrieve_item to avoid buying an item that might be the daily special.
0.8 Added limit adjustment for autoBuyPriceLimit, other fixes
0.9 Rearrange code, reduce server hits and time to avoid checking prices on items already consumed.
1.0 Resolve properly for foods/drinks with partial name matches
 

Attachments

  • omnivore.ash
    6.8 KB · Views: 181
Last edited:

Donavin69

Member
I forgot to save it when I did it the first time, and you were very quick...and I already need to update it, with the correct page number for the versioning
 

Donavin69

Member
Updated with functioning version checking.

How do you find out what the post is before you post it? So you can post it with working version checking?
 

Donavin69

Member
Suggestion to make it auto-consume. I changed the sort order to sort by reverse fullness first, then price. It will consume the most filling item then the lesser ones.
Zlib vars added:
omnivore_eat - default of FALSE
omnivore_drink - default of FALSE
omnivore_limit - default of 100,000
omnivore_usemilk - default of TRUE
 

Theraze

Active member
Suggestion: Filtering out the items outside your omnivore_limit. Among other reasons, because with the max price booze items in the mall, the total cost for booze actually loops over and goes negative.

I've implemented it in my copy by turning each of the spots with
Code:
(price > 0)
into this:
Code:
(price > 0 && price < Omni_Limit)

There are 4 of them total... one for food/drink each while computing max fullness, and one each for food/drink on displaying/consuming. With this set and a max value of 100k, I get this now:
Total unconsumed food: 204 items, with a total mall price of: 1405622
Total unconsumed booze: 104 items, with a total mall price of: 1220218
Not that I'm likely to spend the 2.6 million in the next few weeks to pick up on these, but that's a lot more reasonable than:
Total unconsumed food: 211 items, with a total mall price of: 6446612
Total unconsumed booze: 126 items, with a total mall price of: -2007106957

What I am likely to take advantage of though...
ashq import <omnivore> Omni_Limit=1000; omnivore();
<snip>
Total unconsumed food: 73 items, with a total mall price of: 29612
Total unconsumed booze: 28 items, with a total mall price of: 10750
100 items for about 40k? Sure, I can do that! :D

Edit: One question... the CLI command acquire is functionally equivalent to the ASH command retrieve_item, right? If so, can keep it in ASH by just doing retrieve_item(1, food[cntr]) instead of using the current acquire through CLI bit. :)
 
Last edited:

Donavin69

Member
Suggestion: Filtering out the items outside your omnivore_limit.
Code:
(price > 0 && price < Omni_Limit)

I do only buy items up to your limit, but I list them all (things like the TPS drinks are really expensive in the mall, but it prompted me to borrow a TPS for a day)
I added some code to add up the items within your limit also (it still rolls over and becomes negative on the total):

Total unconsumed food: 156 items, 317 fullness, with a total mall price of: 5707069
Total unconsumed booze: 60 items, 147 with a total mall price of: -1821064298
Unconsumed food within limit: 152 items, 309 with a total mall price of: 1009069
Unconsumed booze within limit: 50 items, 125 with a total mall price of: 437002
For all items, including those above your limit -- MaxFull: 7 -- MaxDrunk: 6

CLI command acquire is functionally equivalent to the ASH command retrieve_item, right? If so, can keep it in ASH by just doing retrieve_item(1, food[cntr])

Thank you!, I wasn't sure if retreive_item was equivalent, and couldn't find anything to confirm it (since I wrote it while already full and drunk, couldn't test that) I liked the acquire option over mallbuy because it would make it if it would make it if it was cheaper.

I'm thinking about adding another variable (or two). There are a lot of items that aren't buyable (a lot that aren't even obtainable in any other method now). You can still obtain the consumption listing by using tacos/thermoses. So I'm thinking about adding variables Omni_Taco & Omni_Thermos, I'll default them to false, but it will check for the consumption listing for those special items and use the tacos/thermoses to get those consumption items too. Thoughts?
 
Last edited:

Theraze

Active member
Sounds like a good plan.

And part of the reason I had for suggesting cutting out the above-limit was due to the problems with ints and the boundary... this isn't exactly useful:
Total unconsumed food: 221 items, 470 fullness, with a total mall price of: 6382621
Total unconsumed booze: 126 items, 356 with a total mall price of: -2007123084
Can turn the total costs into floats if you like, which makes them potentially less accurate, but gives a better ballpark figure...
Total unconsumed food: 221 items, 470 fullness, with a total mall price of: 6382621.0
Total unconsumed booze: 126 items, 356 with a total mall price of: 6.5828127E9
 

Theraze

Active member
One more thing I've noticed. Apparently currently the limit checks are mixed between < and <=, so it will say that items are within your limit but it will skip them. The fix is to make them both consistent...
 

Donavin69

Member
That's apparently one of the little tweaks I've made in my version...I've uploaded a new copy of the current version.

Current to-dos: Add in all the 'Taco only/Thermos only' foods/drinks...(maybe assume if it is over the limit to try for them with tacos/thermos)
 

Donavin69

Member
The drunki-bears are listed as both food and drink, but are not booze (they are food that gets you drunk...kinda like rum-cake). So Omnivore would crash if that was the thing selected to drink. I've uploaded a new version that excludes eating or drinking anything that hits both.
 

Theraze

Active member
One note from a recent change in EatDrink... daily special items. You can check if they're available by doing something like this, which also looks for items buyable from the shopkeepers but not the mall, like mugcakes and so on...
Code:
int check_price(item shopfor) {
   if(npc_price(shopfor) > 0))
      return npc_price(shopfor);
   else if(daily_special() == shopfor)
      return autosell_price(shopfor) * 3;
   else if(historical_age(shopfor) > 1)
      return mall_price(shopfor);
   return historical_price(shopfor);
}
 

Theraze

Active member
Welcome. :) I'd somehow managed to forget that the cheapest bad consumable is the mugcake... for 20 meat, you can increase your adventures by 1. Half the meat of the fortune cookie if you already know your counter or are avoiding them for some reason. :) That's one of the items that I found when that got added to ED.
 

Theraze

Active member
Found a problem with the daily_special addition. Omnivore always tries to manually retrieve the item first, but that doesn't work on the daily item, since it's automatically consumed, so retrieve_item will buy from the mall, then consume from the store. Like so:
Searching for "unfortunate dumplings"...
Search complete.
Purchasing unfortunate dumplings (1 @ 8,484)...
You acquire an item: unfortunate dumplings
Purchases complete.
Purchasing unfortunate dumplings at the Chez Snootée...
You acquire an effect: Really Quite Poisoned (duration: 20 Adventures)
You lose 73 hit points
You gain 3 Fullness
You spent 45 Meat
Goodie purchased.
8484 meat spent in addition to the 45 actually needed... this could get QUITE pricey if it's something more rare. :)

What I've done is made the retrieve_item checks (one for food, one for booze) check if the item is NOT the daily special before moving on. Like so:
Code:
							if (daily_special() != food[cntr]) retrieve_item(1, food[cntr]);
							eat(1, food[cntr]);
Really, there's not too much reason to force the retrieve_item check... eat and drink will succeed or fail using exactly the same retrieval logic as retrieve_item uses, so those lines could be completely eliminated, but... that's your choice. :)
 

Donavin69

Member
Thanks Theraze! I'll remove the retrieve_item, and test that out...assuming it works OK, I'll publish the new version...
 

Theraze

Active member
Heh. Something funny about the release 0.7 is that it removes the NPC and Daily items again. :) To add them back in, change this:
Code:
int check_price(item shopfor) {
   if(historical_age(shopfor) > 1)
to this:
Code:
int check_price(item shopfor) {
   if(npc_price(shopfor) > 0)
      return npc_price(shopfor);
   else if(daily_special() == shopfor)
      return autosell_price(shopfor) * 3;
   else if(historical_age(shopfor) > 1)
Also, I added a can_interact check to my milk using, and a check for Glorious Lunch, to make it easier to (try to) take advantage of the daily special during Boris runs. I replaced this line:
Code:
						if((omni_usemilk) && (food[cntr].fullness > have_effect($effect[got milk]))) cli_execute("use milk of magnesium");
with this:
Code:
						if((omni_usemilk) && can_interact() && (food[cntr].fullness > have_effect($effect[got milk]))) cli_execute("use milk of magnesium");
						if((have_skill($skill[song of the glorious lunch])) && (food[cntr].fullness > have_effect($effect[song of glorious lunch]))) cli_execute("cast song of the glorious lunch");
Not sure if the milk change is always the best, since if you're a Sauceror you might legitimately have milk even without mall access, but... unlikely enough in my case that I liked the change. :)
 

Donavin69

Member
I'll add those checks, thanks again Theraze...One issue I had yesterday with NPC items...it finally got to a 'gift shop' item...that I didn't have access to yet...

Is there a good way to check for that availability, or would it need to be hard coded?
 
Top