Globals in Globals
So this would work in a normal zone folder....
Code:
my $var = 1; |
The use of "my" denotes it's not a "global" variable, thus a lexical/local variable.
I'm not sure what you're trying to do exactly bud, but, that said, guessing here, you -may- benefit from plugin::SEV and plugin::REV. aka $entity->SetEntityVariable("variable_name", "value") and $entity->GetEntityVariable("variable_name") |
I will try the entity variable, thanks.
|
You could also just use quest globals using the 7 setting for NPC/PC/Zone, so quest::setglobal("Test", 1, 7, "F") would be a quest global for all NPCs, PCs, and zones and could be accessed simply by using $qglobals{"Test"} in any script.
|
Overall I am just wondering why the variables quit working when you take an NPC script and throw it in global, that is when it changes.
|
I mean, as Ghanja mentioned 'my' is the Perl equivalent of Lua's 'local', meaning it's localized to a singular method or file, which could be the issue. It should work correctly being you're initializing it outside of the subroutines as a lexical variable. Due to that, it should also be able to be modified and viewed from inside any subroutine within a given script. Have you attempted removing the 'my' keyword and making it a non-lexical variable and testing it to see if you get any different results?
|
That was the first thing I did.
|
This seems to work for me.. what NPC / zone / file is this quest in.
I tried a single NPC and it works fine.. global npc it works fine as well. |
All times are GMT -4. The time now is 11:27 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.