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