Monday, June 25, 2012

A Chair and Sending Emails


This second post of Second Life takes me to creating some objects and stuff using the scripting language and the object builder. It is a bit frustrating at first but then it can get quite ok. The first thing I attempted to do was to build a chair and make my avatar sit on it. The first problem I had was that when I did the legs of the chair, another avatar came and removed it. Asking her why, she said that I was not allowed to build there and she took me to another place.

Creating a Chair

I used cylinders to make the legs and a cube to create the seat and the back of the chair. Although it is simple, it is a cute chair :) I used co-ordinates to create the legs of the chair so that I would know exactly how large it is and it would be easy to create the seat. I made the back legs longer so that I would use them for the back of the chair. Then I created two cubes, one for the seat and one for the back of the chair. Using the arrows I could move the parts and then dial in the exact number in the coordinates to create a smooth even chair. It took me nearly 1 hour to create this chair, but I was very happy with the end result. Also, the way I created the chair the avatar sat down immediately.


Figure 1: The Chair


Figure 2: The Avatar Sitting Down

Creating an object to send emails

Anyone doing programming knows that you need to setup a proper SMTP server with all the necessary details and settings to be able to send an email from a website or from an application. However, it was very easy to send emails in Second Life. using only a function with 2 lines of code, I was immediately sending emails when the object was touched. This was done by using the code below:

touch_start(integer total_number)
{
     llEmail("danielborgmt@gmail.com","Hey, You touched me","I have been touched on Second Life");
     llSay(0, "You Touched Me! - I sent an email to my owner!");
}

This shows how easy it is to send emails from Second Life. After touching the box I created with the script above, using the technique shown below, I got an email from the Second Life Object. The email indicates the name of the object, the Region name and also the local position.


Figure 3: Touching the Object


Figure 4: Email received from the Object 

No comments:

Post a Comment