freezing

Posted by Kyrock on Tue 14 Jul 2009 09:22 PM — 3 posts, 16,080 views.

#0
for some reason when I set the j for loop to:
for (j = 0; j < theList.length; j++)

then mushClient freezes. I've also tried adding:
if (j < theList.length) {

before var affObj = new Affliction(theList[j]); (in bold) and ended up in the same result.

function sort(list)
{
  var listContents = world.getVariable(list);
  if (listContents != "" && listContents != " ")
  {
    if (listContents.search(",") >= 0)
    {
      var theList = listContents.split(",");world.note("theList length is: " + theList.length);
      world.setVariable(list,"");
      for (i = 0;i <= 99; i++)
      {
        for (j = 0; j <= theList.length; j++)
        {
          var affObj = new Affliction(theList[j]);
          
          if (i = affObj.order)
          {
            world.note(j);
            addItem(list,affObj.name);
          }
world.note("ending j loop");
        }//end j loop
world.note("ending i loop");
      }//end i loop
world.note("ending split if");
    }
world.note("ending check empty");
  }
}
Australia Forum Administrator #1

 if (i = affObj.order)
          {
            world.note(j);
            addItem(list,affObj.name);
          }


That changes the value of i, the loop will never end.

You mean:


 if (i == affObj.order)
#2
heh, I knew it had to do with a never ending loop I just couldn't see how... stupid mistake. Thanks for the help