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

Thomas Ringate tringate at gmail.com
Wed Aug 20 01:16:29 UTC 2014


Thanks for the clarification.  I did notice I got the item in my inventory 
every time I tested with myself.  That is a pain because you get lots of 
duplicate things in your inventory playing around with that.

Maybe a future OSSL function to attach to NPC could be considered at some 
point.  It would be really nice for an NPC to be able to pick up something 
take it to some point and set it down.  Like a maid setting a table for 
dinner.

-----Original Message----- 
From: Justin Clark-Casey
Sent: Tuesday, August 19, 2014 7:19 PM
To: opensim-users at opensimulator.org
Subject: Re: [Opensim-users] How do you use 
osForceAttachToOtherAvatarFromInventory and other OSSL functions with NPC's

Yeah, I did suggest that originally but I see now that it can't work.

All those osForceAttachment* commands assume that the receiving avatar has 
an inventory.  However, NPCs currently have
no notion of inventory, so none of that stuff will work for them.

The cloning of the avatar doesn't suffer this because the code was written 
to avoid the inventory requirement.  The same
could most probably be done for these force commands but it would require 
some non-trivial changes.  It doesn't require
the NPC to have any notion of scene but it would require that the code 
operate by attaching objects directly instead of
requesting that they are attached from an inventory item (on attaching, 
'normal' avatars get an item in their inventory
for the attachment).

On 19/08/14 16:21, Thomas Ringate wrote:
> 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();
>  >      }
>  > }
>
>
> _______________________________________________
> Opensim-users mailing list
> Opensim-users at opensimulator.org
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
>


-- 
Justin Clark-Casey (justincc)
OSVW Consulting
http://justincc.org
http://twitter.com/justincc
_______________________________________________
Opensim-users mailing list
Opensim-users at opensimulator.org
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users 



More information about the Opensim-users mailing list