After I looked at some basic scripting in my previous article,
Experimenting with MRM, I'm now
aiming for total world domination. This is not quite as dramatic as
it sounds - in fact this means, I now want to find out what you can
do with the World Object. Let's now take a look at
the interface so we can access Objects, Avatars, Parcels and
the Terrain. Adam gave a nice example of this in his article MRM: Making
Scripting Simpler and Faster .
Let's see how this works with Objects. The Objects in a region
are represented by 'IWorld.Objects', which is of Type
IObjectAccessor. If you wonder why this isn't just a List or Array,
like IObject[], look here. The important thing about this, is, that
it doesn't matter for my script. To access all Objects in a scene I
still can use the following:
foreach(IObject obj in World.Objects)
So here we go....
//MRM:C#
/*=============================================================
(c) all rights reserved
================================================================*/
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
namespace OpenSim{
class MiniModule : MRMBase
{
public override void Start()
{
Host.Object.Say("Starting up a useless script.(MRM)");
Host.Object.OnTouch += OnTouched;
}
void OnTouched(IObject sender, TouchEventArgs e)
{
foreach(IObject obj in World.Objects)
{
obj.Say("I am Here!");
}
}
public override void Stop()
{
}
}
}
I've covered my ears and hit save and click on the Box.

...and the World answers.
Well, this is new. The ability to manipulate other Primitives in
the Scene from one Script in a Prim? That offers a lot of
possibilities. Unfortunately, it also offers some that I don't want
to have to worry about. Will I be able to manipulate Object that
don't belong to me?
Thankfully, the short answer appears to be "No".
I took the Object with that MRM to my other sim, that is owned
by my alt. I rezzed... nothing.... reset... nothing, phew! But as
soon as I handed the script over to my alt, she was then able to
re-compile and execute the script. Uh-oh! So it
seems, only the Landowner can run MRM's on his land, BUT,
nevertheless it seems that as the Landowner, you can manipulate all
Objects on your Land, whether you are the owner of that Object or
not. Well, fair enough, at least it's your Land your messing
with...
So what can you do with it? You may can move every Prim on your
Region 100m up in to the air. Nice for Spring-Cleaning, yes? Or
create a RezBox that only needs one script to move every Prim of
the build in the right position. Or control a huge link-set with
just one script......OR..mess up your whole sim with one single
click, by randomly move every Prim around.
What if i somehow acquire and Object, that contains an MRM
Script, and i rez it on my Land..... next second, every prim in my
region is colored pink? And this is the most harmless assumption of
what can happen. MRM can do a lot of magic, but only if you enable
MRM in your OpenSim.ini. Will the fear of malicious scripts, hidden
inside large wooden bunny rabbits and disguised with sheeps
clothing, keep people from doing that?
Once again I have to refer to Adams's very first piece about
MRM's, MRM Scripting - Coming to
OpenSim soon!
"Proper security is part of the design, however is
currently unimplemented."
Ok enough said. I only want to look at the bright side of MRM
Scripting. What can I actually do with all this new power in my
hands?. I want to do something, not necessarily useful, but maybe
something nice.
To have something to work with, I created 5 default cubes and
gave them the Description "MRM TEST DUMMY", so that I could use
if(obj.Description == "MRM TEST DUMMY")
{
...
}
to work with these Objects....(and *only* with these objects
mind)
I eventually came up with the following...
//MRM:C#
//@DEPENDS:OpenMetaverseTypes.dll
using OpenMetaverse;
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
namespace OpenSim{
class MiniModule : MRMBase
{
private UUID SteelTexture;
private UUID BrickTexture;
private UUID MosaicTexture;
private UUID PlyWoodTexture;
public override void Start()
{
Host.Object.Say("Starting up a useless script.(MRM)");
Host.Object.OnTouch += OnTouched;
SteelTexture = new UUID("00000000-0000-2222-3333-100000001036");
BrickTexture = new UUID("00000000-0000-1111-9999-000000000001");
MosaicTexture = new UUID("00000000-0000-2222-3333-100000001019");
PlyWoodTexture = new UUID("89556747-24cb-43ed-920b-47caed15465f");
}
void OnTouched(IObject sender, TouchEventArgs e)
{
foreach(IObject obj in World.Objects)
{
if(obj.Description == "MRM TEST DUMMY")
{
obj.Say("Ready...");
obj.Materials[0].Texture = MosaicTexture;
obj.Materials[1].Texture = BrickTexture;
obj.Materials[1].Texture = SteelTexture;
obj.Say("Thanks..");
}
}
}
public override void Stop()
{
}
}
}
I had a hard time figuring out how to deal with OpenMetavers
Types like "UUID", until i finally got it to work by using :
//@DEPENDS:OpenMetaverseTypes.dll
using OpenMetaverse;

I have to admit that i'm still not sure if this is the right way
to do this, so, don't try this at home, at least not until someone
less noobish than me confirmed this.
And this is the Result. Nice if you have a big Build, maybe a
House or something, and want to try a new Texture on it. As long as
you use a common Description for you building - Prims. Or, as a
service to the user, deliver it with a set of optional textures
that can be applied with one simple Script Menu.
To reverse the Effect, i just have to modify these Lines :
obj.Materials[0].Texture = PlyWoodTexture;
obj.Materials[1].Texture = PlyWoodTexture;
obj.Materials[1].Texture = PlyWoodTexture;
and run the Script again....and we're back to the good old
Plywood.
Right now, when you look at the source of the MRM Module, you'll
find a lot of lines like this :
set { throw new System.NotImplementedException(); }
So, if you are a talented c# coder, and have some time to kill,
you may like to read Adam's MRM: Language
Contributions.
For now, thanks for reading, i have to go back to my Sandbox and
will try not to ravage my whole Sim with my scripting Experiments
and find some more new stuff for the next part of this Article.
Happy scripting!
Ziah.