OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
/// <summary>
/// Start a script which is in this prim's inventory.
/// </summary>
/// <param name="item"></param>
/// <returns>true if the script instance was created, false otherwise</returns>
Start a script which is in this prim's inventory.
Start a script which is in this prim ' s inventory .
public bool CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
        {
            if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
                return false;
            m_part.AddFlag(PrimFlags.Scripted);
            if (m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
                return false;
            if (stateSource == 2 && 
                    m_part.ParentGroup.Scene.m_trustBinaries)
            {
                lock (m_items)
                {
                    m_items[item.ItemID].PermsMask = 0;
                    m_items[item.ItemID].PermsGranter = UUID.Zero;
                }
                m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
                    m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
                m_part.ParentGroup.AddActiveScriptCount(1);
                m_part.ScheduleFullUpdate();
                return true;
            }
            AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
            if (null == asset)
            {
                m_log.ErrorFormat(
                    "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
                    item.Name, item.ItemID, m_part.AbsolutePosition, 
                    m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
                return false;
            }
            else
            {
                if (m_part.ParentGroup.m_savedScriptState != null)
                    item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
                lock (m_items)
                {
                    m_items[item.ItemID].OldItemID = item.OldItemID;
                    m_items[item.ItemID].PermsMask = 0;
                    m_items[item.ItemID].PermsGranter = UUID.Zero;
                }
                string script = Utils.BytesToString(asset.Data);
                m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
                    m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
                if (!item.ScriptRunning)
                    m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
                        m_part.LocalId, item.ItemID);
                m_part.ParentGroup.AddActiveScriptCount(1);
                m_part.ScheduleFullUpdate();
                return true;
            }
        }
public bool CreateScriptInstance ( TaskInventoryItem item , int startParam , bool postOnRez , string engine , int stateSource ) { if ( ! m_part . ParentGroup . Scene . Permissions . CanRunScript ( item . ItemID , m_part . UUID , item . OwnerID ) ) return false ; m_part . AddFlag ( PrimFlags . Scripted ) ; if ( m_part . ParentGroup . Scene . RegionInfo . RegionSettings . DisableScripts ) return false ; if ( stateSource == 2 && m_part . ParentGroup . Scene . m_trustBinaries ) { lock ( m_items ) { m_items [ item . ItemID ] . PermsMask = 0 ; m_items [ item . ItemID ] . PermsGranter = UUID . Zero ; } m_part . ParentGroup . Scene . EventManager . TriggerRezScript ( m_part . LocalId , item . ItemID , String . Empty , startParam , postOnRez , engine , stateSource ) ; m_part . ParentGroup . AddActiveScriptCount ( 1 ) ; m_part . ScheduleFullUpdate ( ) ; return true ; } AssetBase asset = m_part . ParentGroup . Scene . AssetService . Get ( item . AssetID . ToString ( ) ) ; if ( null == asset ) { m_log . ErrorFormat ( " " , item . Name , item . ItemID , m_part . AbsolutePosition , m_part . ParentGroup . Scene . RegionInfo . RegionName , item . AssetID ) ; return false ; } else { if ( m_part . ParentGroup . m_savedScriptState != null ) item . OldItemID = RestoreSavedScriptState ( item . LoadedItemID , item . OldItemID , item . ItemID ) ; lock ( m_items ) { m_items [ item . ItemID ] . OldItemID = item . OldItemID ; m_items [ item . ItemID ] . PermsMask = 0 ; m_items [ item . ItemID ] . PermsGranter = UUID . Zero ; } string script = Utils . BytesToString ( asset . Data ) ; m_part . ParentGroup . Scene . EventManager . TriggerRezScript ( m_part . LocalId , item . ItemID , script , startParam , postOnRez , engine , stateSource ) ; if ( ! item . ScriptRunning ) m_part . ParentGroup . Scene . EventManager . TriggerStopScript ( m_part . LocalId , item . ItemID ) ; m_part . ParentGroup . AddActiveScriptCount ( 1 ) ; m_part . ScheduleFullUpdate ( ) ; return true ; } }
Start a script which is in this prim's inventory.
Start a script which is in this prim ' s inventory .
//             m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", //                 item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); // Prim crossing
true if the script instance was created, false otherwise
true if the script instance was created false otherwise
item
TaskInventoryItem
None
startParam
int
<not_specific>
postOnRez
bool
<not_specific>
engine
string
<not_specific>
stateSource
int
<not_specific>