Issue Information
-
#008642
-
0 - None Assigned
-
New
Issue Confirmations
-
Yes (0)No (0)
0
Script engine issue: "return getvariableofnpc()" returning wrong values
Posted by Kpy! on 20 April 2015 - 09:23 PM
See the following test case:
EDIT:
Pull request: https://github.com/H...rcules/pull/502
prontera,157,180,5 script test 81,{ donpcevent "test2::OnSetMyVar"; mes ".myvar: " + callsub(OnGetMyVar); //OK: displays ".myvar: 1" mes ".myvar: " + callsub(OnGetMyVar2); //ERROR: displays ".myvar: 0" .myvar = 2; mes ".myvar: " + callsub(OnGetMyVar2); //ERROR: displays ".myvar: 2" close; OnGetMyVar: .@myvar = getvariableofnpc(.myvar, "test2"); return .@myvar; OnGetMyVar2: return getvariableofnpc(.myvar, "test2"); } - script test2 -1,{ OnSetMyVar: .myvar = 1; end; }The variable's (.myvar) ref is being removed by this code in the return function (script.c):
} else if ( name[0] == '.' /* && data->ref != NULL */ ) { data->ref = NULL; // Reference to the parent scope's script, remove reference pointer. }
EDIT:
Pull request: https://github.com/H...rcules/pull/502