Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

SL to EMAIL

Taln Shark
Registered User
Join date: 7 Feb 2005
Posts: 7
12-30-2005 16:20
Hi there,
Can anyone make me a script that will allow ppl to click on a box on sl, type their message, then send it to a defined email address. For custom orders and support purposes.

Thank you,
Taln Shark.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-30-2005 17:42
What if you let them drop a notecard in the box and the message of the note got sent to your e-mail instead? It would allow a customer to write the message on their own time and in any length...

Either way, contact me in game and we can discuss details, perms, and a price.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
12-30-2005 19:32
Bear in mind that e-mails can only be short (okay, 4096 characters, but that includes all headers).
If you only want a quick e-mail then it's just a case of having a listen created (not on channel 0 or you'll be spammed to your untimely demise!) on which a user can type their e-mail. Perhaps having the listen only switch on when someone has touched the object first, this way you can filter the chat to only return something that avatar has said, in this case you can use zero (as in the example).

When it receives a message it simply e-mails it to you. e.g:-

CODE
default {
integer listenID; // Variable used to track listens we've created

state_entry() {
llSetText("Touch me to send an e-mail!",<1,1,1>,1.0); // Set some info text
}
touch_start(integer x) {
listenID = llListen(0,llDetectedName(--x),llDetectedKey(x),""); // Listen only for this av
llInstantMessage(llDetectedKey(x),"Please speak your product name and reply e-mail address"); // Let them know what to say!
}
listen(integer channel, string name, key id, string msg) {
llListenRemove(listenID);
llInstantMessage(id, "Your e-mail has been sent!");
llEmail("yourname@yourdomain.com", "SL Support Request", msg);
}
}
Taln Shark
Registered User
Join date: 7 Feb 2005
Posts: 7
12-31-2005 02:17
that code has an error, if you can just check it out.
Lallander Parvenu
Registered User
Join date: 21 Apr 2005
Posts: 45
12-31-2005 07:00
Yeah the integer should be at the top and not part of default.

CODE


integer listenID; // Variable used to track listens we've created

default {
state_entry() {
llSetText("Touch me to send an e-mail!",<1,1,1>,1.0); // Set some info text
}
touch_start(integer x) {
listenID = llListen(0,llDetectedName(--x),llDetectedKey(x),""); // Listen only for this av
llInstantMessage(llDetectedKey(x),"Please speak your product name and reply e-mail address"); // Let them know what to say!
}
listen(integer channel, string name, key id, string msg) {
llListenRemove(listenID);
llInstantMessage(id, "Your e-mail has been sent!");
llEmail("yourname@yourdomain.com", "SL Support Request", msg);
}
}


Im sure theres fancy reasons why thats the case, but I got it working.
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
12-31-2005 07:14
From: Lallander Parvenu
Im sure there's fancy reasons why thats the case, but I got it working.
I think the fancy reason is that LSL state blocks are not variable scopes so although you wrote perfectly valid C/C++, I think it was an LSL compiler bug that allowed it to compile at all.
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
12-31-2005 09:46
Ooops, should have spotted that! In my defence it was 3am so I'm actually surprised the rest of it worked fine :P
Lit Noir
Arrant Knave
Join date: 3 Jan 2004
Posts: 260
12-31-2005 09:53
One thing to note, the Listen approach is fine for small messages, but you are limited to something like 256 characters in a chat line. The notecard approach mentioned earlier is the method I prefer for longer messages (though you need to be sure to truncate the notecard if it gets beyond the 4k limit of an email). Alternatively, you could keep the listen open, allow people to enter multiple chat lines, and then hade a command like "/send" that will send the message and close the listener, or just allow a timer to close out the listen after x seconds of no responses from the av.
Lallander Parvenu
Registered User
Join date: 21 Apr 2005
Posts: 45
12-31-2005 12:33
Introvert, I can easily say that went way over my head :D

Does anyone have an example that allows for use of notecards?
I like to have a mailbox out in world and would love for it to send me an email instead of having to manually check it.