i made a mall price checker how do i...

ammy55

New member
i made a mall price checker to check the super cocktail crafting final prices and i want to know what i need to put to make it show the lowest priced of all the drinks

Code:
mall_price Neuromancer;
mall_price stratocaster;
mall_price Mon Tiki;
mall_price teqiwila slammer;
mall_price Divine;
mall_price Gordon Bennett;
mall_price gimlet;
mall_price yellow brick road;
mall_price mandarina colada;
mall_price tangarita;
mall_price Mae West;
mall_price prussian cathouse
//import skynet
//activate skynet

it may be very minimal but its my first script
 

Spiny

Member
The short answer is you can't. For the purpose of scripting, mafia only makes it easy to ascertain the cost of the 5th instance of any given item. This is one of many safeguards in place to prevent the creation of a mallbot using mafia. Based on what you pasted above though, perhaps the CLI command cheapest would be of use. Just do:

Code:
cheapest +Mon tiki

The + represents the zap group, so any drink in the same zap group as the Mon tiki would get searched for using a live searchmall function once per session, thereafter the price would be cached and stored into the table of prices used for historical_price.

Hope that helps.
 

Bale

Minion
What Spiny says is very important about mafia's ability to check price, but as long as we're discussing ways to find the cheapest superhuman cocktail, I like doing things the hard way. This may be more useful if you intend to use the result as part of a script.

Code:
void cheapest_first (item [int] commodity) {
	int [item] price;
	foreach key in commodity
		if(historical_age(commodity[key]) >1)
			price[ commodity[key] ] = mall_price(commodity[key]);
		else
			price[ commodity[key] ] = historical_price(commodity[key]);
	sort commodity by price[value];
}

item cheapest_shc() {
	item [int] drinkies;
	foreach key in $items[Neuromancer, stratocaster, Mon Tiki, teqiwila slammer, Divine, Gordon Bennett, gimlet, yellow brick road,
	  mandarina colada, tangarita, Mae West, prussian cathouse];
		drinkies[count(drinkies)] = key;
	cheapest_first(drinkies);
	return drinkies[0];
}

main() {
	print("Cheapest Superhuman Cocktail is: "+ cheapest_shc());
}
 

ki77bot

Member
hmmm, doesn't work that way...

Code:
Expected }, found ;

there are probably only some {} missing, but I couldn't find 'em.

Cheers & Happy Crimbo
ki77bot
 

Bale

Minion
I just wrote it off the top of my head without bothering to verify. Syntax fixing isn't that hard; there was an extra semi-colon. Here, fixed.

Code:
void cheapest_first (item [int] commodity) {
	int [item] price;
	foreach key in commodity
		if(historical_age(commodity[key]) >0.5)
			price[ commodity[key] ] = mall_price(commodity[key]);
		else
			price[ commodity[key] ] = historical_price(commodity[key]);
	sort commodity by price[value];
}

item cheapest_shc() {
	item [int] drinkies;
	foreach key in $items[Neuromancer, stratocaster, Mon Tiki, teqiwila slammer, Divine, Gordon Bennett, gimlet, yellow brick road,
	  mandarina colada, tangarita, Mae West, prussian cathouse]
		drinkies[count(drinkies)] = key;
	cheapest_first(drinkies);
	return drinkies[0];
}

void main() {
	print("Cheapest Superhuman Cocktail is: "+ cheapest_shc());
}
 

ammy55

New member
thanks bale & Spiny

EDIT: just edited the script now it works for hi mein's
 
Last edited:

mottsy

Member
Code:
void cheapest_first (item [int] commodity) {
	int [item] price;
	foreach key in commodity
		if(historical_age(commodity[key]) >0.5)
			price[ commodity[key] ] = mall_price(commodity[key]);
		else
			price[ commodity[key] ] = historical_price(commodity[key]);
	sort commodity by price[value];
}

item cheapest_himein() {
	item [int] Noms;
	foreach key in $items[Hot hi mein, cold hi mein, stinky hi mein, spooky hi mein, sleazy hi mein ]
		Noms[count(Noms)] = key;
	cheapest_first(Noms);
	return Noms[0];
}

void main() {
	print("Cheapest hi mein is: "+ cheapest_himein());
cli_execute(" eat noms");
}

Is that how you'd do a auto buy and eat hi mein script?


Also: if there is a cheapest function, is there a most expensive function too.

Buy cheapest drink, make and mallsell most expensive
 
Last edited:

Winterbay

Active member
There is indeed an "expensive" command. "Expensive +mon tiki" gives the same result as "cheapest +mon tiki" only in reverse.
 

mredge73

Member
cli_execute(" eat noms");
That line won't work for many reasons.

You are looking for the ash eat or eatsilent command:
retrieve (x, cheapest_himein() );
eat(x, cheapest_himein() );
X is how many you want to retrieve and then eat.

To edit the cheapest_himein() function to return the most expensive item you need to change the return value to the last item on the list opposed to the first item:
return Noms[Count(Noms)-1];
 
Last edited:

mottsy

Member
cli_execute(" eat noms");
That line won't work for many reasons.

You are looking for the ash eat or eatsilent command:
retrieve (x, cheapest_himein() );
eat(x, cheapest_himein() );
X is how many you want to retrieve and then eat.

To edit the cheapest_himein() function to return the most expensive item you need to change the return value to the last item on the list opposed to the first item:
return Noms[Count(Noms)-1];


Thanks
 
Although, perhaps use a variable to store the hi-mein you're after.

Example: the cheapest hi mein in the mall is a hot one, at 500 meat. The next cheapest is a cold one, at 600 meat.

Executing the code above would work out as:
retrieve (x, $item[hot hi mein] );
eat (x, $item[cold hi mein] );

.. Because the "cheapest one" is now the cold one.. yes?
 

mredge73

Member
Even using mall_price(), it will only pull the 5th highest price from the mall once a mafia instance.
The cheapest_himein() function builds a map based off of price information stored in mafia after the first run of the function.
So executing the function twice in a row will not yield different results even if the mall prices change after buying.
 
Top