Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Whats talking?

Misch Lameth
Registered User
Join date: 20 Sep 2005
Posts: 6
04-12-2007 11:34
Someone got banned from a sim cause of someone with an object/script taking her name and shouting random things (I assume abusive stuff), so I finally got around to write out this little script for determining what object is shouting and who owns it.


CODE
 
//Just a simple gadget to determine whos talking through scripted objects:)
//
//after writing this i saw the sneaky trick on wiki and put it in to filter out avatar talk.
//enjoy
//Misch Lameth

key gOwnerKey; //owner of this script - were just keeping it in global, to check if owner change, its not really needed for this script i spose, it was really intended for resetting script on owner change for chat commands but i just left it in.
key gObjectOwner; //for key of owner of object speaking yeah
string gMessage; //keeping the message from listen
string gObjectName; //name of object

default
{
on_rez(integer param)
{
llSetText("",ZERO_VECTOR,0); //make sure text is cleared
llOwnerSay("Touch to clear text");

if(gOwnerKey != llGetOwner()) //check if owner changed, reset script if true.
llResetScript();
}

state_entry()
{
gOwnerKey = llGetOwner(); //get the owner key to check against on rez
llSetText("",ZERO_VECTOR,0);
llListen(0,"",NULL_KEY,""); //were listening for anything on default chat channel
}

touch_start(integer clicketyclick)
{
llSetText("",ZERO_VECTOR,0); //clear text on touch
}

listen(integer channel,string name,key id,string message)
{
gObjectName = name;
gMessage = message;
gObjectOwner = llGetOwnerKey(id);
if ( llGetAgentSize(id) != ZERO_VECTOR ) return; // sneaky trick: objects have no agent size, because they're no agents, so we only continue if the chat is from an object

llRequestAgentData(gObjectOwner,DATA_NAME);

}

dataserver(key queryid, string data)
{
llSetText(gMessage + "\n'\n'\n Owner of object: " + data + "\nName of object: " + gObjectName,<1,1,1>,1);
}
}





Enjoy and use/improve as desired :)
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
04-13-2007 21:22
/15/4a/177046/1.html
_____________________
i've got nothing. ;)
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
04-13-2007 22:37
Seems to me the fact that object chat text appears in a different color (by default, green) than avatar chat text (by default, white) alone is enough to determine whether an avatar or an object with their name is actually speaking.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
04-13-2007 23:01
yea scripted objects show up as a different color by default i guess you could set all chat to white but ...



anywho

good exercise in scripting altho i wouldnt use it in a populated area with its constant prim updates (hovertext) and the wide open listener

and cute trick with the agent size, altho ive probally seen it, ive not used it
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
04-25-2007 17:02
the agent size trick can be easily beaten by making the prim a "zero mass" prim.
Pip Helios
Registered User
Join date: 29 Sep 2006
Posts: 22
04-26-2007 07:50
From: Bobbyb30 Zohari
the agent size trick can be easily beaten by making the prim a "zero mass" prim.

How about
CODE
if(id!=llGetOwnerKey(id))
{
llOwnerSay(llKey2Name(id)+" is a object");
}

Since avatars own themselves, and even if the owner leaves sim (which would make llGetOwnerKey() return a blank key) it'll still trip the check....
ND Pitts
Registered User
Join date: 20 Jun 2006
Posts: 6
07-03-2007 19:47
I didn't know you could cancel the rest of an event with a return. It makes complete sense in a function. Thanks for the heads up.