Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

EMail from SL to outside with touch

CarloDM Demme
Registered User
Join date: 15 Jun 2007
Posts: 44
10-16-2007 08:34
i need one script like this

CODE
string ADDRESS = "yourmail@written.here"; 

default {
touch_start(integer total_number) {
key agent = llDetectedKey(0);
string subject = "Message From "+llGetObjectName();
string message = "The Agent"+llKey2Name(agent)+" touched your object!";
llEmail(ADDRESS,subject,message);
}
}


that allows to reiceve an email to know who have touched my object.

But

i'd like to complete my script giving the possibility, to the person who touched the object, to write in public channel the message instead of "The Agent"+llKey2Name(agent)+" touched your object!".

i know that i must use the l|Listen Function, but i'm not a scripter; so i need an help :)

sorry for my english (i know it'is awful) but i'm italian :)

See you soon!!!

CarloDM Demme
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
10-24-2007 12:39
I strongly recommend you to use lslwiki.net.

---------------------------------------------------------------------------------------------
string ADDRESS = "yourmail@written.here";

default {

touch_start(integer total_number)
{
key agent = llDetectedKey(0);
string subject = "Message From "+llGetObjectName();
llSay(0,"Hello " + llKey2Name(agent)", please write the message in publich channel, it will be delivered to " + llKey2Name(llGetOwner());
llListen(0,"",agent,"";);
llSay(0,"Message sent, thanks!";);


}
listen(integer channel, string name, key id, string message)
{

llEmail(ADDRESS,subject,message);

}
}
----------------------------------------------------------------------------------------

I can't compile it now, if you find a mistake an can't solve it IM me

Kahiro Watanabe
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
10-24-2007 14:41
One other thing, Turn off the listener after you get the message or it well send all text on the chat channel from that point on :)

try this rather:

string ADDRESS = "yourmail@written.here";
integer Handle;

default {

touch_start(integer total_number)
{
key agent = llDetectedKey(0);
string subject = "Message From "+llGetObjectName();
llSay(0,"Hello " + llKey2Name(agent)", please write the message in publich channel, it will be delivered to " + llKey2Name(llGetOwner());
Handle = llListen(0,"",agent,"";);
llSay(0,"Message sent, thanks!";);


}
listen(integer channel, string name, key id, string message)
{
llListenRemove(Handle);
llEmail(ADDRESS,subject,message);

}
}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-24-2007 15:02
CODE
string ADDRESS = "yourmail@written.here";
string subject;
integer listen_handle;//Always remove an unneeded listen.
integer chan = 86;//Don't use the public chat channel for anything but
// to speak other avatars.

default {

touch_start(integer total_number)
{
key agent = llDetectedKey(0);
subject = "Message From "+llGetObjectName();
//llSay wasn't formatted correctly
llSay(0,"Hello " + llKey2Name(agent)+ ", please type /86 followed by your message,
it will be delivered to " + llKey2Name(llGetOwner()));
listen_handle = llListen(chan,"",agent,"");
llSetTimerEvent(30.0);//Just in case someone touchs this and then doesn't send a message
}

listen(integer channel, string name, key id, string message)
{
llEmail(ADDRESS,subject,message);
llSay(0,"Message sent, thanks!");
llSetTimerEvent(0.0);//Message sent, we can close the listen
}
timer()
{
llListenRemove(listen_handle);
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
10-24-2007 16:31
Thanks Jesse, I did consider the timer but was in a hurry.
I like your trick of saying llSetTimerEvent(0.0);//Message sent, we can close the listen
I never realised that would triger the event, I can use that in quite a few of my scripts for efficiancy.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-24-2007 18:37
From: Very Keynes
Thanks Jesse, I did consider the timer but was in a hurry.
I like your trick of saying llSetTimerEvent(0.0);//Message sent, we can close the listen
I never realised that would triger the event, I can use that in quite a few of my scripts for efficiancy.

Hey pat yourself on the back thou!!!! You are catching on and posted about the listen handle!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum