我以前是学VB的,所以对于以下程序不是很理解,该程序运行了一次就结束了,我想让他不断的循环,请教高手,如何实现呢?
--------------------------------------------------
bool ShiftStory(int WareID)
{
if(IsWareUpStair(WareID) == 1)
{
if(Value("IsManUpStair") !=1)
{
GoUpStair(0);
}
if(Value("IsManUpStair") != 1)
{
ShowText("GoUpStair Error");
return false;
}
}
else
{
if(Value("IsManUpStair") == 1)
{
GoDownStair(0);
}
if(Value("IsManUpStair") == 1)
{
ShowText("GoDownStair Error");
return false;
}
}
return true;
}
bool ScriptContinueMakeItem(int ItemID)
{
if(ContinueMakeItem(ItemID) == 1)
{
while(IsMakingItem(ItemID) == 1)
{
Yield(0);
}
ShowText("Complete Make Item");
return true;
}
return false;
}
int MakeItem37247(int ItemCount)
{
if(IsFindItem(37247,ItemCount) == 1)
{
return 1;
}
return 0;
}
int MakeItem40035(int ItemCount)
{
if(IsFindItem(40035,ItemCount) == 1)
{
return 1;
}
return 0;
}
int MakeItem41142(int ItemCount)
{
if(IsFindItem(41142,ItemCount) == 1)
{
return 1;
}
if(IsHaveNecessaryItem(41142) != 1)
{
ShowText("Have not NecessaryItem 41142");
return 0;
}
if(!ShiftStory(39075))
{
return 0;
}
ScriptContinueMakeItem(41142);
if(IsFindItem(41142,ItemCount) == 1)
{
return 1;
}
int Count = 0;
int SubCount;
while(Count < ItemCount)
{
MakeItem41142Material();
if(MakeItem(41142) != 1)
{
SubCount = 0;
int Succ = 0;
while(SubCount < 2)
{
MakeItem41142Material();
if(MakeItem(41142) == 1)
{
Succ = 1;
break;
}
SubCount++;
Yield(0);
}
if(Succ == 0)
{
ShowText("MakeItem(41142) Failure");
return 0;
}
}
while(IsMakingItem(41142) == 1)
{
RefreshStat("IsMakingItem41142");
Yield(0);
}
if(IsFindItem(41142,ItemCount) == 1)
{
break;
}
Count++;
Yield(0);
}
if(IsFindItem(41142,ItemCount) == 1)
{
return 1;
}
return 0;
}
void MakeItem41142Material()
{
if(MakeItem37247(1) == 0)
{
ShowText("Make Item 37247 Failure");
return;
}
if(MakeItem40035(5) == 0)
{
ShowText("Make Item 40035 Failure");
return;
}
}
int MakeItem40030(int ItemCount)
{
if(IsFindItem(40030,ItemCount) == 1)
{
return 1;
}
return 0;
}
int MakeItem41052(int ItemCount)
{
if(IsFindItem(41052,ItemCount) == 1)
{
return 1;
}
if(IsHaveNecessaryItem(41052) != 1)
{
ShowText("Have not NecessaryItem 41052");
return 0;
}
if(!ShiftStory(39075))
{
return 0;
}
ScriptContinueMakeItem(41052);
if(IsFindItem(41052,ItemCount) == 1)
{
return 1;
}
int Count = 0;
int SubCount;
while(Count < ItemCount)
{
MakeItem41052Material();
if(MakeItem(41052) != 1)
{
SubCount = 0;
int Succ = 0;
while(SubCount < 2)
{
MakeItem41052Material();
if(MakeItem(41052) == 1)
{
Succ = 1;
break;
}
SubCount++;
Yield(0);
}
if(Succ == 0)
{
ShowText("MakeItem(41052) Failure");
return 0;
}
}
while(IsMakingItem(41052) == 1)
{
RefreshStat("IsMakingItem41052");
Yield(0);
}
if(IsFindItem(41052,ItemCount) == 1)
{
break;
}
Count++;
Yield(0);
}
if(IsFindItem(41052,ItemCount) == 1)
{
return 1;
}
return 0;
}
void MakeItem41052Material()
{
if(MakeItem37247(1) == 0)
{
ShowText("Make Item 37247 Failure");
return;
}
if(MakeItem40030(5) == 0)
{
ShowText("Make Item 40030 Failure");
return;
}
}
void MakeItem32280()
{
if(IsHaveNecessaryItem(32280) != 1)
{
ShowText("Have not NecessaryItem 32280");
return;
}
if(!ShiftStory(38010))
{
return;
}
if(ScriptContinueMakeItem(32280))
{
return;
}
MakeItem32280Material();
if(MakeItem(32280) != 1)
{
int Count = 0;
int Succ = 0;
while(Count < 2)
{
MakeItem32280Material();
if(MakeItem(32280) == 1)
{
Succ = 1;
break;
}
Count++;
Yield(0);
}
if(Succ == 0)
{
ShowText("MakeItem(32280) Failure");
return;
}
}
while(IsMakingItem(32280) == 1)
{
RefreshStat("IsMakingItem32280");
Yield(0);
}
}
void MakeItem32280Material()
{
if(MakeItem41142(40) == 0)
{
ShowText("Make Item 41142 Failure");
return;
}
if(MakeItem41052(10) == 0)
{
ShowText("Make Item 41052 Failure");
return;
}
}
{
if (Value("InTent") ==0)
{
PutDownTent(0);
EnterTent(0);
if (Value("InTent") ==0)
{
ShowText("Enter Tent Fail");
return;
}
}
MakeItem32280();
}