Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Need help with weird Bug... (https://forums.graalonline.com/forums/showthread.php?t=78171)

projectigi 01-01-2008 11:30 AM

Need help with weird Bug...
 
Hi,

so after some Bugs that I could pass by with VarHandles(e.g. not being able to set temp. vars, or maybe this. vars too ), and some others I reached something unfixable for me, atleast I tried many things :p

If i comments out the for with /* */ it works, If i don't comments it out the Array will be Echoes as "0", for some reason even before the for...

PHP Code:

function onCreated()
  {
  
TestC = null;
  
TestC = new TStaticVar();
  
TestC.mainHandle = this;
  
TestC.testArr = { { 1, 2 }, { 2, 4 }, { 3, 5 } };
  
TestC.testingFunc1 = function()
    {
    
TestP.testingFunc2( TestC.testArr );
    };
  
TestP = null;
  
TestP = new TStaticVar();
  
TestP.testingFunc2 = function( testArr )
    {
    
TestC.mainHandle.trigger( "EchoR", "arrive:" @ testArr );
    
VarHandle = null;
    for( 
VarHandle.ty = 0; VarHandle.ty < 5; VarHandle.ty++ )
      {
      
TestC.mainHandle.trigger( "EchoR", "pre " @ VarHandle.ty @ " : " @ testArr );
      
//VarHandle.ttempp = testArr[ VarHandle.ty ]; Doesnt even work without this...
      
TestC.mainHandle.trigger( "EchoR", "post " @ VarHandle.ty @ " : " @ testArr );
      }  
    
TestC.mainHandle.trigger( "EchoR", { testArr } );
    };
  
TestC.testingFunc1();
  }

function 
onEchoR()
  {
  echo( 
params[ 0 ] );
  } 


Chompy 01-01-2008 03:26 PM

PHP Code:

TestC.mainHandle.trigger( "EchoR", "pre " @ VarHandle.ty @ " : " @ testArr ); 

Hmm, shouldn't 'testArr' be 'TestC.testArr'?

NVM: If you change it to TestC.testArr you get output, but I see that it doesn't recieve the params, right?

Edit2: Ok, that's the wierdest thing I've seen for a long time:

PHP Code:

function onCreated() {
  
TestC = null;
  
TestC = new TStaticVar();
  
TestC.mainHandle = this;
  
TestC.testArr = { { 1, 2 }, { 2, 4 }, { 3, 5 } };
  
  
TestC.testingFunc1 = function() {
    
temp.arr = TestC.testArr;
    
TestC.mainHandle.trigger( "EchoR", "arr: "@ arr @ " - type: " @ arr.type());
    
TestP.testingFunc2(arr);
  };
  
TestP.testingFunc2 = function(arr2) {
    
TestC.mainHandle.trigger("EchoR", "arr2: "@ arr2 @ " - type2: " @ arr2.type());
    
    
TestC.mainHandle.trigger("EchoR", "arrive:" @ arr2);
    
    
//TestC.mainHandle.trigger("EchoR", "pre: " @ arr2); 
    
    
TestC.mainHandle.trigger("EchoR", {arr2});
  };
  
TestC.testingFunc1();
}
function 
onEchoR(str) {
  echo(
str);
} 

That works, but, if you remove the '//' in the scirpt, it won't! :)

cbk1994 01-01-2008 05:15 PM

Weird error...

projectigi 01-01-2008 05:21 PM

The funny thing is that when i tried that at clientside the variable got stuck, so even if i commented out the line, the variable kept being 0, even after restarting graal and for next test i had to use another varname xD

Admins 01-02-2008 12:46 PM

Hmmm there seems to be an optimization problem with inline-functions, the temp variable is removed / moved outside the inline-function.

projectigi 01-02-2008 06:33 PM

Quote:

Originally Posted by Stefan (Post 1367593)
Hmmm there seems to be an optimization problem with inline-functions, the temp variable is removed / moved outside the inline-function.

uh, well can you fix it in next version or something? ^^

Admins 01-02-2008 08:22 PM

Ok uploaded a new npcserver version.

projectigi 01-02-2008 08:38 PM

Quote:

Originally Posted by Stefan (Post 1367670)
Ok uploaded a new npcserver version.

well i dont know if that fixes the problem clientsided, since it seems to happen there too xD


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

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