Sushi script

Winterbay

Active member
I am currently trying to write ascript that will calculate the best sushi to eat in turns of meat/turn of fishy (might be extended to other things as well, but you need to start somewhere). The current script (included below) prints a degub-log when I try to verify it, and since my skills of interpreting debug-logs are limited I come to the forums for help. Debug-log attached.

I started out by trying to have 1 record for all types of sushi and use a dummy-ingredient for those that were not needed but that also gave a debug-log (with the number 3 exchanged for the number 7).

PHP:
record sushiparts
{
	item name;
	int price;
};

record base_sushi
{
	sushiparts ingredient1;
	int total_cost;
	int fishy;
};

record nigri_sushi
{
	sushiparts ingredient1;
	sushiparts ingredient2;
	int total_cost;
	int fishy;
};

sushiparts[int] meat;
meat[1] = new sushiparts($item[beefy fish meat],mall_price($item[beefy fish meat]));
meat[2] = new sushiparts($item[glistening fish meat],mall_price($item[glistening fish meat]));
meat[3] = new sushiparts($item[slick fish meat],mall_price($item[slick fish meat]));

sushiparts[int] topping;
topping[1] = new sushiparts($item[eel sauce],mall_price($item[eel sauce]));
topping[2] = new sushiparts($item[dragonfish caviar],mall_price($item[dragonfish caviar]));
topping[3] = new sushiparts($item[sea salt crystal],mall_price($item[sea salt crystal]));

sushiparts[int] filling;
filling[1] = new sushiparts($item[sea avocado],mall_price($item[sea avocado]));
filling[2] = new sushiparts($item[sea carrot],mall_price($item[sea carrot]));
filling[3] = new sushiparts($item[sea cucumber],mall_price($item[sea cucumber]));
filling[4] = new sushiparts($item[sea radish],mall_price($item[sea radish]));

sushiparts[int] basics;
basics[1] = new sushiparts($item[white rice],mall_price($item[white rice]));
basics[2] = new sushiparts($item[seaweed],mall_price($item[seaweed]));

base_sushi[item] base;
base[$item[beefy fish meat]] = new base_sushi(meat[1],meat[1].price,5);
base[$item[glistening fish meat]] = new base_sushi(meat[2],meat[2].price,5);
base[$item[slick fish meat]] = new base_sushi(meat[3],meat[3].price,,5);

nigri_sushi[item] nigri;
int[int] total
for i from 1 to 3
{
	total[i] = meat[i].price + basics[i].price;
}
nigri[$item[beefy nigri]] = new nigri_sushi(meat[1],basics[1],total[1],20);
 

philmasterplus

Active member
The line
PHP:
base[$item[slick fish meat]] = new base_sushi(meat[3],meat[3].price,,5);
has an extra comma, and the line
PHP:
int[int] total
is missing a semicolon. Also, it's "nigiri" with three i's.

Hope it helps.
 

Winterbay

Active member
Thank you. That seems to have solved that part. Now I only need to find a new way of sorting things since apparently the item-names of the sushi are not valid item names in mafia (fully understandable since they have not item-numbers either).
 

Veracity

Developer
Staff member
Revision 8614 fixes the stack trace. Now it will tell you "Too many field initializers for record base_sushi".
 

Winterbay

Active member
So he did. I should take alook at that and see if there are things that it does better than mine. What mine mainly does (currently) is calculate things and display them giving you a view of how much a turn of fishy is going to cost you. Interstingly enough the advanced toppings do not seem to be worth their price at all. Not when considering only fishy turns at least.
Without taking the gained adventures into account it is in fact so that the most cost efficient way to gain turns of fishy is to use a basic maki.
 
Top