[Opensim-users] NPC not getting removed as expected

dz dz at bitzend.net
Wed May 1 05:37:29 UTC 2013


Date: Tue, 30 Apr 2013 17:10:34 -0400
From: Dr Ramesh Ramloll <r.ramloll at gmail.com>
To: opensim-users <opensim-users at lists.berlios.de>
Subject: Re: [Opensim-users] NPC not getting removed as expected
Message-ID:
        <CAHi41xK6v-qPH9rCc0+pDunHOPcB7UO6VOSs7QeCVrwnfd1+9w at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,
Before I file a mantis report, try wearing an attachment with this trivial
script

default
{
    touch_start(integer i){
        osNpcRemove(llGetOwner());
    }
}

clone youself, then create an NPC using the example script here NPC
Automator script
http://opensimulator.org/wiki/OSSLNPC

Let me know if others are getting the same behavior, the NPC is expected to
delete itself when attachment is clicked.

I filed a Mantis on this behavior when the NPC functions were released.
I cannot find it now, large numbers of reports seem to have been removed.
The call to GetOwner() does not return the correct UUID for the NPC

The workaround is to add code to handle the attached event

    attach(key id) {
        Initialize(id);
    }

The key returned as id in this function is always the key of the avatar/NPC
the item is attached to.
This script should do what you expect.

key NPC = NULL_KEY;
default
{
    touch_start(integer i){
        osNpcRemove(NPC);
    }

    attach(key id) {
        NPC=id;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-users/attachments/20130430/9a1235da/attachment.html>


More information about the Opensim-users mailing list