<div dir="ltr"><div><div><div><div><div><div style="margin-left:40px">Date: Tue, 30 Apr 2013 17:10:34 -0400<br>
From: Dr Ramesh Ramloll <<a href="mailto:r.ramloll@gmail.com">r.ramloll@gmail.com</a>><br>
To: opensim-users <<a href="mailto:opensim-users@lists.berlios.de">opensim-users@lists.berlios.de</a>><br>
Subject: Re: [Opensim-users] NPC not getting removed as expected<br>
Message-ID:<br>
        <<a href="mailto:CAHi41xK6v-qPH9rCc0%2BpDunHOPcB7UO6VOSs7QeCVrwnfd1%2B9w@mail.gmail.com">CAHi41xK6v-qPH9rCc0+pDunHOPcB7UO6VOSs7QeCVrwnfd1+9w@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hello,<br>
Before I file a mantis report, try wearing an attachment with this trivial<br>
script<br>
<br>
default<br>
{<br>
    touch_start(integer i){<br>
        osNpcRemove(llGetOwner());<br>
    }<br>
}<br>
<br>
clone youself, then create an NPC using the example script here NPC<br>
Automator script<br>
<a href="http://opensimulator.org/wiki/OSSLNPC" target="_blank">http://opensimulator.org/wiki/OSSLNPC</a><br>
<br>
Let me know if others are getting the same behavior, the NPC is expected to<br>
delete itself when attachment is clicked.<br><br></div>I filed a Mantis on this behavior when the NPC functions were released.<br></div>I cannot find it now, large numbers of reports seem to have been removed.<br></div>The call to GetOwner() does not return the correct UUID for the NPC<br>
<br></div>The workaround is to add code to handle the attached event<br><br>    attach(key id) {<br>        Initialize(id);<br>    }<br><br></div>The key returned as id in this function is always the key of the avatar/NPC the item is attached to.<br>
</div>This script should do what you expect.<br><div><br>key NPC = NULL_KEY; <br>
default<br>
{<br>
    touch_start(integer i){<br>
        osNpcRemove(NPC);<br>
    }<br><br>    attach(key id) {<br>        NPC=id;<br>    }<br>
}<br>
<br><div><div><br></div></div></div></div>