efilnikufecin
Member
The code below is intended to handle the mushroom fields. It has a variable "MushroomToFarm" which is the type of mushroom wanted. It is a part of a much larger script "icyPeak.ash", so I added another variable to turn off handling the mushroom fields.
The way it is supposed to work is if you want the script to handle the mushroom fields, and you are a muscle sign the script will harvest the field. Then if any of the correct mushrooms were obtained it will plant the field.
My reason for the "if any of the correct mushrooms were obtained" part is without it if the script is called a second time the field plant command will pick the spore, then plant a new one. The harvest command only picks full grown mushrooms. Having the condition of obtaining mushrooms saves 800 meat each time the script is ran after the first time in a day.
The problem is sometimes it works, and other times it does not. When it doesn't work, the field is left totally untouched. I've looked and looked and looked, and I cannot see the problem with it. I am hoping that maybe someone else will see what I am missing here.
The way it is supposed to work is if you want the script to handle the mushroom fields, and you are a muscle sign the script will harvest the field. Then if any of the correct mushrooms were obtained it will plant the field.
My reason for the "if any of the correct mushrooms were obtained" part is without it if the script is called a second time the field plant command will pick the spore, then plant a new one. The harvest command only picks full grown mushrooms. Having the condition of obtaining mushrooms saves 800 meat each time the script is ran after the first time in a day.
The problem is sometimes it works, and other times it does not. When it doesn't work, the field is left totally untouched. I've looked and looked and looked, and I cannot see the problem with it. I am hoping that maybe someone else will see what I am missing here.
Code:
item MushroomToFarm = $item[knoll mushroom];
boolean DoFields= True;
Boolean IsZodiacStat(stat Test)
{
if(Test == $Stat[Muscle]){if(my_zodiac() == $zodiac[wallaby] || my_zodiac() == $zodiac[vole] || my_zodiac() == $zodiac[mongoose]){return true;}}
if(Test == $Stat[Mysticality]){if(my_zodiac() == $zodiac[Platypus] || my_zodiac() == $zodiac[Opossum] || my_zodiac() == $zodiac[Marmot]){return true;}}
if(Test == $Stat[Moxie]){if(my_zodiac() == $zodiac[Wombat] || my_zodiac() == $zodiac[Blender] || my_zodiac() == $zodiac[Packrat]){return true;}}
return false;
}
void DoMushroomFields()
{
//MushroomToFarm is declared, and initialized at the top of this script.
//It will be assumed that the field has already been purchased.
int PreFarmShrooms;
int iterations;
PreFarmShrooms = item_amount(MushroomToFarm);
cli_execute("field harvest");
if(item_amount(MushroomToFarm) > PreFarmShrooms)
{
iterations = 1;
While(iterations != 17)
{
cli_execute("field plant " + int_to_string(iterations) + " " + MushroomToFarm);
iterations = iterations + 1;
}
}
}
void main()
{
if(DoFields && IsZodiacStat($stat[muscle])){DoMushroomFields();}
}