02-25-2013, 01:43 AM
Code:
/*
Bornslippy Ruby presents...
Editable array with the chat
Tags: avatar, chat, communications, owner, primitive, todo, ['', '', '']
Description: Editable array with the chat
License:
Editable array with the chat
Copyright (c) 2010 Bornslippy Ruby
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
http://secondlife.coolminds.org
*/
integer Channel = 0;
list Array = [];
default
{
state_entry()
{
llListen(Channel, "", llGetOwner(), "");
}
listen(integer _c, string _n, key _i, string _m)
{
if (_c == 0)
if (llGetSubString(_m, 0, 2) == "add")
{
if (-1==llListFindList(Array, [llGetSubString(_m, 4, llStringLength(_m))]))
{
llOwnerSay("Entry "+llGetSubString(_m, 4, llStringLength(_m))+"] added.");
Array += llGetSubString(_m, 4, llStringLength(_m));
}
}
else if (llGetSubString(_m, 0, 2) == "del")
{
if (-1<llListFindList(Array, (list)llGetSubString(_m, 4, llStringLength(_m))))
{
Array = llDeleteSubList(Array, llListFindList(Array, (list)llGetSubString(_m, 4, llStringLength(_m))), llListFindList(Array, (list)llGetSubString(_m, 4, llStringLength(_m))));
llOwnerSay("Entry "+llKey2Name(llGetSubString(_m, 4, llStringLength(_m)))+"["+llGetSubString(_m, 4, llStringLength(_m))+"] removed.");
} else llOwnerSay("Entry "+llKey2Name(llGetSubString(_m, 4, llStringLength(_m)))+"["+llGetSubString(_m, 4, llStringLength(_m))+"] not found.");
}
else if (llGetSubString(_m, 0, 3) == "list")
llOwnerSay("\n\nArray\n"+llList2CSV(Array));
}
}