Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006729opensim[REGION] Scripting Enginepublic2013-08-07 03:522013-12-12 04:53
Reporterdiegoriofrio 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOS X 10.8, OS X 10.9 / Windows 8OSOpenSim binariesOS Version0.7.5, 0.7.6
Product Version 
Target VersionFixed in Version 
Summary0006729: Error when compiling sript in c# with RegionModule
DescriptionI had build a little RegionModule only to prove it, when I call one function on it from a LSL script works fine, but when I do exactly the same in a c# script, the compiler throw an error "The given key was not present in the dictionary". If I comment the call (in c# script) of the RegionModule functions all works fine.

I tried this in OpenSim 0.7.5 on a Mac with Mountain Lion and also in another PC with Windows 8.

The code of the LSL script is:
default
{
    state_entry()
    {
        integer x=ModTest0(1,2);
        llOwnerSay("ModTest0: " + x);
    }
}

The code of the c# script is:
//c#
public void default_event_state_entry()
{
    int x=ModTest0(1,2);
    llOwnerSay("ModTest0: " + x);
}

And the code of the Region Module library is:
using System;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;

[assembly: Addin("ProveOS", "0.1")]
[assembly: AddinDependency("OpenSim", "0.5")]
namespace ProveOS
{
    [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ProveOS")]
    public class ProveClass:INonSharedRegionModule
    {
        private IConfig m_config = null;
        private bool m_enabled = true;
        private Scene m_scene = null;

        private IScriptModuleComms m_comms;

        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public string Name { get { return this.GetType().Name;} }

        public void Initialise(IConfigSource config)
        {
            m_log.WarnFormat("[ProveOS] start configuration");
            try
            {
                if ((m_config = config.Configs["ProveOS"]) != null)
                    m_enabled = m_config.GetBoolean("Enabled", m_enabled);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[ProveOS] initialization error: {0}",e.Message);
                return;
            }

            m_log.ErrorFormat("[ProveOS] module {0} enabled",(m_enabled ? "is" : "is not"));
        }

        public void PostInitialise()
        {
            if (m_enabled) {}
        }

        public void Close() { }
        public void AddRegion(Scene scene) { }
        public void RemoveRegion(Scene scene) { }

        public void RegionLoaded(Scene scene)
        {
            if (m_enabled)
            {
                m_scene = scene;
                m_comms = m_scene.RequestModuleInterface<IScriptModuleComms>();
                if (m_comms == null)
                {
                    m_log.WarnFormat("[ProveOS] ScriptModuleComms interface not defined");
                    m_enabled = false;

                    return;
                }

                m_comms.RegisterScriptInvocation(this,"ModTest0");

                // Register some constants as well
                /*m_comms.RegisterConstant("ModConstantInt1",25);
                m_comms.RegisterConstant("ModConstantFloat1",25.000f);
                m_comms.RegisterConstant("ModConstantString1","abcdefg");*/
            }
        }

        public Type ReplaceableInterface
        {
            get { return null; }
        }

        #region ScriptInvocationInteface
        public int ModTest0(UUID hostID, UUID scriptID, int x, int y)
        {
            m_log.WarnFormat("[ProveOS] ModTest0 parameter");
            return x+y+1;
        }
        #endregion
    }
}
Steps To ReproduceOnly config OpenSim to AllowMODFunctions = true, create a dll with the code of the Region Module and copy in bin folder, then run OpenSim.

Copy the code of scripts in one or two prims and compile them.
TagsNo tags attached.
Git Revision or version number
Run ModeStandalone (1 Region)
Physics EngineBasicPhysics
Script Engine
EnvironmentMono / OSX, .NET / Windows64
Mono Version3.0
ViewerFirestorm
Attached Files

- Relationships

-  Notes
(0024861)
diegoriofrio (reporter)
2013-12-12 04:51

In 0.7.6 OpenSim version a clearer error message is presented when I compile this issue:

ErrorCS0103: The name 'ModTest0' does not exist in the current context

But in a lsl script works great.

- Issue History
Date Modified Username Field Change
2013-08-07 03:52 diegoriofrio New Issue
2013-12-12 04:51 diegoriofrio Note Added: 0024861
2013-12-12 04:53 diegoriofrio OS Version 0.7.5 => 0.7.5, 0.7.6
2013-12-12 04:53 diegoriofrio Platform OS X 10.8 / Windows 8 => OS X 10.8, OS X 10.9 / Windows 8


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker