//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); } }