[Opensim-users] llGiveInventoryList to an object raises exception
Jeff Kelley
opensim at pescadoo.net
Thu Apr 11 15:31:03 UTC 2013
list items = ["item1", "item2", "item3"];
llGiveInventoryList (llGetOwner(), "folder", items);
Works ok.
______________________________________________
list items = ["item1", "item2", "item3"];
key objectId = "9a0da4c0-2a4a-47a2-9108-0e24991d207d"; // An object
in the same sim
llGiveInventoryList (objectId, "folder", items);
Fails with:
[06:25 AM] Brick Textures:
System.Reflection.TargetInvocationException: Exception has been
thrown by the target of an invocation.
Server stack trace:
at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000]
at System.Reflection.MethodBase.Invoke (System.Object obj,
System.Object[] parameters) [0x00000]
at
OpenSim.Region.ScriptEngine.Shared.ScriptBase.Executor.ExecuteEvent
(System.String state, System.String FunctionName, System.Object[]
args) [0x00000]
Exception rethrown at [0]:
---> System.NullReferenceException: Object reference not set to an
instance of an object
Server stack trace:
at OpenSim.Region.Framework.Scenes.Scene.MoveTaskInventoryItems
(UUID destID, System.String category,
OpenSim.Region.Framework.Scenes.SceneObjectPart host,
System.Collections.Generic.List`1 items) [0x00000]
at OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api.llGiveInventoryL
______________________________________________
REPRO:
Rez box A.
Script A:
default {
state_entry() {
key id = llGetKey();
llOwnerSay((string)id);
llRemoveInventory(llGetScriptName()); // Delete self
}
}
Copy UUID.
Rez box B.
Fill with textures (full-mod).
Script B:
key target = "__paste_UUID_here__";
integer LIST_WHAT = INVENTORY_TEXTURE;
list makeList (integer what) {
list result;
integer howMany = llGetInventoryNumber (what);
integer i; for (i=0; i<howMany; i++)
result += [ llGetInventoryName (what, i) ];
return result;
}
default {
state_entry() {
list items = makeList (LIST_WHAT);
llOwnerSay (llDumpList2String (items,"\n"));
llGiveInventoryList (target, "textures", items);
}
}
More information about the Opensim-users
mailing list