Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Exceeding the Loop Limit =/ (https://forums.graalonline.com/forums/showthread.php?t=69102)

projectigi 10-01-2006 05:43 PM

Exceeding the Loop Limit =/
 
yeah im currently working on this, now i have two problems
a) before the last modification the script gave a error message saying "Out of memory" after you restarted it a few times - had to restart graal to fix this XD
b) after the last modification my pc did freeze up on it, well not really freeze but no more mouse movement, audio, task manager, graal, anything else, hell even numlock toggle took 5-10 seconds to react XD
b 1) it said
Quote:

49
49
147
in the log before it did freeze
anyone know how to fix?

PHP Code:

//#CLIENTSIDE
function onPlayerChats()
  {
  if(
player.chat=="/mapedit")
    {
    if( 
isObjectTileMap ) )
    
TileMap.destroy();
    
this.state "init";
    
this.oi1 this.oi2 0;
    
TileMap = new GuiDrawingPanel();
    
TileMap.makeFirstResponder"false" );
    
GraalControl.makeFirstResponder"true ");
    
this.scrollx=this.scrolly=0;
    
this.mainobj this;
    
this.map = new [ 200 ] [ 200 ];
    
setTimer.05 );
    }
  }
function 
init()
  {
  
this.scrollx this.scrolly 0;
  
withTileMap )
    {
    
0;
    
0;
    
width 200*64;
    
height 200*32;
    
profile "GuiDrawingPanelProfile";
    
clearall();
    
drawimagestretched00widthheight"black.png"001616 );
    new 
GuiWindowCtrlTileMap_TileChooser )
      {
      
0;
      
0;
      
width 200;
      
height 80;
      
profile "GuiBlueWindowProfile";
      
canResize false;
      
canClose false;
      
canMinimize false;
      
canMove true;
      
canMaximize false;
      
canClose closequery true;
      
thiso.catcheventthis"onCloseQuery""closeMapEdit" );
      new 
GuiBitmapButtonCtrlTileMap_TileChooser_Tile1 )
        {
        
15;
        
30;
        
normalbitmap mouseoverbitmap pressedbitmap "gscript_projectigi_desert_tile.png";
        
width 64;
        
height 40;
        
profile "GuiBitmapProfile";
        }
      }
    }
  
GUIContainer.addControlTileMap );
  
TileMap.makeFirstResponder"false" );
  
TileMap_TileChooser.makeFirstResponder"false" );
  
TileMap.clearall();
  
TileMap.visible=false;
  
drawMap();
  }
function 
drawMap()
  {
  
this.hight 0;
  for( 
this.dy 0this.dy <= 200 this.dy++ )
    {
    for( 
this.dx 0this.dx <= 200this.dx++ )
      {
      
this.hight++;
      if( 
this.mapthis.dx  ][ this.dy ] > 0)
        
TileMap.drawImageRectangle( ( this.dx 64 ) + ( 32 * ( this.dy ) ), ( this.dy * ( 16 ) ), "gscript_projectigi_desert_tiles.png"64 * ( this.mapthis.dx ][ this.dy ] - ), 06440);
      if( 
this.hight == 9999 ) break;
      }
      
    if( 
this.hight == 9999 ) break;
    
this.hight++;
    
    }
    echo( 
this.dy);
  if( 
this.dy >= 200 )
    {
    
this.state "init2";
    
TileMap.makeFirstResponder"false" );
    
TileMap_TileChooser.makeFirstResponder"false" );
    
setTimer(.05);
    }
  else
    {
    
scheduleEvent1"drawMapL"this.dxthis.dy );
    }
  }
function 
ondrawMapL()
  {
  echo( 
params[1]);
  
this.hight 0;
  
this.ddx params[0];
  for( 
this.dy params[1]; this.dy <= 200this.dy++ )
    {
    for( 
this.dx thiso.ddxthis.dx <= 200this.dx++ )
      {
      
this.hight++;
      if( 
this.mapthis.dx  ][ this.dy ] > 0)
        
TileMap.drawImageRectangle( ( this.dx 64 ) + ( 32 * ( this.dy ) ), ( this.dy * ( 16 ) ), "gscript_projectigi_desert_tiles.png"64 * ( this.mapthis.dx ][ this.dy ] - ), 06440);      
      if( 
this.hight == 9999 ) break;
      }
    if( 
this.hight == 9999 ) break;
    }
  if( 
this.dy >= 200 )
    {
    
this.state "init2";
    
TileMap.makeFirstResponder"false" );
    
TileMap_TileChooser.makeFirstResponder"false" );
    
setTimer(.05);
    }
  else
    {
    
scheduleEvent1"drawMapL"this.dxthis.dy );
    }
  }
function 
TileMap_TileChooser_Tile1.onAction(){
  
thiso.activetile=1;
}
function 
onTimeout()
  {
  if(
this.state=="init")
    {
    
this.max 9999;
    
this.high 0;
    for(
this.i1=this.oi1;this.i1<=200;this.i1++)
      {
      for(
this.i2=this.oi2;this.i2<=200;this.i2++)
        {
        
this.map[this.i1][this.i2]=int(random(1,3.99));
        
this.high++;
        if( 
this.high == 9999 )
          break;
        }
      if( 
this.high == 9999 
        break;
      
this.high++;
      }
    
this.oi1=this.i1;
    
this.oi2=this.i2;
    if(
this.oi1>=200)
      {
      
this.state="none";
      
init(); 
      }
    
setTimer(.05);
    }
  if(
this.state=="init2")
    {
    
TileMap.visible=true;
    
TileMap.makeFirstResponder"false" );
    
TileMap_TileChooser.makeFirstResponder"false" );
    
GraalControl.makeFirstResponder"true" );
    if(
keydown2(40,false))
      
this.scrolly+=2;
    if(
keydown2(37,false))
      
this.scrollx-=2;
    if(
keydown2(39,false))
      
this.scrollx+=2;
    if(
keydown2(38,false))
      
this.scrolly-=2;
    
TileMap.= -this.scrollx;
    
TileMap.= -this.scrolly;
    
setTimer(.05);
    }
  }
function 
closeMapEdit()
  {
  
TileMap.destroy();
  
this.state "off";
  } 


Googi 10-01-2006 08:33 PM

Wow, you can actually exceed the loop limit? It reminds me of that time I exceeded the script character limit.

projectigi 10-01-2006 08:51 PM

well i try it with scheduleEvent to continue the loop after the break of 9999 loop turns


All times are GMT +2. The time now is 09:56 PM.

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