[Opensim-users] How do you use osForceAttachToOtherAvatarFromInventory and other OSSL functions with NPC's

Thomas Ringate tringate at gmail.com
Tue Aug 19 15:21:55 UTC 2014


List,

I found a post and a response to the post from Justin that suggests the several OSSL functions on “attachments” will work for NPC’s.
http://opensim-users.2152040.n2.nabble.com/Dynamically-attaching-objects-to-NPCs-td7579601.html
I have tried several variations to using these OSSL functions and they all work fine to put an attachment on an avatar.
I have not been successful at putting an attachment on an NPC.
I chose to test with the osForceAttachToOtherAvatarFromInventory function.
I tested with both “owned” and “un-owned” NPC’s.

Here is an edited email I sent to Justin who asked I ask this question here on the list.

> I read in a post you made sometime ago where you implied you could use the OSSL function osForceAttachToAvatarFromInventory and
> the other OSSL commands as well.
> The original post suggested a way to attach using an lsl function which I have not yet tried. Your suggestion was to use the OSSL functions.
> I have tried doing the following:
> create a box and place the script below in it.
> create another box named “testbox”, and put it in the first box along with the script.
> I have then tried using “box 1” in these ways.
> - place it on the ground and touch it
> - wear it and touch it
> - wear it and clone myself, and then touch it on my cloned NPC.
> None of these will attach the “testbox” to the NPC.
> They all attach it to my real avatar.
> Did attaching an object to an NPC work in the past?  Is it broken in the release OSGrid put out Aug. 16, 2014?
> Tom Ringate

> Here is the script:
> //XEngine:lsl
> string name = "NPC Mate test box ";
> string version = "V2.2";
> list avatars = [];
> key victim = "aaefe00e-724a-4346-83df-92fa615b009f";
> /* NPC Genie - id - V2.2
> * Licensed under the GPLv2, with the additional requirement that these scripts remain "full perms".
> *
> */
> /*** FUNCTIONS ***/
> /*** CODE ***/
> default
> {
>      state_entry()
>      {
>          if(!llGetAttached()) llSetObjectName(name + version);
>          else llSetObjectName(llKey2Name(llGetOwner()));
>      }
>      touch_start(integer iNum)
>      {
>          llSay(0,"You touched me.");
>          avatars = osGetAvatarList(); // get list of avatars on region
>          llSay(0, "Avatars in this sim (without the owner): " + llList2CSV(avatars));
>          victim = llList2Key(avatars,0);
>          if(osIsNpc(victim)  == TRUE)
>          {
>              llSay(0, "Victim is Genie: " + victim);
> osForceAttachToOtherAvatarFromInventory(victim, "testbox", ATTACH_PELVIS);
>          }
>          else
>          {
>              victim = llGetOwner();
>              llSay(0, "Victim is Avatar: " + victim);
> osForceAttachToAvatarFromInventory("testbox", ATTACH_PELVIS);
>          }
> //        llSleep(5);
> //        osForceDropAttachment();
>      }
>      on_rez(integer iParam)
>      {
>          llResetScript();
>      }
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-users/attachments/20140819/782b7a92/attachment.html>


More information about the Opensim-users mailing list