Table of Contents

Shortnote

As the reverse of Project Alexandira, we can create a primitive that writes all the notecards dropped in that primitive to a file on the filesystem path. This is created for the VIBE group in order to allow an easy turn-in of homework written by students. However, it can function as an universal method of providing feedback for the sim owner.

Alternatively, as described on the Project Alexandira page, one can use the cloud-sync DropBox to allow the easy retrieval of homework from students. For brevity, setting-up DropBox cloud sync is described on the Project Alexandira page and omitted here.

Requirements

Using C# in OpenSim grants any user direct access to the filesystem - this is a major concern since any file on the server filesystem could then be extracted through OpenSim. To prevent this, specify the following parameters in the OpenSim.ini configuration file, in the [Startup] section:

[Startup]
GrantLSL = 5998029f-ddde-4497-b3e1-b7a5d702742f,b02e3094-a3c6-4921-8dcf-5c33aea6c261
GrantCS = 5998029f-ddde-4497-b3e1-b7a5d702742f,b02e3094-a3c6-4921-8dcf-5c33aea6c261
GrantVB = 5998029f-ddde-4497-b3e1-b7a5d702742f,b02e3094-a3c6-4921-8dcf-5c33aea6c261
GrantJS = 5998029f-ddde-4497-b3e1-b7a5d702742f,b02e3094-a3c6-4921-8dcf-5c33aea6c261
GrantYP = 5998029f-ddde-4497-b3e1-b7a5d702742f,b02e3094-a3c6-4921-8dcf-5c33aea6c261

where the UUIDs 5998029f-ddde-4497-b3e1-b7a5d702742f and b02e3094-a3c6-4921-8dcf-5c33aea6c261 represent agent IDs that are allowed to use the respective languages.

It is imperative to well-define the agents that will be allowed to use the compilers you enable with the AllowedCompilers setting; otherwise, any agent will have full access to the filesystem.

  • The code expects that COURSEWORK_FOLDER is defined as a folder path (in the code) on the local system and all notecards dropped in the primitive will be created as children of that path.
  • The script requires that AllowedCompilers = "lsl,cs" is set in the OpenSim configuration file OpenSim.ini in order to enable C#-LSL scripting. Additionally, the script requires the OSSL functions to be enabled by setting AllowOSFunctions = true in the OpenSim configuration file OpenSim.ini.

Code

This script was tested and works on OpenSim version 0.7.4!

homework_dropbox.lsl
//c#
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
string COURSEWORK_FOLDER = @"/home/opensim/homework/";
 
public void default_event_state_entry() {
    System.IO.Directory.CreateDirectory(new System.Uri(COURSEWORK_FOLDER).LocalPath);
    llAllowInventoryDrop(TRUE);
}
 
public void default_event_changed(LSL_Types.LSLInteger change) {
    if(change & CHANGED_INVENTORY) {
        LSL_Types.LSLInteger cards = llGetInventoryNumber(INVENTORY_NOTECARD)-1;
        if(cards == -1) return;
        do {
            string card = llGetInventoryName(INVENTORY_NOTECARD, cards);
            string data = osGetNotecard(card);
            string path = COURSEWORK_FOLDER + card + ".txt";
	    try {
            	System.IO.File.WriteAllText(new System.Uri(path).LocalPath, data);
            catch(System.Exception) {
                // If file could not be written, for any reason, skip.
                continue;
            }
        } while(--cards > -1);
    }
}

opensim/homework_dropbox.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.