Posted by: Peter Quirk | August 17, 2008

Call the Ghostbusters!

Two days ago I did something really stupid to my realXtend world. Without looking too closely at a script I pasted it into an new cube prim in my virtual office and the object disappeared. Confused, I created another cube object of a different color and pasted the script. It also disappeared. I went outside the building looking for them and found them near the edge of the island, zooming around in slightly perturbated circles. On inspecting, it was obvious why they behaved this way, and why I would have a lot of trouble stopping them. The script, copied verbatim from Tedd Maa’s blog, looks like this:
//c#

double x = 0;
double y = 0;

public
void default_event_state_entry()
{
llSetTimerEvent(0.1);
}

public void default_event_timer() {
x += 0.2;
y += 0.1;

Prim.Position.x = System.Math.Sin(x) * 10 + 100;
Prim.Position.y = System.Math.Cos(y) * 10 + 100;
}

You can see that the script centers the objects at (100,100) where they zoom around in a circle of approximately 10m radius with random variation in the radius. There’s no mechanism for stopping them. Unfortunately, I was blinded by the fancy new capabilities – the Prim datatype and the fact that OpenSim/realXtend supported C# scripts. I was so keen to try them out that I neglected to inspect the script very carefully.

How do you recover from this situation? The objects are impossible to catch. You need something like the Ghostbusters’ ghost trap, but these moving objects seem to knock all large physical objects over.

You could restore from a backup, but I didn’t have one. You could save all the assets, edit the XML file to remove the offending objects, rebuild your island and load the edited asset file.

I decided it was time to learn something about the database structure and remove the offending objects. From the opensim documentation I learned that there are two tables which describe rezzed objects – prims and primshapes. The prims table describes all aspects of rezzed prims except their shape and contents. The primshapes table describes their shapes and contents. Both tables are indexed by the the UUID of the object.

To get the UUIDs of the moving objects, I created a sensor device which scanned for ACTIVE | SCRIPTED objects.  I placed it very closely to the edge of the rough circle that the objects followed. The sensor object reported their UUIDs whenever I touched it. I shutdown the client and server before proceding with database modifications.

I’m using the SQLite database for my test environment. The simplest tool for maniuplating SQLite databases is the SQLite Manager add-on for FireFox. It’s easily installed in a couple of minutes. You use the Connect Database menu item to browse for Opensim.db in the rexserver directory, whereupon you can browse or search the prims and primshapes tables easily. The offending objects were easy to locate at the end of these tables since they are chronologically ordered. I simply deleted them from the primshapes and prims tables and that was sufficient to eliminate their annoying behavior. SInce these objects were scripted, there had to be be scripts somewhere with a link back to these UUIDs. I found them in the the primitems table. These items have an invType of 10. Like the prims themselves, these scripts were at the end of the end of the primitems table since they were the most recent scripts created. After deleting them, I restarted the servers and the viewer and life was good again.

Is there a better to solve this problem? Add a comment to share your solution with everyone.

Advertisements

Responses

  1. In SL you can disable scripts from running on a parcel. IDK if thats implemented in OpenSIM yet. If it was you could disable the scripts and then recover your objects.

  2. You’re absolutely right Mike. From the debug panel on the Region/Estate menu you can disable scripts. Thanks for bringing this to my attention! I’m still glad I made the detour into the database structure :-)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: