Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

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
Discussion Thread
04-13-2007 21:22
/54/a3/177353/1.html
_____________________
i've got nothing. ;)
Pip Helios
Registered User
Join date: 29 Sep 2006
Posts: 22
04-20-2007 07:00
Another alternative over checking size is chacking if the objects key is the same as the owner's key (avatars own themselves) so it might look like if(llGetOwnerKey(id)!=id) admittedly llGetOwnerKey only works if the onwer is in sim but then agian if it returns a null key then it's a object and the statement works fine. Generally if a object is talking for a person and saying abusive things it's best to check on it before hopping to the ban list.