ACR_ServerCommunicator.ACR_ServerCommunicator.RunScriptOnServer C# (CSharp) Method

RunScriptOnServer() public method

Run a script on a remote server. The script must exist on the server. If acknowledgement is desired, it must be implemented in the form of a reply IPC request initiated by the script invoked. A script executed by this function must follow this prototype: void main(int SourceServerID, string Argument);
public RunScriptOnServer ( int DestinationServerID, string ScriptName, string ScriptArgument ) : void
DestinationServerID int Supplies the destination server /// ID.
ScriptName string Supplies the name of the script.
ScriptArgument string Supplies an optional argument to pass /// to the script.
return void
        public void RunScriptOnServer(int DestinationServerID, string ScriptName, string ScriptArgument)
        {
            string EventText = ScriptName;

            if (!String.IsNullOrEmpty(ScriptArgument))
                EventText += ":" + ScriptArgument;

            SignalIPCEvent(0,
                GetDatabase().ACR_GetServerID(),
                0,
                DestinationServerID,
                GameWorldManager.ACR_SERVER_IPC_EVENT_RUN_SCRIPT,
                EventText);
        }

Usage Example

        /// <summary>
        /// This method is called when a portal transition has been committed
        /// to send a player to a remote server.
        /// </summary>
        /// <param name="State">Supplies the local state for the player that is
        /// committed to a portal transition.
        /// </param>
        /// <param name="Server">Supplies the destination server for the portal
        /// event.</param>
        /// <param name="Script">Supplies the script object.</param>
        public static void SendGUIStateToServer(PlayerState State, GameServer Server, ACR_ServerCommunicator Script)
        {
            //
            // Build the resynchronization command.  The resynchronization
            // command is parsed by HandleGUIResync().  Note that the remote
            // and local servers may not be of the same version, i.e. the
            // remote server may not understand fields that are created by the
            // local server if it is of a newer version.
            //

            ResyncState ResyncInfo = new ResyncState(State.PlayerId, 0);

            if (State.ChatSelectGUIExpanded)
            {
                ResyncInfo.ResyncFlags |= RESYNC_FLAG_CHAT_SELECT_EXPANDED;
            }

            //
            // Dispatch the resync script execution request to the remote
            // server.  The remote server will process it when the request has
            // been received.
            //

            Script.RunScriptOnServer(Server.ServerId, "acr_resync_gui", ResyncInfo.ToString());
        }
All Usage Examples Of ACR_ServerCommunicator.ACR_ServerCommunicator::RunScriptOnServer
ACR_ServerCommunicator