(Simply create a prim and name it whatever you want the message to come from like: "John Resident". Add this script to it..The command is: /111 UserFirstName UserLastName Message you wish to send to them.. Updated to check to make sure the person is online. If they were offline, and had their IM's forwarded to e-mail, it would tell them who it came from.. (Or perhaps from the owner of the prim)
The target person can see your message only at open chat and the other residents arround can not.
(add the script by Lagertha)
The target person can see your message only at open chat and the other residents arround can not.
[To see links please register here]
Code:
string NAME; // name to look up
string URL = "http://w-hat.com/name2key"; // name2key url
key reqid; // http request id
string Message;
integer x;
key onlineReq;
key avatarId;
integer channel=111;
default
{
state_entry()
{
llSetText("",<0,0,0>,0);
llListen(channel,"",llGetOwner(),"");
}
on_rez(integer start_param)
{
llResetScript();
}
touch_start(integer num_detected)
{
llOwnerSay("Type: /" + (string)channel + " FirstName LastName Message to send to the person");
}
listen(integer channel,string name, key id, string message)
{
Message = "";
list templist = llParseString2List(message, [" "],[]);
integer length = llGetListLength(templist);
for (x=2;x<length;x++)
{
Message = Message + llList2String(templist,x) + " ";
}
NAME = llList2String(templist,0) + " " + llList2String(templist,1);
if(Message == "")
{
llOwnerSay("You must enter a message to send");
}
else
{
reqid = llHTTPRequest( URL + "?terse=1&name=" +llEscapeURL(NAME), [], "" );
}
}
http_response(key id, integer status, list meta, string body) {
if( id != reqid )
return;
if( status == 499 )
llOwnerSay("name2key request timed out");
else if( status != 200 )
llOwnerSay("the internet exploded!!");
else if( (key)body == NULL_KEY )
llOwnerSay(NAME + " not found");
else
{
avatarId = (key)body;
onlineReq = llRequestAgentData((key)body,DATA_ONLINE);
}
}
dataserver(key queryid, string data)
{
if( queryid != onlineReq )
return;
if( (integer)data )
{
llInstantMessage(avatarId, Message);
llOwnerSay("[" + NAME + "] " + Message);
llSetText(NAME + "\n" + Message,<1.0,0.0,0.0>,1.0);
}
else
llOwnerSay(NAME + " is not online");
}
}