Well I kinda cleaned up and fixed a couple things. You didn't have all the script posted so I just put the missing variables at the top and gave em generic definitions. Probably can clean it up a bit more but not sure what the situation is. Is this an OnClosed script?
Edit: Ok just reread above and cleaned the script up a bit more. Hopefully it gets you closer.
void main()
{
object oPC = GetLastClosedBy();
object oPot = OBJECT_SELF;
int iCount = 0;//?
int iBaseCount = 0;//?
int iCapacity = 0;//?
string sBaseType = "";//?
object oTest = GetFirstItemInInventory(oPot);
while(GetIsObjectValid(oTest))
{
if(GetStringLeft(GetTag(oTest), 12) != "mzs_cooking_")
{
SendMessageToPC (oPC, "You can't cook this.");
return;
}
if(GetTag(oTest) == "mzs_cooking_base")
{
iBaseCount ++;
}
if (GetStringLeft(GetTag(oTest), 12) == "mzs_cooking_" &&
GetStringRight (GetTag(oTest), 5) != "_base")
{
//Trying to get ints from individual items, in any order, hasn't worked here.
iCount ++;
}
oTest = GetNextItemInInventory(oPot);
}
if (iBaseCount == 0)
{
SendMessageToPC (oPC, "You need something to cook in.");
}
else if (iBaseCount > 1)
{
SendMessageToPC (oPC, "You can't have more than one cooking appliance on the stove at a time.");
}
else if (iBaseCount == 1)
{
if(iCount > iCapacity)
{
SendMessageToPC (oPC, "There's too much stuff to cook properly.");
return;
}
else if (iCount <= iCapacity)
{
SetLocalString (OBJECT_SELF, "Cooking", sBaseType);
string sIng1 = GetTag(oTest);
SetLocalString (OBJECT_SELF, "Ingredient1", "" +sIng1+ "");
//Nor here.
SendMessageToPC (oPC, "DEBUG: Base Type: " +sBaseType+ "");
SendMessageToPC (oPC, "DEBUG: Capacity is: " + IntToString(iCapacity)+
", Item count is: " + IntToString(iCount)+ " ");
}
}
}
Modifié par GhostOfGod, 29 février 2012 - 06:16 .