object_display.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
string wasKeyValueGet(string k, string data) {
    if(llStringLength(data) == 0) return "";
    if(llStringLength(k) == 0) return "";
    list a = llParseStringKeepNulls(data, ["&", "="], []);
    integer i = llListFindList(llList2ListStrided(a, 0, -1, 2), [ k ]);
    if(i != -1) return llList2String(a, 2*i+1);
    return "";
}
 
default {
    listen(integer channel, string name, key id, string message) {
        integer type = (integer)wasKeyValueGet("type", message);
        if(type & AGENT) {
            llSetText(wasKeyValueGet("name", message) + "\n⎕", <.5, 1, .5>, 1);
            jump done;
        }
        if(type & SCRIPTED) {
            llSetText(wasKeyValueGet("name", message) + "\n⎕", <.5, .5, 1>, 1);
            jump done;
        }
        llSetText(wasKeyValueGet("name", message) + "\n⎕", <1, 1, 0>, 1);
@done;
        llRemoveInventory(llGetScriptName());
    }
    on_rez(integer num) {
        if(num == 0) return;
        llListen(num, "", "", "");
    }
}