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( 
isObject( TileMap ) )
    
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;
  
with( TileMap )
    {
    
x = 0;
    
y = 0;
    
width = 200*64;
    
height = 200*32;
    
profile = "GuiDrawingPanelProfile";
    
clearall();
    
drawimagestretched( 0, 0, width, height, "black.png", 0, 0, 16, 16 );
    new 
GuiWindowCtrl( TileMap_TileChooser )
      {
      
x = 0;
      
y = 0;
      
width = 200;
      
height = 80;
      
profile = "GuiBlueWindowProfile";
      
canResize = false;
      
canClose = false;
      
canMinimize = false;
      
canMove = true;
      
canMaximize = false;
      
canClose = closequery = true;
      
thiso.catchevent( this, "onCloseQuery", "closeMapEdit" );
      new 
GuiBitmapButtonCtrl( TileMap_TileChooser_Tile1 )
        {
        
x = 15;
        
y = 30;
        
normalbitmap = mouseoverbitmap = pressedbitmap = "gscript_projectigi_desert_tile.png";
        
width = 64;
        
height = 40;
        
profile = "GuiBitmapProfile";
        }
      }
    }
  
GUIContainer.addControl( TileMap );
  
TileMap.makeFirstResponder( "false" );
  
TileMap_TileChooser.makeFirstResponder( "false" );
  
TileMap.clearall();
  
TileMap.visible=false;
  
drawMap();
  }
function 
drawMap()
  {
  
this.hight = 0;
  for( 
this.dy = 0; this.dy <= 200 ; this.dy++ )
    {
    for( 
this.dx = 0; this.dx <= 200; this.dx++ )
      {
      
this.hight++;
      if( 
this.map[ this.dx  ][ this.dy ] > 0)
        
TileMap.drawImageRectangle( ( this.dx * 64 ) + ( 32 * ( this.dy % 2 ) ), ( this.dy * ( 16 ) ), "gscript_projectigi_desert_tiles.png", 64 * ( this.map[ this.dx ][ this.dy ] - 1 ), 0, 64, 40);
      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
    {
    
scheduleEvent( 1, "drawMapL", this.dx, this.dy );
    }
  }
function 
ondrawMapL()
  {
  echo( 
params[1]);
  
this.hight = 0;
  
this.ddx = params[0];
  for( 
this.dy = params[1]; this.dy <= 200; this.dy++ )
    {
    for( 
this.dx = thiso.ddx; this.dx <= 200; this.dx++ )
      {
      
this.hight++;
      if( 
this.map[ this.dx  ][ this.dy ] > 0)
        
TileMap.drawImageRectangle( ( this.dx * 64 ) + ( 32 * ( this.dy % 2 ) ), ( this.dy * ( 16 ) ), "gscript_projectigi_desert_tiles.png", 64 * ( this.map[ this.dx ][ this.dy ] - 1 ), 0, 64, 40);      
      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
    {
    
scheduleEvent( 1, "drawMapL", this.dx, this.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.x = -this.scrollx;
    
TileMap.y = -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:21 PM.

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