Can someone help fix this code I'm trying to work with. I'm not sure why its not working but I'm not the best coder. Could use some assistance.
Code:
public string seedchoice = "Azalea Seed";
public uint skill;
public int gtime;
public string descr;
public string name;
public DoodadObject GetBestNearestdood()
{
DoodadObject dood = null;
double dist = 999999;
foreach (var Obj in getDoodads())
{
//If there is any Doodads that we looking for in this zone
if (Obj.uniqOwnerId == me.uniqId)
{
if (Obj.growthTime < 1)
{
dood = Obj;
dist = me.dist(Obj);
gtime = Obj.growthTime;
}
}
}
return dood;
}
public void PluginRun()
{
SetGroupStatus("Farm", false); //Add checkbox to our character widget
while (true)
{
if (GetGroupStatus("Farm"))
{
DoodadObject bestdood = null;
bestdood = GetBestNearestdood();
if (bestdood != null)
{
while (GetGroupStatus("Farm") && bestdood != null)
{
var skills = bestdood.getUseSkills();
if (skills.Count > 0)
{
skill = skills[0].id;
descr = skills[0].desc;
name = skills[0].name;
UseDoodadSkill(skill, bestdood, true);
bestdood = GetBestNearestdood();
}
Thread.Sleep(50);
}
Thread.Sleep(50);
}
//PlantItemsAtFarm(seedchoice, 21144);
Thread.Sleep(50);
}
Thread.Sleep(50);
}
Thread.Sleep(50);
}
}
}