75 lines
2.0 KiB
C#
75 lines
2.0 KiB
C#
//
|
|
// This script serves as a basis for new scripts. New scripts can copy this
|
|
// source file to start out.
|
|
//
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Runtime.InteropServices;
|
|
using System.Reflection;
|
|
using System.Reflection.Emit;
|
|
using CLRScriptFramework;
|
|
using NWScript;
|
|
using NWScript.ManagedInterfaceLayer.NWScriptManagedInterface;
|
|
|
|
using NWEffect = NWScript.NWScriptEngineStructure0;
|
|
using NWEvent = NWScript.NWScriptEngineStructure1;
|
|
using NWLocation = NWScript.NWScriptEngineStructure2;
|
|
using NWTalent = NWScript.NWScriptEngineStructure3;
|
|
using NWItemProperty = NWScript.NWScriptEngineStructure4;
|
|
|
|
using System.Threading;
|
|
using Grapevine.Server;
|
|
|
|
namespace CLRScript
|
|
{
|
|
public partial class nwn2_ai_onmoduleload : CLRScriptBase, ICLRScriptImplementation, IGeneratedScriptProgram
|
|
{
|
|
|
|
public nwn2_ai_onmoduleload([In] NWScriptJITIntrinsics Intrinsics, [In] INWScriptProgram Host)
|
|
{
|
|
InitScript(Intrinsics, Host);
|
|
}
|
|
|
|
private nwn2_ai_onmoduleload([In] nwn2_ai_onmoduleload Other)
|
|
{
|
|
InitScript(Other);
|
|
|
|
LoadScriptGlobals(Other.SaveScriptGlobals());
|
|
}
|
|
|
|
//
|
|
// Include the list of types for parameters to the main function here.
|
|
// An empty list means no parameters.
|
|
//
|
|
public static Type[] ScriptParameterTypes = { };
|
|
|
|
public Int32 ScriptMain([In] object[] ScriptParameters, [In] Int32 DefaultReturnCode)
|
|
{
|
|
var server = new RESTServer();
|
|
server.Start();
|
|
|
|
while (server.IsListening)
|
|
{
|
|
Thread.Sleep(300);
|
|
}
|
|
|
|
|
|
int Volume;
|
|
|
|
MessageToSpeak = "Hello, world";
|
|
Volume = TALKVOLUME_TALK;
|
|
|
|
AssignCommand(OBJECT_SELF, delegate() { ActionSpeakString(MessageToSpeak, Volume); });
|
|
|
|
return DefaultReturnCode;
|
|
}
|
|
|
|
[NWScriptGlobal]
|
|
private string MessageToSpeak;
|
|
}
|
|
}
|