Wintermute Engine Forum
Wintermute Engine => Scripts, plugins, utilities, goodies => Topic started by: Mnemonic on December 28, 2003, 12:05:26 AM
-
Since there are people working on external WME script editors, I decided to release a .NET wrapper for WME I'm working on. It may be helpful for invoking the script compiler for checking the script syntax.
Please note that the wrapper is very raw and unfinished!
The below package includes two .NET assemblies (WMESupport.dll and WMEWrapper.dll) and a sample application, calling the WME script compiler. The application is written in C#, but it should be easy to adapt it to VB.NET.
The .NET wrapper relies on two WME DLL libraries: wmelib.dll and dcscomp.dll. Those libraries are part of the WME distribution package and they MUST be available for the wrapper to work (the easiest way is to have thhose dlls and the .NET application in the same folder).
Steps to make the WME wrapper in your .NET application:
1) add a reference to the WMEWrapper.dll assembly
2) use the proper namespace: using DeadCode.WMEWrapper;
3) create an instance of a WGame class
4) initialize the WME game object (WGame.InitializeSimple)
The WGame class provides a CompileScript method. This method uses a callback to report back any compile time error.
See the eclosed package for a detailed example of the above steps.
If you have any questions/problems please ask here in this thread.
http://dead-code.org/download/WMEdotNET.zip
-
Wonderful!! :)
This .NET wrapper for WME is a great idea! I've downloaded it and i've tried to convert the sample project to VB .NET and I've obtained it, but when I run the application it returns me the same error: "Line 1: Error opening include file scripts\base.inc". I've tested this scripts with WME Project Manager and the syntax is correct. I believe that I'm writting the project root path of the InitializeSimple function bad. There's my VB .NET code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Game As New WGame
Game.InitializeSimple("C:\Proyectos\WME\Prueba")
If Game.CompilerAvailable Then
Dim ScriptCallBack As New WGame.ScriptCompilerCallback(AddressOf CompilerCallback)
Dim CallBackData As IntPtr = IntPtr.Zero
Game.SetCompilerCallback(ScriptCallBack, CallBackData)
Dim Size As Integer = 0
If (Game.CompileScript("C:\Proyectos\WME\Prueba\data\scripts\game.script", True, Size).ToInt32 <> 0) Then
MessageBox.Show(Size.ToString())
Game.EmptyScriptCache()
End If
Else
MessageBox.Show("Compiler is not available")
End If
End Sub
Public Sub CompilerCallback(ByVal Line As Integer, ByVal Text As String, ByVal Data As IntPtr)
MessageBox.Show("Line " + Line.ToString() + ": " + Text)
End Sub
Mnemonic, I need your help!!! ???
Regards,
SANNOI
-
returns me the same error: "Line 1: Error opening include file scripts\base.inc". I've If (Game.CompileScript("C:\Proyectos\WME\Prueba\data\scripts\game.script", True, Size).ToInt32 <> 0) Then
I guess you have to change your work dir to the project folder ("c:\Proyectos\WME\Prueba\data") before calling this function ?
-
I will look into it.