summaryrefslogtreecommitdiff
path: root/npc/dev/test.txt
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-04-25 19:32:45 +0200
committerHaruna <haru@dotalux.com>2015-04-25 19:32:45 +0200
commit0f7a7933f8940c2d8ae1d739d11dc9c80ffda61a (patch)
tree4a79261ff07716ce834de97444368cf966dee0a7 /npc/dev/test.txt
parentd27eea4b5c112ab0209045ad65989697899dced0 (diff)
parent2970847b879821f738bb892e9079c0ae2a5d08c7 (diff)
downloadhercules-0f7a7933f8940c2d8ae1d739d11dc9c80ffda61a.tar.gz
hercules-0f7a7933f8940c2d8ae1d739d11dc9c80ffda61a.tar.bz2
hercules-0f7a7933f8940c2d8ae1d739d11dc9c80ffda61a.tar.xz
hercules-0f7a7933f8940c2d8ae1d739d11dc9c80ffda61a.zip
Merge pull request #502 from k-py/bugfix-return-getvariableofnpc
Fix script function return always removing references from NPC variables.
Diffstat (limited to 'npc/dev/test.txt')
-rw-r--r--npc/dev/test.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/npc/dev/test.txt b/npc/dev/test.txt
index a091f5998..9c2de9a55 100644
--- a/npc/dev/test.txt
+++ b/npc/dev/test.txt
@@ -86,6 +86,15 @@ function script F_TestNPCArrays {
return getarraysize(.y);
}
+function script F_TestVarOfAnotherNPC {
+ return getvariableofnpc(.x, getarg(0));
+}
+
+- script TestVarOfAnotherNPC -1,{
+ // Used to test getvariableofnpc()
+ end;
+}
+
function script HerculesSelfTestHelper {
if (.once > 0)
return .errors;
@@ -622,6 +631,9 @@ function script HerculesSelfTestHelper {
callsub(OnCheck, "Callsub (parent array vars isolation)", getarraysize(.@x), .@z);
deletearray .@x;
deletearray .@y;
+ .x = 2;
+ set getvariableofnpc(.x, "TestVarOfAnotherNPC"), 1;
+ callsub(OnCheck, "Callsub (return NPC variables from another NPC)", callsub(OnTestVarOfAnotherNPC, "TestVarOfAnotherNPC"), 1);
// Callfunc
callsub(OnCheck, "Callfunc return value", callfunc("F_TestReturnValue", 1));
@@ -667,6 +679,9 @@ function script HerculesSelfTestHelper {
callsub(OnCheck, "Callfunc (parent array NPC vars isolation)", getarraysize(.@x), .@z);
deletearray .x;
deletearray .y;
+ .x = 2;
+ set getvariableofnpc(.x, "TestVarOfAnotherNPC"), 1;
+ callsub(OnCheck, "Callfunc (return NPC variables from another NPC)", callfunc("F_TestVarOfAnotherNPC", "TestVarOfAnotherNPC"), 1);
if (.errors) {
debugmes "Script engine self-test [ \033[0;31mFAILED\033[0m ]";
@@ -708,6 +723,9 @@ OnTestScopeArrays:
setarray .@x, 1, 2, 3, 4;
copyarray .@y, getarg(0), getarraysize(getarg(0));
return getarraysize(.@y);
+
+OnTestVarOfAnotherNPC:
+ return getvariableofnpc(.x, getarg(0));
OnReportError:
.@msg$ = getarg(0,"Unknown Error");