Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005930opensim[REGION] Script Functionspublic2012-03-12 22:142014-07-29 13:41
Reportercmickeyb 
Assigned Tocmickeyb 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Versionmaster (dev code) 
Target Versionmaster (dev code)Fixed in Version 
Summary0005930: Extend LSL/MOD commands to support direct calls into Region Module functions
DescriptionThis patch is highly experimental!!!

The patch defines a new MOD script command (modInvoke, like modSendCommand) to invoke a function in a region module. In addition, it modifies the CS code generator to translate inline functions into an invocation of modInvoke. So a script like:
   string value = JsonGetValue(storeID,keypath);
Gets translated into
   string value = modInvoke("JsonGetValue",storeID,keypath);

The invocation uses the same invocation style as modSendCommand (all invocations go through an extended IScriptModuleComms interface) so there should be no impact on what gets pulled into the scripts (and should avoid any references that would cause problems for garbage collection.

Invocation of functions is type-checked at runtime (the compile time version required some serious surgery on the CS code generator which i'm not inclined to do).

A region module registers a function with a call like this:

Type types[] = new Type[] { typeof(string), typeof(string) };
IScriptModuleComms comms = m_scene.RequestModuleInterface<IScriptModuleComms>();
comms.RegisterScriptInvocation("JsonGetValue",SI_GetValue,types);

And the definition of SI_GetValue looks like this:

string SI_GetValue(UUID scriptID, object[] parray);

since parray has already been verified to match the type signature extracting the parameters is relatively straight forward:

string path = (string)parray[1];

The current version of the patch only supports functions that return strings. Working to remove that limitation but it will require another change to the CS code generator. All LSL types are supported as input except lists. Keys, quaternions and vectors are converted to strings.

I've tested this with several functions in my region modules. It needs quite a bit of additional testing.
TagsNo tags attached.
Git Revision or version number25592bbd852e9350bca2
Run ModeStandalone (1 Region)
Physics EngineBasicPhysics
EnvironmentUnknown
Mono Versiontrunk
Viewer
Attached Filespatch file icon script.patch [^] (20,763 bytes) 2012-03-13 14:20 [Show Content]

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2012-03-12 22:14 cmickeyb New Issue
2012-03-12 22:14 cmickeyb Status new => assigned
2012-03-12 22:14 cmickeyb Assigned To => cmickeyb
2012-03-13 14:20 cmickeyb File Added: script.patch
2012-04-18 11:40 cmickeyb Status assigned => resolved
2012-04-18 11:40 cmickeyb Resolution open => fixed
2014-07-29 13:41 chi11ken Status resolved => closed


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker