// check afteer fPeriod seconds and every fPeriod after
// until no more than fTotTime secs have passed.
void ScheduleEquipReporting(object oCreature, int InventorySlot, float fPeriod, float fTotTime)
{
float fTime;
for (fTime=fPeriod; fTime<=fTotTime; fTime=fTime+fPeriod)
DelayCommand(fTime,ReportEquip(oCreature,InventorySlot));
}It causes the Toolset to generate a "NON INTGNON INTEGER EXPRESSION WHERE INTEGER REQUIRED" error on the line with the for statement. I also tried that line as for (fTime=fPeriod; IntToFloat(fTime<=fTotTime); fTime=fTime+fPeriod)and got the same error.
But the following works fine
// check afteer fPeriod seconds and every fPeriod after
// until no more than fTotTime secs have passed.
void ScheduleEquipReporting(object oCreature, int InventorySlot, float fPeriod, float fTotTime)
{
int i;
for (i=1; i<=FloatToInt(fTotTime/fPeriod); i++)
DelayCommand(i*fPeriod,ReportEquip(oCreature,InventorySlot));
}There doesn't really seem to be any functional difference except that the second version (which is slightly less readable, for my purposes) is more integer-centric. I didn't see any special notes in the Lexicon indicating restrictions on the data types used in for-loop expressions. What am I missing here?
Modifié par MrZork, 05 juin 2011 - 03:05 .





Retour en haut







