From 5ad6d5a939fb7bf0fdfdc6925d4afed306e08641 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 11 Apr 2007 12:13:21 +0000 Subject: First basic test script now works in the jvm scripting engine. For it to work you need to have a java sdk installed and the javac.exe somewhere in the environment Path variable. Then To test, copy the text from bin/script1.text into a note card and then add that note to a prim. --- OpenSim.Scripting.EmbeddedJVM/Interpreter.cs | 3 +++ OpenSim.Scripting.EmbeddedJVM/InterpreterLogic.cs | 4 ++-- OpenSim.Scripting.EmbeddedJVM/InterpreterMethods.cs | 3 ++- OpenSim.Scripting.EmbeddedJVM/OpenSimJVM.cs | 7 ++++--- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim.Scripting.EmbeddedJVM') diff --git a/OpenSim.Scripting.EmbeddedJVM/Interpreter.cs b/OpenSim.Scripting.EmbeddedJVM/Interpreter.cs index aeeee0a..b94248c 100644 --- a/OpenSim.Scripting.EmbeddedJVM/Interpreter.cs +++ b/OpenSim.Scripting.EmbeddedJVM/Interpreter.cs @@ -49,6 +49,7 @@ namespace OpenSim.Scripting.EmbeddedJVM else { // Console.WriteLine("No parent function so ending program"); + this._mThread.stack.StackFrames.Pop(); run = false; } handled = true; @@ -71,6 +72,7 @@ namespace OpenSim.Scripting.EmbeddedJVM else { // Console.WriteLine("No parent function so ending program"); + this._mThread.stack.StackFrames.Pop(); run = false; } handled = true; @@ -88,6 +90,7 @@ namespace OpenSim.Scripting.EmbeddedJVM else { // Console.WriteLine("No parent function so ending program"); + this._mThread.stack.StackFrames.Pop(); run = false; } handled = true; diff --git a/OpenSim.Scripting.EmbeddedJVM/InterpreterLogic.cs b/OpenSim.Scripting.EmbeddedJVM/InterpreterLogic.cs index 673970a..8c895af 100644 --- a/OpenSim.Scripting.EmbeddedJVM/InterpreterLogic.cs +++ b/OpenSim.Scripting.EmbeddedJVM/InterpreterLogic.cs @@ -274,11 +274,11 @@ namespace OpenSim.Scripting.EmbeddedJVM if (flcom1 is Float && flcom2 is Float) { Int compres = new Int(); - if (((Float)flcom1).mValue > ((Float)flcom2).mValue) + if (((Float)flcom1).mValue < ((Float)flcom2).mValue) { compres.mValue = -1; } - else if (((Float)flcom1).mValue < ((Float)flcom2).mValue) + else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) { compres.mValue = 1; } diff --git a/OpenSim.Scripting.EmbeddedJVM/InterpreterMethods.cs b/OpenSim.Scripting.EmbeddedJVM/InterpreterMethods.cs index e025293..dc3402e 100644 --- a/OpenSim.Scripting.EmbeddedJVM/InterpreterMethods.cs +++ b/OpenSim.Scripting.EmbeddedJVM/InterpreterMethods.cs @@ -71,11 +71,12 @@ namespace OpenSim.Scripting.EmbeddedJVM BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); if (bs1 is Int) { - Console.WriteLine("get entity pos for " + ((Int)bs1).mValue); + //Console.WriteLine("get entity pos for " + ((Int)bs1).mValue); //should get the position of the entity from the IScriptAPI OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); Float pos = new Float(); pos.mValue = vec3.X; + // Console.WriteLine("returned x value " + vec3.X.ToString()); this._mThread.currentFrame.OpStack.Push(pos); } this._mThread.PC += 2; diff --git a/OpenSim.Scripting.EmbeddedJVM/OpenSimJVM.cs b/OpenSim.Scripting.EmbeddedJVM/OpenSimJVM.cs index 77a92e5..b47bb50 100644 --- a/OpenSim.Scripting.EmbeddedJVM/OpenSimJVM.cs +++ b/OpenSim.Scripting.EmbeddedJVM/OpenSimJVM.cs @@ -66,10 +66,11 @@ namespace OpenSim.Scripting.EmbeddedJVM tw.Close(); //now compile - System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\Java\jdk1.6.0_01\bin\javac.exe", "*.java"); - psi.RedirectStandardOutput = true; + System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); + // psi.RedirectStandardOutput = true; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; psi.UseShellExecute = false; + System.Diagnostics.Process javacomp; javacomp = System.Diagnostics.Process.Start(psi); javacomp.WaitForExit(); @@ -91,7 +92,7 @@ namespace OpenSim.Scripting.EmbeddedJVM //now delete the created files System.IO.File.Delete(scriptName + ".java"); System.IO.File.Delete(scriptName + ".class"); - this.OnFrame(); + //this.OnFrame(); } catch (Exception e) { -- cgit v1.1