Inheritance: CLRScriptFramework.CLRScriptBase, ICLRScriptImplementation
        private ACR_CreatureBehavior([In] ACR_CreatureBehavior Other)
        {
            InitScript(Other);
            Database = Other.Database;

            LoadScriptGlobals(Other.SaveScriptGlobals());
        }
Exemple #2
0
        /// <summary>
        /// This routine is invoked when a script situation created by the
        /// script is resumed for execution (for example, a DelayCommand
        /// continuation).  Its purpose is to perform the appropriate resume
        /// action for this continuation.
        ///
        /// Note that a script situation may be resumed after the original
        /// script object has been deleted, or even after the host process has
        /// been exited and restarted (in the save of a saved game that has
        /// been loaded).
        /// </summary>
        /// <param name="ScriptSituationId">Supplies the ScriptSituationId that
        /// was provided to the initial StoreState request, which is intended
        /// to uniquely identify the site within which the script situation was
        /// created.</param>
        /// <param name="Locals">Supplies an array of local variables that were
        /// provided to the initial StoreState request.  The locals may only
        /// include standard NWScript types (Int32, UInt32, Single, and engine
        /// structures).</param>
        /// <param name="ObjectSelf">Supplies the "OBJECT_SELF" object id of
        /// the object that the script is being executed over.  This may be the
        /// invalid object id (Script.OBJECT_INVALID) if no object is
        /// associated with the execute script request.</param>
        public void ExecuteScriptSituation([In] UInt32 ScriptSituationId, [In] object[] Locals, [In] UInt32 ObjectSelf)
        {
            ACR_CreatureBehavior OldCurrentScript = CurrentScript;

            //
            // Call the helper function.
            //

            CurrentScript = this;
            DispatchExecuteScriptSituation(ScriptSituationId, Locals, ObjectSelf);
            CurrentScript = OldCurrentScript;
        }
Exemple #3
0
        /// <summary>
        /// This routine is the main entry point symbol for the script.  It is
        /// invoked when the packaged script is executed.
        /// </summary>
        /// <param name="ObjectSelf">Supplies the "OBJECT_SELF" object id of
        /// the object that the script is being executed over.  This may be the
        /// invalid object id (Script.OBJECT_INVALID) if no object is
        /// associated with the execute script request.</param>
        /// <param name="ScriptParameters">Supplies the parameter values for
        /// the script.  If the type deriving from IGeneratedScriptProgram
        /// declares a ScriptParameterTypes public field, then parameters may
        /// be passed in via this array (in which case the parameter types
        /// have already been converted and validated).  Otherwise, no
        /// arguments are provided.</param>
        /// <param name="DefaultReturnCode">Supplies the requested default
        /// return code to use if the script is a "main"-style script that
        /// would not conventionally return a value.</param>
        /// <returns></returns>
        public Int32 ExecuteScript([In] UInt32 ObjectSelf, [In] object[] ScriptParameters, [In] Int32 DefaultReturnCode)
        {
            ACR_CreatureBehavior OldCurrentScript = CurrentScript;
            UInt32 OldOBJECT_SELF = ObjectSelf;
            int    ReturnCode;

            try
            {
                OBJECT_SELF   = ObjectSelf;
                CurrentScript = this;
                ReturnCode    = ScriptMain(ScriptParameters, DefaultReturnCode);
            }
            finally
            {
                OBJECT_SELF   = OldOBJECT_SELF;
                CurrentScript = OldCurrentScript;
            }

            return(ReturnCode);
        }