Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 07-06-2008, 10:37 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Object method declaration in joined classes.

I think this is the correct forum this time.
Following is a description of what I assume is a bug. I managed to rule out any human factor.

My stuff behaved like it was magic for a while until I succeeded in isolating the problem.

It seems like functions in a joined class isn't fully aware of what is happening in the real script. The following scripts creates two TStaticVars and assigns anonymous functions to them, one in a joined class-function and one native. The functions both end up with the same identifier, function_1, and whichever function was defined first is overwritten.

A DBNPC:
PHP Code:
function onCreated()
{
  
join("some_class");
  
temp.foo createNewTStaticVarFromAnotherClass();
  
  
temp.foo.forkFunctionCollision();
  echo(
temp.foo.forkFunctionCollision);
  
  
temp.bar = new TStaticVar();
  
temp.bar.secondFunctionCollision = function() {
    echo(
"secondFunctionCollision");
  };
  
  
temp.bar.secondFunctionCollision();
  echo(
temp.bar.secondFunctionCollision);

some_class:
PHP Code:
function createNewTStaticVarFromAnotherClass()
{
  
temp.crux = new TStaticVar();
  
temp.crux.forkFunctionCollision = function() {
    echo(
"forkFunctionCollision");
  };
  
  return 
temp.crux;

Output:
Quote:
secondFunctionCollision
function_1
secondFunctionCollision
function_1
I assume this is supposed to output:
Quote:
forkFunctionCollision
function_1
secondFunctionCollision
function_2

Oh, hello mister inappropriate censorship; I think I'll rename firstFunctionCollision() to something else.
That's word censor evasion 101 by the way.

Last edited by DrakilorP2P; 07-07-2008 at 04:24 PM.. Reason: Improved sentence structure.
Reply With Quote
  #2  
Old 07-07-2008, 01:15 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
I helped to debug this, somewhat, and I can confirm the error.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #3  
Old 07-07-2008, 11:27 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
It's correct that they are both function_1 because the numeration depends on the position of the function in the script, but it should of course call the good one, so I will need to check it.
Reply With Quote
  #4  
Old 07-26-2008, 01:16 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
*bump*

Would love to get this fixed, it's not nice forcing us to do hackish ways around it.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #5  
Old 07-26-2008, 04:44 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
I've encountered a similar issue.

PHP Code:
function onCreated()
{
  
funcOne();
}

public function 
funcOne()
{
  
temp.foo = new TStaticVar();
  
temp.foo.funcTwo = function() {
    echo(
"bar");
  };
  
temp.foo.funcTwo();

Echoes "bar" successfully.

However, if I want to trigger the function in this NPC on another object using with (obj)...
PHP Code:
function onCreated()
{
  
// Replace 'obj' with one of the following:
  // findPlayer("accountname")
  // findNPC("npcname")
  
with (objfuncOne();
}

public function 
funcOne()
{
  
temp.foo = new TStaticVar();
  
temp.foo.funcTwo = function() {
    echo(
"bar");
  };
  
temp.foo.funcTwo();

I get this error message on RC instead:
PHP Code:
Script: Function unknown_object.funcTwo not found at line 71 in script of DEBUG (in level onlinestartlocal.nw at pos (30.530)) 
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto

Last edited by xXziroXx; 07-26-2008 at 04:46 AM.. Reason: Uncensor S T F U please, can't even type "test" followed by "func"...
Reply With Quote
  #6  
Old 08-10-2008, 07:49 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Yeah, bump, etcetera. Also, look into the edit reason on my last post while you're at it please.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #7  
Old 08-10-2008, 09:36 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
I tried this:

PHP Code:
function onCreated()
{
  
// Replace 'obj' with one of the following:
  // findPlayer("accountname")
  // findNPC("npcname")
  
with(findplayer("Chompy")) funcOne();
}

public function 
funcOne()
{
  
temp.foo = new TStaticVar();
  
temp.foo.funcTwo = function() {
    echo(
"bar");
  };
  
temp.foo.funcTwo();

worked fine for me? o.o
__________________
Reply With Quote
  #8  
Old 08-10-2008, 11:57 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Chompy View Post
worked fine for me? o.o
That's odd, try with a NPC? Also, the main concern in this thread is the first issue posted by Drakilor.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #9  
Old 08-11-2008, 12:04 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Fixed the problem by also adding the script id to the function name. A side effect is that when you update the class script then the original function object is not linking to the new function and is displaying an error, previously it was probably calling a function of the new script which might not be the same.
The fix will be in the next npcserver update, not sure when that will be because it will also require gserver restart.
Reply With Quote
  #10  
Old 08-11-2008, 02:01 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Stefan View Post
Fixed the problem
Thank you!

Quote:
Originally Posted by Stefan View Post
The fix will be in the next npcserver update, not sure when that will be because it will also require gserver restart.
I'm not entirely sure how those thing work, but I don't suppose you could do it manually for Mythic Legends as soon as possible? We've been forced to make hackish workarounds for the bug for ages now
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #11  
Old 08-12-2008, 06:20 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
There was a problem with the npcserver on Mythic Legends today (taking a lot of memory), so I've taken the chance to restart all hosted and private playerworlds today.
Reply With Quote
  #12  
Old 08-12-2008, 08:14 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Stefan View Post
There was a problem with the npcserver on Mythic Legends today (taking a lot of memory), so I've taken the chance to restart all hosted and private playerworlds today.
Hahaha.... yeeeaaah, that was a script I was playing with that ended up crashing the server.

Anyways, that means the error we posted about isn't an error anymore?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
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 05:34 PM.


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