You'll need to create the asset for the script before you add it as part of an 
item.

The test helper method in OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.AddNotecard() is one example of this where a notecard asset is created then associated with the TaskInventoryItem before it is added the prim's inventory (task is a synonym for prim here).

For the script, you'll also need to start it.  The code as the bottom of 
scene.RezScript() I'm guessing should work for this

                part.Inventory.CreateScriptInstance(taskItem, 0, false, 
DefaultScriptEngine, 0);
                part.ParentGroup.ResumeScripts();

I see you're already played with ResumeScripts().

On 03/08/11 15:56, Chris Stevens wrote:
Hi,

Thanks to JCC for his initial advice, i've now got something that looks roughly 
like this:


  //TEST ADD SCRIPT
         private static void AddTouchScript(SceneObjectGroup parts)
         {
             SceneObjectPart part = parts.RootPart;
             Scene scene = rmDataCube.m_scene;

             //TaskInventoryItem t = new TaskInventoryItem();
             //part.Inventory.AddInventoryItem(

             InventoryItemBase b = new InventoryItemBase(UUID.Zero);
             parts.AddInventoryItem(null, part.LocalId, b, new UUID());
             scene.RezScript(null,b,new UUID(),part.LocalId);
             //parts.ResumeScripts();

         }

Unfortunately scene.RezScript has the following slightly problematic issue:

if (!Permissions.CanCreateObjectInventory(
                     itemBase.InvType, part.UUID, remoteClient.AgentId))
                     return;

So it's not even returning an error report, I think it's dying silently since 
as a region module call has a remoteClient
of null (This is part of my query, is there a way to spoof a remoteClient?)

Does anyone have an idea how to get a Prim to just rez itself a nice, unowned 
blank script without modifying Scene.cs to
not silently die if I try and call RezScript without a client?

Going to try altering Scene.cs though...

Regards,
Chris.

--
Chris Stevens
Lead Programmer
Daden Limited

t: +44 (0)121 250 5678
e: [email protected] <mailto:[email protected]>
w: www.daden.co.uk <http://www.daden.co.uk>
skype: christopher.michael.stevens
sl: http://www.slurl.com/secondlife/daden%20prime/160/184/26
sl IM: Chris Taselian

Daden specialise in immersive learning & training systems, built environment 
visualisations, and creating interactive
virtual personalities (chatbots).

Daden are a Linden Lab Gold Solution Provider for Second Life.



_______________________________________________
Opensim-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/opensim-users


--
Justin Clark-Casey (justincc)
http://justincc.org/blog
http://twitter.com/justincc
_______________________________________________
Opensim-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/opensim-users

Reply via email to