Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-09-2006, 10:34 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Loop Limits

HTML Code:
function onCreated()
{
  for (temp.npc: findAreaNPCs(0, 0, 64, 64))
  {
    if (temp.npc.isInClass("testobject"))
    {
      temp.npc.destroy();
    }
  }
  
  for (temp.i = 0; temp.i < 100; temp.i++)
  {
    putNPC2(32, 32, "join testobject");
  }
  
  this.loops = 0;
  for (temp.i = 0; temp.i < 100; temp.i++)
  {
    this.loops++;
    
    temp.npcs = findAreaNPCs(0, 0, 64, 64);
    
    for (temp.npc: temp.npcs)
    {
      this.loops++;
    }
  }
}
This code generates a loop limit exceeded error. Yes, I know why - this.loops ends up over 10000.

Can it be changed so that a loop counter of "for (object: objectlist)" loop has less impact on the limit? Or it only starts counting if the list is modified inside the loop?

I'm trying to do something similar to the code above (related to checking for NPCs nearby, etc) but it dies out due to the loop limit.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.