![]() |
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:
PHP Code:
Quote:
Quote:
Oh, hello mister inappropriate censorship; I think I'll rename firstFunctionCollision() to something else. That's word censor evasion 101 by the way. |
I helped to debug this, somewhat, and I can confirm the error.
|
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.
|
*bump*
Would love to get this fixed, it's not nice forcing us to do hackish ways around it. |
I've encountered a similar issue.
PHP Code:
However, if I want to trigger the function in this NPC on another object using with (obj)... PHP Code:
PHP Code:
|
Yeah, bump, etcetera. Also, look into the edit reason on my last post while you're at it please. :)
|
I tried this:
PHP Code:
|
Quote:
|
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. |
Quote:
Quote:
|
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.
|
Quote:
Anyways, that means the error we posted about isn't an error anymore? :D |
All times are GMT +2. The time now is 09:53 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.