2 June 2012

CMT3313 - Week 13 Post - Second Life...Not necessarily better than the first one

In my previous blog I skimmed over what Second Life is, today I am dedicating this post on the subject, what I like and what I don't like about it.



Fist thing that came to mind when I heard about Second Life was...WHY?! What's wrong with my first life? Why would I ever want to take part in a community of a bunch of complete losers and what's with the hole role playing?
Then I learnt that people actually sell land, clothes, accessories and appearances with real money!!! This further pushed me away from Second Life and the people who hang out there.
But I must admit, I already hated Second Life before I had even laid eyes on it and this blinded me from seeing what an accomplishment Second Life really is and that's from a technical point of view only!

I mean the the developers of this thing managed to create a whole virtual world in which subscribers can roam around and build things.
Yes, they enabled any user to build and program things to do anything they very well please and this is probably the only thing I liked about Second Life.

Scripting
So off to the interesting part from now on. To code your own objects you must use the Linden Scripting Language or LSL in short. This scripting language was created specifically for Second Life, it's based on Java and C programming languages and is a server side scripting language.

Now one must keep in mind that LSL is very state and event driven, meaning you do not create objects which have attributes and methods, instead you use states which contain one or more events.
States resemble real life scenarios, as in an engine can be on or off and the same goes for Second Life. By default every object you create has one state and that's "default", but you can create more states and change from one to the other.
Events on the other hand are just like event handlers in other programming languages. These are pre-defined and are triggered by a specific action, such as on touching the particular object, the "touch_start" event is triggered.



But enough about the theory and lets move to my first attempt at building an object and scripting it.

My go at Second Life Scripting
After I spent a few minutes having a go at scripting a twisty box, I managed to make my object send me an email when ever it got touched and this got me excited just like a little boy in a candy shop!


So here's the script I used, nothing fancy and I haven't gotten into using multiple states yet, but it's a start.


default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
        llEmail("grechClifford@gmail.com","Box Object Touched","Object has been touched");
        llSay(0, "You Touched ME! - Sent Email to Owner!.");
        
    }   
}


As you can see, the "touch_start" event first uses the "llEmail" function which sends me an email telling me that my object has been touched and then uses the "llSay" function to display a message to the user.


As for the result, I immediately receive the email displayed below:


Conclusion
So, my final verdict on Second Life...I still hate it as it is still filled with creeps posing as attractive women, but at least there is something which sparks my interest. Although I would also like to say that I am not planning to play this game very often apart for my degree purposes.

No comments:

Post a Comment