Superhuman Cocktailcrafting script

Fluxxdog

Active member
v708 is up. Took the advice concerning records in to account. Defining EVERY SINGLE RECORD AND FIELD would be very counter productive for me, but it got me to learn how to properly use map_to_file and file_to_map. And yes, I used both. map_to_file to take all that work and make my data file, then just worked it in to the record ^^ Also added the ability to buy from the mall if you so choose.

v707 had a bug I discovered in my experiments with records. sort will only sort by the first key in an aggregate. While this would have no major effect since most people wouldn't have superbooze when they started, it was technically using incorrect information. Random sorting is out unless I can figure a way to test items at random rather than sequentially. Though I think I have an idea...
 

Fluxxdog

Active member
v709

New version uses an internal data file to build drinks recipes rather than supply an external one. This allows for fewer files. Also laid the ground work for making the profit version that has been asked for.

On thing that had me stumped from the get go. get_ingredients(). Nice function, but it fails at getting the ingredients for a Superbooze. get_ingredient($item[bottle of Domesticated Turkey]) returns nothing. Then I got to thinking about defaults.txt being used in that "prefref" alias. I didn't have it on my computer, but it was in the .jar file. This lead me to making the Outfit test script. Neither here nor there, I know. Then I put 2 and 2 together.

My biggest worry was converting concoctions.txt to a usable map. I only needed the Superitem, the mix method (BSTILL and MSTILL), and the base item for it. Wasn't sure if file_to_map() would let me load only to a 2 key aggregate when there were so many feilds. Lesson learned: file_to_map() will only load up as many keys as you specify in the map and then move to the next item. This makes abusing the internal data much easier.
 

slyz

Developer
I think get_ingredients() will only return the ingredients for concoctions you currently can make. What is the result of get_ingredient($item[bottle of Domesticated Turkey]) if you try it before using up all your available stills? I used mine already today, so I can't test.

If the goal of your script is to use the remaining available stills, you can probably use get_ingredients() instead of a data file.
 

Fluxxdog

Active member
Everytime I've tried it, it's returned nothing, no bottle of whiskey, no mention of a still. Of course, now that you mention it, I'm pretty sure I've tested it before with stills remaining. but I'm not sure now :/

update: I tried it and THIS time it worked with stills uses left. Could have sworn I tested it before and it didn't work. Oh well. Little change in the code and off to the races again. I'll put the simplified method in the next update when I start doing drink price comparison.
 
Last edited:

Fluxxdog

Active member
v710

New versions of my scripts up and ready.

Makings drinks for profit has been added in. Infused Sake and Salasious drinks are possible too.

This has been fun working and I think I can fit a few more options under the hood. For now, though, I'm letting this simmer, giving good stir if something is wrong.
 

Winterbay

Active member
Hmm... I see that your script runs into the same problem that my logout script did and that is that you can't force mafia to use the still and as such when you create a drink it will buy items if it feels that is better leading to a high amount of drinks being created without the still getting depleted.
I solved it in mine by setting my meat to 1k before it does anything which means it'll have to buy resources and use the still. Or is there a way to tell Mafia to use the still at all times if possible?
 

Theraze

Active member
Hmm... Personally, I use a tweaked version of Mr Edge's improve_spirits for still usage, with an additional variable added so I can tell it whether or not to buy for best resale or just to use the items in my inventory.
 

Fluxxdog

Active member
It wouldn't force it, but it should be using the cheapest way to make superdrinks. Unless valueOfAdventure and valueOfStill are set too high, this should invariably be fermenting base booze or buying it, buying the fruit, distilling both of them, mix, garnish. If you have any of the ingredients on hand, mafia should be using those.
If this is not what it's doing, I'd like to what it is doing so I can fix it. Can you give me details?
 

Winterbay

Active member
I currently have valueOfAdventure set to 500 and valueOfStill to 0 apparently.
My login-script currently does 1 turn in the castle before anythign else (to allow fortune cookie checking scripts a chance to eat a cookie before teh farming starts) however before it got to that part this happened:

Code:
 > Checking for updates (running ZLib ver. : 21)...
 > You have a current version of ZLib.
 > Checking for updates (running Best Between Battle Script Ever ver. 2.2)...
 > You have a current version of Best Between Battle Script Ever.
 > Checking for updates (running Superdrinks ver. 710)...
 > You have a current version of Superdrinks.
 > One teqiwila slammer coming up!

buy 1 teqiwila for 5000 each from 1792577 on 20101112
You acquire an item: teqiwila

Mix 1 teqiwila + 1 coconut shell
You acquire an item: teqiwila slammer
Crafting used 1 each of coconut shell and teqiwila
 > One tangarita coming up!

buy 1 tequila sunset for 4750 each from 1792577 on 20101112
You acquire an item: tequila sunset

Mix 1 tequila sunset + 1 magical ice cubes
You acquire an item: tangarita
Crafting used 1 each of magical ice cubes and tequila sunset
 > One prussian cathouse coming up!

buy 1 parisian cathouse for 5000 each from 1607966 on 20101112
You acquire an item: parisian cathouse

Mix 1 parisian cathouse + 1 magical ice cubes
You acquire an item: prussian cathouse
Crafting used 1 each of magical ice cubes and parisian cathouse
 > One mandarina colada coming up!

buy 1 zmobie for 4900 each from 1792577 on 20101112
You acquire an item: zmobie

Mix 1 zmobie + 1 magical ice cubes
You acquire an item: mandarina colada
Crafting used 1 each of magical ice cubes and zmobie
 > One gimlet coming up!

buy 1 bottle of Calcutta Emerald for 2200 each from 2140880 on 20101112
You acquire an item: bottle of Calcutta Emerald

Mix 1 bottle of Calcutta Emerald + 1 tonic water
You acquire an item: gin and tonic
Crafting used 1 each of bottle of Calcutta Emerald and tonic water

Mix 1 gin and tonic + 1 little paper umbrella
You acquire an item: gimlet
Crafting used 1 each of little paper umbrella and gin and tonic
 > One Neuromancer coming up!

buy 1 gibson for 5000 each from 1117265 on 20101112
You acquire an item: gibson

Mix 1 gibson + 1 coconut shell
You acquire an item: Neuromancer
Crafting used 1 each of coconut shell and gibson
 > One Mon Tiki coming up!

buy 1 caipifruta for 5000 each from 1117265 on 20101112
You acquire an item: caipifruta

Mix 1 caipifruta + 1 coconut shell
You acquire an item: Mon Tiki
You acquire an item: box
You acquire an item: beer lens
You acquire an item: beer lens
You acquire an item: broken skull
You acquire an item: salty dog
You acquire an item: salty dog
You acquire an item: papaya sling
Crafting used 1 each of coconut shell and caipifruta
Your bartender blew up

After which the script stopped. I rebuilt the bartender and restarted the farming-part and it went through the optimising and started to adventure at which point the following happened:

Code:
 > One Mae West coming up!

buy 1 magical ice cubes for 999 each from 1474380 on 20101112
You acquire an item: magical ice cubes

Mix 1 rabbit punch + 1 magical ice cubes
You acquire an item: Mae West
Crafting used 1 each of magical ice cubes and rabbit punch
 > One Gordon Bennett coming up!

buy 1 mimosette for 5095 each from 1644353 on 20101112
You acquire an item: mimosette

Mix 1 mimosette + 1 little paper umbrella
You acquire an item: Gordon Bennett
Crafting used 1 each of little paper umbrella and mimosette

buy 1 bottle of whiskey for 123 each from 1861025 on 20101112
You acquire an item: bottle of whiskey

buy 1 orange at market price from Hippy Store (Fratboy)
You acquire an item: orange
You spent 70 Meat
 > One Divine coming up!

Distill 1 bottle of whiskey
You acquire an item: bottle of Domesticated Turkey

Distill 1 orange
You acquire an item: kumquat

Mix 1 bottle of Domesticated Turkey + 1 kumquat
You acquire an item: whiskey bittersweet
Crafting used 1 each of bottle of Domesticated Turkey and kumquat

Mix 1 whiskey bittersweet + 1 little paper umbrella
You acquire an item: Divine
Crafting used 1 each of little paper umbrella and whiskey bittersweet
 > One yellow brick road coming up!

buy 1 bottle of Definit for 2400 each from 2162417 on 20101112
You acquire an item: bottle of Definit

Mix 1 bottle of Definit + 1 tonic water
You acquire an item: vodka and tonic
Crafting used 1 each of bottle of Definit and tonic water

Mix 1 vodka and tonic + 1 little paper umbrella
You acquire an item: yellow brick road
Crafting used 1 each of little paper umbrella and vodka and tonic
 > One vodka stratocaster coming up!

buy 1 vodka gibson for 5165 each from 666638 on 20101112
You acquire an item: vodka gibson

Mix 1 vodka gibson + 1 coconut shell
You acquire an item: vodka stratocaster
Crafting used 1 each of coconut shell and vodka gibson
 > One teqiwila slammer coming up!

buy 1 teqiwila for 5000 each from 784876 on 20101112
You acquire an item: teqiwila

Mix 1 teqiwila + 1 coconut shell
You acquire an item: teqiwila slammer
Crafting used 1 each of coconut shell and teqiwila
 > One tangarita coming up!

buy 1 tequila sunset for 4750 each from 1792577 on 20101112
You acquire an item: tequila sunset

buy 1 magical ice cubes for 1000 each from 2140880 on 20101112
You acquire an item: magical ice cubes

Mix 1 tequila sunset + 1 magical ice cubes
You acquire an item: tangarita
Crafting used 1 each of magical ice cubes and tequila sunset
 > One prussian cathouse coming up!

buy 1 parisian cathouse for 5000 each from 1607966 on 20101112
You acquire an item: parisian cathouse

buy 1 magical ice cubes for 1048 each from 294980 on 20101112
You acquire an item: magical ice cubes

Mix 1 parisian cathouse + 1 magical ice cubes
You acquire an item: prussian cathouse
Crafting used 1 each of magical ice cubes and parisian cathouse
 > One mandarina colada coming up!

buy 1 zmobie for 4900 each from 1792577 on 20101112
You acquire an item: zmobie

buy 1 magical ice cubes for 1048 each from 294980 on 20101112
You acquire an item: magical ice cubes

Mix 1 zmobie + 1 magical ice cubes
You acquire an item: mandarina colada
Crafting used 1 each of magical ice cubes and zmobie
 > One gimlet coming up!

buy 1 bottle of Calcutta Emerald for 2294 each from 2025299 on 20101112
You acquire an item: bottle of Calcutta Emerald

Mix 1 bottle of Calcutta Emerald + 1 tonic water
You acquire an item: gin and tonic
Crafting used 1 each of bottle of Calcutta Emerald and tonic water

Mix 1 gin and tonic + 1 little paper umbrella
You acquire an item: gimlet
Crafting used 1 each of little paper umbrella and gin and tonic
 > One Neuromancer coming up!

buy 1 bottle of gin for 117 each from 1877436 on 20101112
You acquire an item: bottle of gin

Distill 1 bottle of gin
You acquire an item: bottle of Calcutta Emerald

buy 1 olive at market price from Hippy Store (Fratboy)
You acquire an item: olive
You spent 70 Meat

Distill 1 olive
You acquire an item: cocktail onion

Mix 1 bottle of Calcutta Emerald + 1 cocktail onion
You acquire an item: gibson
Crafting used 1 each of bottle of Calcutta Emerald and cocktail onion

Mix 1 gibson + 1 coconut shell
You acquire an item: Neuromancer
Crafting used 1 each of coconut shell and gibson
 > One Mon Tiki coming up!

buy 1 bottle of rum for 100 each from 598713 on 20101112
You acquire an item: bottle of rum

Distill 1 bottle of rum
You acquire an item: bottle of Lieutenant Freeman

buy 1 lemon at market price from Hippy Store (Fratboy)
You acquire an item: lemon
You spent 70 Meat

Distill 1 lemon
You acquire an item: kiwi

Mix 1 bottle of Lieutenant Freeman + 1 kiwi
You acquire an item: caipifruta
Crafting used 1 each of bottle of Lieutenant Freeman and kiwi

Mix 1 caipifruta + 1 coconut shell
You acquire an item: Mon Tiki
Crafting used 1 each of coconut shell and caipifruta
 > One Mae West coming up!

buy 1 bottle of whiskey for 123 each from 1861025 on 20101112
You acquire an item: bottle of whiskey

Distill 1 bottle of whiskey
You acquire an item: bottle of Domesticated Turkey

buy 1 strawberry at market price from Hippy Store (Fratboy)
You acquire an item: strawberry
You spent 70 Meat

Distill 1 strawberry
You acquire an item: raspberry

Mix 1 bottle of Domesticated Turkey + 1 raspberry
You acquire an item: rabbit punch
Crafting used 1 each of bottle of Domesticated Turkey and raspberry

Here the script ran out of meat and I manually used up the two remaining still-uses to be sure :)
 

Fluxxdog

Active member
After I posted I realized what had happened and your post confirmed it.
Mafia is doing EXACTLY as it is told and programmed. It's checking if it can buy each ingredient before seeing if each ingredient can be made. <sigh> I completely overlooked that. I didn't remember coming across any problems like that but I may not have been testing properly.
I know what to do easily. I wish I had thought of it before. I'll have a new version up ASAP.
Edit: Knowing was the easy part. It's just gonna take some typing.
 

Fluxxdog

Active member
v711

Fixed it. I must have missed that in my testing. Very sorry. I still don't know how it slipped.

The return functions that caused part of the problem have been fixed and create()s have been added to ensure the recipes get mixed as they get bought.
 

Fluxxdog

Active member
v713

Alright! Much improved!
Cleaner code
Debug info available at verbosity 10 (zlib)
Mallselling is made easy by only handling the drinks the script makes (no repricing 999,999,999 items)
You can donate your drinks to your clan's stash!
Safeties added to help ascenders from losing drinks they would rather drink themselves.
Settings expanded (try the refine or the day setting for your preferred drink!)

All in all, I really love this script. I have to give big props to Zakmos and Gweneris for letting me test this on their accounts while I was babysitting them. Of course, they benefited from this as well. They now have quite the cache of SHC drinks to use and abuse.

Questions, comments, etc, feel free to post here or kmail me!
 
Last edited:

Fluxxdog

Active member
v714

Added Ooze-O processing in to the mix, especially considering how, since the market is fiendish for sewer items because of Elf Alley, is actually selling for quite a tidy profit. This would be one of the very few instances where I might recommend lowering the accuracy setting.

Also found a small bug that prevented mall stuffing or clan stashing if it couldn't make more drinks while processing.
 

zanmatoer

Member
Firstly, thanks for the great script :)

Secondly, could you add an option that would stop superdrinks firing if it would use up adventures? I run it as a separate script in aftercore, but I don't ever want it to use up turns!
 

Fluxxdog

Active member
Wow, this is old, sorry I haven't kept on it.

The script is using a mafia seting: requireBoxServants If true, it'll stop if you do not have a bartender in your campground. You have yours set to false, thus it will not check for a bartender and get right to the mixing.

Also, I'm going to keep this thread monitored in case any new updates come in. Never know.
 

Kenshiro70

New member
Anyone getting a "Missing return value (superdrinks.ash, line 174)" error? I've looked at the code but can't seem to see what the issue might be. It seems to be in here:

Code:
boolean bellyup(){
	if(prop_flag("requireBoxServants") && !have_bartender()){
		failure_print("Your bartender is gone and I ain't your lackey!");}
	else return true;}

I found if I added an extra return, as such, it works:

Code:
boolean bellyup(){
	if(prop_flag("requireBoxServants") && !have_bartender()){
		failure_print("Your bartender is gone and I ain't your lackey!"); [color=red]return false;[/color]}
	else return true;}

Also, I'm getting warnings for unreachable code in lines 150 and 358, but when I messed around with them the script stopped working, so I just let them be.
 

Fluxxdog

Active member
I haven't gotten any errors in months. Investigating...

Update: Somehow my copy got out of sync with the copy I have on here. I'm going to upload my updated version. The unreachable codes were breaks that were put after returns. Those are removed. Thanks for the heads up!
 
Last edited:
Ok, I downloaded both scripts you have in post #1 and moved them into my scripts folder. They both show up in my scripts drop down on my mafia screen, but not in my KOL main page drop down. When I try to run it from my Mafia screen the GCI says this:

> call scripts/superdrinks.ash

fluxxlib.ash could not be found (superdrinks.ash, line 3)


What am I doing wrong? How am I this dense?!?
 

Fluxxdog

Active member
Yeah, my bad. You should be able to change the <fluxxlib.ash> to <corelib.ash>. I'm very sorry. Since my personal libraries are so complex, I don't think it'd be proper to release them for general use. I'll get an update out ASAP. Thanks for the heads up.

Still thought I was more careful than that.
 
Top