[Opensim-dev] Region-Module Developing problems of a beginner
lillith
lillith at hyperfreedom.org
Fri Oct 10 03:28:33 UTC 2014
Hey Melanie,
this finally fixed my Problem, thank you so much!
I really don't know how i could miss that, but after you told me, i was
able to search for it in the code ;-)
There is still a lot i need do learn ;-)
Am 10.10.2014 um 05:05 schrieb Melanie:
> Region modules are created by the region module loader at runtime.
> It is the module developer's responsibility, if the module exports
> an interface, to register an instance of that interface with scene:
>
> m_scene.RegisterModuleInterface<YourInterface>(this);
>
> To use the module, you need to use:
>
> Scene.RequestModuleInterface<YourInterface>()
>
> which will give you the initialized, running instance.
>
> See the code for more details, it is a pattern you see in a lot of
> places.
>
> Melanie
>
> On 10/10/2014 04:03, lillith wrote:
>> Hey Justin,
>> thank you for answering me ;-)
>>
>> It seems i still do not understand how this Interface-stuff works.
>>
>> what i did:
>>
>> in Module 1:
>>
>> public class PathfindingModule : IPathfinding, INonSharedRegionModule
>> {
>> ...
>> public void MyFunction()
>> {
>> ...
>> }
>> }
>>
>> also another file with the interface
>>
>> public interface IPathfinding
>> {
>> void MyFunction();
>> }
>>
>>
>> in Module 2:
>>
>> public class TestModule : INonSharedRegionModule
>> {
>> private IPathfinding m_pathfinding;
>>
>> public void Testfunction()
>> {
>> m_pathfinding = new PathfindingModule();
>> m_pathfinding.MyFunction();
>> }
>>
>> }
>>
>> (I simplified it a bit)
>>
>> in Module 2 the "Testfunction" is actuially called by an inworld script
>> (for testing)
>>
>>
>> This compiles and runns. But if i call the function in the inworld
>> script, i get the error:
>>
>> "03:37:10 - [SCRIPT INSTANCE]: Runtime error in script New Script, part
>> Primitive 345f9256-6f59-445a-a639-2efe628a49e7 at <143.0292, 44.81059,
>> 21.25641> in DarkLand System.Reflection.TargetInvocationException:
>> Exception has been thrown by the target of an invocation."
>> (I Like this message because its saying "Anywhere in your 1000 lines of
>> code something went wrong" XD)
>>
>> After looking closer, it seem to happen because all variables in Module
>> 1 are empty since i created a new instance of that class.
>>
>> But i would need to access the currently running instance of the
>> "PathfindingModule" class.
>>
>>
>> Am 10.10.2014 um 02:06 schrieb Justin Clark-Casey:
>>> Hi lillith. It should be possible to register an interface from your
>>> own DLL without placing it in OpenSim.Region.Frameworks.Scene. You
>>> just need to make sure that both modules have a copy of this interface
>>> or reference a common DLL where it resides.
>>>
>>> If this doesn't work please do say and we can investigate further.
>>>
>>> On 09/10/14 03:28, lillith wrote:
>>>> Hi all,
>>>> im not sure if it's right to post such thing here, if i'm wrong
>>>> please correct me.
>>>>
>>>> I got stuck writing my Region-Modules, maybe someone could help me.
>>>>
>>>> I wrote a Module (for Pathfinding) that collects a lot of
>>>> informations out of the scene and stores it into Variables.
>>>> This is done while server-startup and takes a lot resources.
>>>>
>>>> Now i want to do another Module, that is able to access the data of
>>>> the 1st module.
>>>>
>>>> so for example:
>>>>
>>>> The new Module calls a Function in the 1st Module. The 1st Module
>>>> starts calculating with the data it already has and
>>>> send the result back to the second Module.
>>>> I don't want to mess with the code of OpenSim. The Modules should
>>>> still work with a unmodified Opensim-Version (Like
>>>> drop the .dll-files into the bin folder of a fresh installed Server).
>>>>
>>>> I tried to create a Module interface, but the Problem is: it seems i
>>>> need to put a file into
>>>> Opensim.Region.Framework.Interfaces. So i would directly change
>>>> OpenSim. (Or maybe i did not understand that Namespace
>>>> thing XD)
>>>>
>>>> I'am quite new to the C# stuff, so please don't kill me for that
>>>> question ;-)
>>>> And sorry for my bad English, its not my native Language.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Opensim-dev mailing list
>>>> Opensim-dev at opensimulator.org
>>>> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
>>>>
>>>
>> _______________________________________________
>> Opensim-dev mailing list
>> Opensim-dev at opensimulator.org
>> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
>>
>>
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at opensimulator.org
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
More information about the Opensim-dev
mailing list