This is usefull when you are making things like light controles, dance floors, TV tuners, e.t.c. were you want the owner only to operate them, and no one else with the same
controle device, to use them on someone elses items.
Code 1 - The controle object sending out comands
CODE
integer cha = -4567;
key own;
default
{
on_rez(integer x)
{
own = llGetOwner();
}
state_entry()
{
own = llGetOwner();
}
touch_start(integer x)
{
if (llDetectedKey(0) == llGetOwner())
{
llRegionSay(cha,(string) own + " test");
}
}
}
Code 2 - for the object receaving the comands
CODE
integer cha = -4567;
key own;
list message;
default
{
on_rez(integer x)
{
own = llGetOwner();
}
state_entry()
{
llListen(cha,"",NULL_KEY,"");
own = llGetOwner();
}
listen(integer chan,string name, key id, string mess)
{
message = llParseString2List(mess,[" "],[2]);
string aa = llList2String(message,0);
string aaa = (string) own;
if (aa == aaa)
{
string bb = llList2String(message,1);
llSay(0,bb);
}
}
}