Question about Mall Purchases with Mafia

GrinGrim

New member
Quick question: I have been considering making an end of day script and as part of it I intend to have it buy a lime and make a TPS drink: and it seems easy enough even for a relatively new scripter. But from what I understand Mafia is hard coded not to look at the few lowest mall prices - if you use the buy command instead of the command to check the mall price of an item does it follow this same restriction? I really don't want to use an end of day script that will waste meat, with there being lime sales as often as there are.
 

Veracity

Developer
Staff member
Mafia is hardcoded to not tell a script what the lowest mall price is. It will look up the mall prices and return the 5th lowest price. I.e., the price you will pay for the 5th item, should you buy that many. However, when a script actually buys items, Mafia will buy the cheapest available, which mean that the first 4 might actually be cheaper than your script expects.
 

GrinGrim

New member
Nice! Thank you very much - I could actually use that code to check for cheaper than normal cherries and giant olives as well for my nightcap. Though this coding gets more complicated the more I get into it - lol
 

GrinGrim

New member
Would it be considered mall-botting to check for a cheaper cherry/lime/whatnot for my nightcap before buying a full price one? I was actually thinking I should probably figure out how to have the script stop buying once it found one cheap one or brought a lime: but even so, I wouldn't want to get into botting territory.
 

Veracity

Developer
Staff member
KoLmafia will always buy the cheapest item for you. If you need 5 items, mall_price() will tell you the price of the 5th cheapest, and if you buy 5, you will pay no more than that price for any of them unless the price got switched in the fraction of a second between inquiring and purchasing. If you need one item, just buy it. You will get it for the cheapest price available. If you want to guard against price switching, use the 3 argument form of buy with the price returned by mall_price, as suggested by Theraze.

When you said "I could actually use that code to check for cheaper than normal cherries and giant olives", you are describing exactly what mallbots do.
 

Theraze

Active member
Sweet, Theraze. Way to enable mallbotting.
Maybe I need to remove 3-argument buy().

Sorry, I wasn't thinking that was mallbotting, just limiting yourself to not purchase above your limit. I thought that mall_price would still return the same thing as cheapest... is this not the case? :( I'll delete that post.
 

GrinGrim

New member
Eeek, I see what you mean! I was looking at it from the standpoint of it being what I would do if I was handling things manually, rather than grabbing things for resale and driving up prices: but I really don't want to cross that line.

I will stick to having it pull TPS from my clan stash, buy a lime, make the tps drink, cast ode, drink the tps drink, and put the sword back... And just reading that things are complicated enough without price comparing across fruits, even without the mall bot issue. lol

Say, is there any way to have mafia check the darkness level of the moons? I would love to be able to have it figure out if my grimicite rollover accessories are better than my other accessories on a given day and equip an outfit. It adds an entire new layer to it, but I really do want to learn how to do this stuff.
 
Last edited:

Theraze

Active member
Manually:
> moon

May 15, 2011 - Bor 2

Ronald: waxing crescent
Grimace: new moon
Mini-moon: behind Ronald

Dependence Day: 2 days
Arrrbor Day: 10 days
Labór Day: 20 days
Halloween: 30 days
Feast of Boris: 37 days
Yuletide: 42 days
Festival of Jarlsberg: 47 days
Valentine's Day: 58 days
St. Sneaky Pete's Day: 65 days
Oyster Egg Day: 72 days
El Dia De Los Muertos Borrachos: 80 days
Generic Summer Holiday: 89 days

3 days until Mysticism.
For scripts:
> ash moon_light()

Returned: 1
 

slyz

Developer
When you said "I could actually use that code to check for cheaper than normal cherries and giant olives", you are describing exactly what mallbots do.
I think he meant that he wanted to compare the prices of limes, cherries and jumbo olives. Usually, limes are the cheapest, but sometimes cherries or olives could be cheaper.
 

GrinGrim

New member
I think he meant that he wanted to compare the prices of limes, cherries and jumbo olives. Usually, limes are the cheapest, but sometimes cherries or olives could be cheaper.

When someone with developer under their name gets angry about your first post you just have to apologize and back away, lol. Besides, I suppose it shouldn't be on here anyways if it could be used for botting, and limes usually are cheaper :)

(Thanks for the moon command Theraze! Sorry for getting us yelled at :-S)
 

slyz

Developer
There wasn't any problem with the question in the OP =)
The purpose of mall_price() is to be able to check for mall prices without giving an answer precise enough to be usefull for mall bots. Using it to evaluate and compare the cost of making different items is perfectly reasonnable.

Here is the function I use in my consumption script to choose the cheapest TPS drink:
PHP:
item cheapest_TPSDrink()
{
	record {
		int price;
		item it;
		item mixer;
		item booze;
	} [ int ] TPSDrinks;

	TPSDrinks[ 0 ].it = $item[ bodyslam ];
	foreach it in get_related( $item[ bodyslam ], "zap" )
		TPSDrinks[ count( TPSDrinks ) ].it = it ;

	foreach n, rec in TPSDrinks
	{
		foreach ingred in get_ingredients( rec.it )
		{
			if ( get_ingredients( ingred ) contains $item[ tiny plastic sword ] )
				continue;
			
			foreach base_ingred in get_ingredients( ingred )
			{
				if ( get_ingredients( base_ingred ) contains $item[ fermenting powder ] )
					rec.booze = base_ingred;
				else rec.mixer = base_ingred;
			}
		}
		rec.price += get_price( rec.booze );
		rec.price += 2 * get_price( rec.mixer );
	}
	
	sort TPSDrinks by value.price;
	
	//foreach i, rec in TPSDrinks
	//	print( rec.it + " (" + rec.mixer + " + " + rec.booze + ", " + rec.price + " meat)" );
	
	return TPSDrinks[ 0 ].it;
}
 

GrinGrim

New member
There wasn't any problem with the question in the OP =)
The purpose of mall_price() is to be able to check for mall prices without giving an answer precise enough to be usefull for mall bots. Using it to evaluate and compare the cost of making different items is perfectly reasonnable.

Ooo, thanks! This actually looks like it will work really well - Now I just need to read the wiki and look up the commands until I understand it. And in the meantime this should still stop me from overspending if something is cheaper than normal :)
 

heeheehee

Developer
Staff member
Say, is there any way to have mafia check the darkness level of the moons? I would love to be able to have it figure out if my grimicite rollover accessories are better than my other accessories on a given day and equip an outfit. It adds an entire new layer to it, but I really do want to learn how to do this stuff.

Alternatively, for use in an ASH script, you could just use numeric_modifier($item[depleted grimacite grappling hook], "Adventures"). Since that actually takes grimacite darkness into account.
 

Theraze

Active member
Or if you're just planing on doing straight rollover in your logout script, you could just throw maximize adventures, -tie or (if doing it with ASH) maximize("adventures, -tie", false); into there... both will equip whatever mafia says today's best rollover set is... first is CLI command, second is ASH.
 
Last edited:

lostcalpolydude

Developer
Staff member
If you are going to use "maximize adv" (which implies -tie), make sure to "fold stinky cheese diaper" or "fold legion moondial" first, if applicable. You also have to add stuff if you want a time sword held by a disembodied hand.
 
Last edited:

fronobulax

Developer
Staff member
EatDrink already has logic that, according to various preferences and parameters, will decide which TPS drink can be acquired at the lowest cost. Given the #5 feature of mall_price it is certainly possible to construct a scenario where a different drink would be selected if #1 prices were available but that, in practice, is unlikely.

While fruit is often the price driver I have seen numerous cases where sangria del diablo is cheaper than a cherry bomb because it is cheaper to ferment the grapes myself.
 
Top