OSSL Script Library/ModInvoke

Introduction
You can invoke functions defined in a region module from a script using the modInvoke family of functions.

This functionality is in OpenSimulator 0.7.4-dev and after.

See also OSSL_Script_Library/ModSendCommand for a version of this functionality which allows passing of data between scripts and region modules through a single modSendCommand.

At the moment, if you want to insert script functions which take more than 3 parameters, on Windows you must either be compiling OpenSimulator yourself with .NET 4.0 or on Mono using Mono 2.8 or higher (preferably 2.10 or higher).

Enabling modInvoke
The first thing is to enable modSendCommand in OpenSim.ini. Make sure the line

AllowMODFunctions = true

is set to true and uncommented.

The Region Module
Here's the region module that implements several functions to be provided to scripts in the region.

The module registers functions through the IScriptModuleComms RegisterScriptInvocation method. This method takes the name of the function, an invocation delegate, an array of types used to validate parameters to the function, and a return type.

The functions in the region module can assume that the parameters passed through the argument array match the signature that was registered. That is, the function in the region module does not need to perform any kind of type checking.

The In-world Script
Here's the in-world script that calls the functions defined in the region module.