Thursday, 1 May 2014

Send email from Second Life

Sends an email to address with subject and message.
• string address
• string subject
• string message
The entire message (including the address, subject and other miscellaneous fields) can't be longer than 4096 bytes combined.

Specification

The message is prefixed with information about the prim sending the email.
Template Example
Object-Name: *prim*
Region: *simname* (*simpos.x*, *simpos.y*)
Local-Position: (*primpos.x*, *primpos.y*, *primpos.z*)

*message*
Object-Name: Object
Region: Gibson (254976, 256000)
Local-Position: (117, 129, 50)

The real message starts here.

Examples


string emailAddress = "somebody@example.com";
string emailHeader = "Someone touched me!";
 
 
default
{
    touch_start(integer num_detected)
    {
        // llSay(PUBLIC_CHANNEL, "Sending eMail report now, this will take ~20 seconds.");
 
        key id = llDetectedKey(0);
        string name = llDetectedName(0);
 
        llEmail(emailAddress, emailHeader,
            "I was touched by: '" + name + "' (" + (string)id + ").");
 
        // llSay(PUBLIC_CHANNEL, "Email has been sent.");
    }

Script to open a website in the browser as soon as the script starts running

Script to open a website in the browser as soon as the script starts running
Shows dialog to avatar offering to load web page at url with message.
If user clicks yes, launches the page in their web browser, starting the browser if required.
• key avatar avatar UUID that is in the same region
• string message message to be displayed in the dialog box
• string url
The url is truncated to 255 characters and message is truncated to 254 characters.
The protocol for the url must be specified, currently only "https://" and "http://" are supported.
The URL should be RFC-1738 compliant with proper escapes.

default
{
    touch_start(integer num_detected)
    {
    key id = llDetectedKey(0);

        // if the touching avatar is in the same sim
        if ( llGetAgentSize(id) )
        {
          string info = "My best website!";

            // must start with either "http://..." or "https://..."
            string url = "http://www.yahoo.co.uk";

            llLoadURL(id, info, url);
        }
        else
            llInstantMessage(id, "I can open it any time!");
    }
}

script to create a note card giver in Second Life

script  to create a note card giver in Second Life






1
string notecard = "Welcome Notecard";

default
{
    state_entry()
    {
       llSetText("Welcome to Notecard", <1,1,1>, 1.0);
    }

    touch_start(integer total_number)
    {
      llGiveInventory( llDetectedKey(0), notecard);
    }
}
2
when you touch the object, it gives error:
Unable to give inventory: 'No item named 'Welcome Notecard'.'.
3
solution:
put the notecard in the inventory box
4
click on inventory -> my inventory -> right click on notecards -> new notecards
in the name, type Welcome Notecard
description: notecard
Touch notecard giver


save the notecard.
drag notecard1 to contents folder.

5
now if you touch the object, it gives message:


Remember: your note card name has to be same as notecard string name