Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-01-2006, 05:43 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
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";
  } 

Last edited by projectigi; 10-01-2006 at 07:12 PM.. Reason: adding
Reply With Quote
  #2  
Old 10-01-2006, 08:33 PM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Wow, you can actually exceed the loop limit? It reminds me of that time I exceeded the script character limit.
__________________
Reply With Quote
  #3  
Old 10-01-2006, 08:51 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
well i try it with scheduleEvent to continue the loop after the break of 9999 loop turns
Reply With Quote
Reply


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:52 AM.


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