PASTE NAVIGATION MENU CODE

Friday 13 July 2012

0
History
The concept of cloud computing dates back to the 1960s, when John McCarthy famously said, “computation may someday be organised as a public utility”. In fact, “someday” turned out to be that same decade, when as early as the 1960s, large-scale data centres were being deployed. Such data centres utilised the concept of dumb terminals (sometimes called thin clients). In such a system, low-power computer terminals - most having just enough power to boot into a PXE environment (Preboot Execution Environment) would connect via network to a central mainframe, and fetch their operating system over the network. The mainframe would carry out all of the processing, and the terminals would simply send input to the mainframe and receive output.

Back in the 60s cloud computing was not only an option - it was the only way to enable multi-user utilisation of mainframe computers. As the decades passed, the price of hardware fell, allowing business to provide powerful workstations (sometimes called fat clients) on every desk - for a while, the sky was cloudless.

In the early 2000’s, the dot-com bubble burst. Internet companies had to find a way to cut costs and increase efficiency. Amazon was at the forefront of such developments - as a survivor of the bubble, Amazon realised that only 10% of its computer infrastructure was in constant use - the rest was reserved for occasional spikes in traffic - what a waste!

Amazon modernised and used emerging technologies to increase efficiency. Virtualisation played a key role - being able to consolidate several servers onto one machine. Soon, Amazon had so much spare computing capacity that it could sell to others, and this is why Amazon Web Service (AWS) was launched in 2002, and further expanded in 2006-2007. For the first time, customers could ‘rent’ computing power - both in terms of storage and processing power.

Market Leaders
More services were offered, and nowadays the business has a plethora of cloud computing services to choose from, including:


VMWARE
Provider of virtualized infrastructure used to power most of the others mentioned in this list.

Windows Azure
Microsoft's offering of cloud computing including both storage space and cloud APIs.


CITRIX
Leading provider of desktop virtualisation and Software as a Service (SaaS).



SalesForce.com
In the cloud Customer Relationship Management (CRM).


Rackspace
High performance and high availability hosting and computing power resources in the cloud.

Amazon Web Services
The market leader in storage, computing, availability and scalability in cloud computing.


Others Include: Bluelock, Joyent, Terramark and Centurylink are notable contenders.

Services Offered on the Cloud
Cloud services are offered as a variety of implementations. Infrastructure as a Service (IAAS) is the provision of virtual machines, servers, network attached storage (NAS), load balancers and more, via an external company. Using these services, business can save a hefty sum on initial infrastructure investment, and many times gain much more than it could ever afford by leveraging the enterprise data centres of large providers. Indeed, services such as popular cloud-hosting service Dropbox leverage cloud services - AWS in the case of Dropbox - to provide fast, efficient and virtually unlimited storage for clients. 

A step up from IAAS is PAAS - Platform as a Service. In such an implementation, the cloud provider offers virtual hardware, an operating system, database, web server and programming language execution environment. Examples include Amazon Elastic Beanstalk, Google App Engine and Microsoft Azure. This provides a purchase-and-go solution for business to get up and running quickly and without large up-front investment.

The final tier is SAAS - Software as a Service. In this model, the business need not worry about the installation and maintenance of the software platform - an account is purchased and operations can start immediately. Indeed, many applications are now moving to the cloud, including the ubiquitous Google Apps, Quickbooks and Salesforce.com.

Of course, these cloud services must be accessed by the client - and there is no shortage here. Desktop computers and laptops running any operating system, tablets and smartphones can access most cloud services.

The cloud is offered as a public service, hosted on public service providers as intended to be delivered to the masses - but this is not the only way to provide the cloud. Indeed, private clouds are gaining increasing prominence, with organisations setting up clouds for their private business with increased security and control.

Compared to Local Computing
Of course, as with anything, cloud computing is not a panacea. Several issues exist which may put into question the idea of hedging one’s computing infrastructure on a cloud provider. Several large-scale security exploits such as the PlayStation Network hack and more recently the account compromise of both LinkedIN and last.fm may scare many off -and this is indeed a legitimate reservation.

Another issue is abuse. Hackers can use the large availability of computing power to launch attacks, such as a banking trojan used in 2009 via AWS to launch attacks on PCs infected by malware.

These and other issues may be enough to keep the old hat systems engineer with their computing resources in-house. However, there is no reason why a business facing these legitimate concerns cannot implement a private cloud, avoiding many of the issues surrounding public clouds.
a blog post about...
0
Social Media - a phrase with many definitions - is frequently used to describe websites and web applications where the majority of content is not created by publishers, but rather by the consumers/subscribers of the social media platform. There are several social media sites and apps out there, and we shall be taking a brief look at the major contenders.

History
Social Media Infographic -
courtesy of Citizen Brando
Many seem to think that social media is a relatively new concept and that social media websites have been around since sites like MySpace and Friendster were launched. However, the truth is far from so. The first network which could be called 'social' was CompuServe, launched in the 1960s. CompuServe was both an ISP and community of online users, which at the time was a novelty. The 70s saw the rise of Bulletin Board Systems or BBS. With these systems, user would use their dial-up modems to dial-in to a BBS server, where they could then download information and share with other users. As Internet use increased and e-mail was more available and standardized, e-mail groups such as Usenet gained popularity with a wide range of topics available for discussion via e-mail lists.

The early 90s saw the rise in user-created websites thanks to free web hosting services such as GeoCities. Throughout this time, AOL (America Online) launched in the U.S. providing Internet access to the masses. In 1996, ICQ was launched being the first major instant messaging network, a core part of modern social networks. The late 90s saw the popularity of user-created content sore thanks to weblogs, now known as blogs. Blogging services such as LiveJournal launched and people soon started realizing that comments on blogs were as popular, if not more popular, than the blog posts themselves.

In 2002, the closest thing to what we now call a social network launched - Friendster. Much like Facebook, Friendster gave each user a profile page and enabled users to share photos and messages between them, as well as chat. Popularity of social networks greatly increased in 2003 with the launch of MySpace and LinkedIN, as well as Hi5. Whilst MySpace and Hi5 were targeted at home users, LinkedIN was targeted at business users where people can share their professional profile away from the 'drab' that is MySpace and Hi5. 2004 saw the launch of the king of social networks - Facebook, as well as other sites like photo-sharing site Flickr, video-sharing site Vimeo and website/news story sharing site Digg. 2005 consolidated the strength of social networking with the launch of vibrant communities like reddit and YouTube. In 2006, novel social networking site Twitter was launched, featuring status updates limited to 140 characters.

In the past couple of years, more and more social networks such as Yammer, Foursquare, Chatroulette and Google+ have led to the web being dominated by these social network experiences.

Social Media in 2012
Social Media Leaders 2012
Social networks have a habit of either never catching on or catching on for a while and then fizzling out. However, some of the biggest players seem like there are here to stay, at least for now. The undisputed king remains Facebook, with an estimated 850 million members and $3.7 billion in revenue. Battling for second place are Twitter with 300 million users (and $145 million revenue) and Tagged with 330 million users, but only $45 million revenue. A fast rising contender is Google+, launched in June 2011 already has 250 million users as of June 2012. LinkedIN remains a popular social network and the no. 1 for a professional social network; it has 150 million subscribers and revenue of $522 million.

With the increasing popularity of mobile devices, new social networks are starting to form. One of which is Foursquare, which is a geocentric social network allowing users to "check-in" to places they are and share their location with friends. Similar on-the-go social networks include Instagram (recently acquired by Facebook), which helps users to share photos they take with their phone as well as adding special (mostly retro) effects.

Another category of social networks gaining popularity are product and special-offer based networks. These include Groupon, which offers deals to consumers from local retailers as well as Pinterest which is an online pinboard of goods and services which the web community finds useful or worth sharing.

For students
Students and the younger generation find social networks an absolute necessity. Most classes now have a Facebook group - something which used to be created on a mailing list, for example Google Groups. The Facebook group contains all the materials needed by the students, and posts from both teachers and students regarding their subject and other topics of interest. Of course, there is less control within Facebook and other social networks over what actually gets posted in the group, however this does not seem to phase users, who prefer the convenience of having the group as part of the same site which they visit several times a day.

For Business
Business and industry is also seeing the importance of having a presence on a social network, just as it is important to have a website. Besides advertising their product using dedicated advertising offered by many social networks, businesses use social networks to build a community of people who like and use their products. Through this, they can spread their message across to potential clients. Businesses frequently run competitions, special offers and promotions through their social network presence which drums-up business.

One of the greatest advantages for advertising on a social network is extremely targeted advertising. Rather than targeting by keyword, business can target by age group, gender, preferences, country, rising key words and much, much more. Resulting in the advert being seen only by people who are actually interested. Several social networks such as Facebook offer a wide variety of payment options, both for businesses wanting to advertise and for in-network payments. For example, businesses can choose to Pay-Per-Advert (PPA) or Pay-Per-Click (PPC). Additionally, networks such as Facebook have implemented a currency - Facebook credits. These can be used by users to purchase items from Facebook, buy virtual goods and much more.

Figure - Coca-Cola Facebook Page

For Gaming
Social networks are also a popular bed for games. Popular games such as Farmville, Mafia Wars and others attract millions of users via in-network adverts. The game also leverages the social network by giving players points/credits/items for sharing the game with others on the network. This makes the game go 'viral' a term used when a game/video/image etc… on a social network gains incredible popularity in a short time.

Figure - Farmville on Facebook

For News
News websites also use social networks. For a long time, news sites have had "share", "like", "+1" and other social buttons on articles which encourage users to share what they are reading on their social network. Recently a new trend is for a user to be able to post a link to what they are reading on a social network. When the link is clicked, the user is directed to a login page before they can view the content, adding to the network of the news website.

For Buying/Selling
Social networks are a great place to buy and sell items thanks to in-network applications such as Facebook marketplace. Users can post items for sale and then share with their friends, who in turn can share with others. This 'viral' effect will mean the product you have for sale is viewed by a potential of thousands of viewers.

Issues
Of course, social network is not a panacea. The major concerns on such networks are those of privacy, particularly where location is concerned. Recently, site pleaserobme.com highlighted the range of telling the general public where you are, by allowing visitors to search for Twitter usernames and then telling the user where the username has last checked in, whether they are on holiday and how long they intend to stay.

Other issues involve those of friend circles. Whereas posting a photo of yourself in a less-than-sober state is fine with your friends, it could be an issue with employers or, worse-still, potential employers. Several court cases have been raised by persons who feel their social network account was unfairly used against them as grounds for being laid off or not given an interview.

Social networks also have a habit of being annoying. Until recently, every like, message and post one would get on Facebook would result in an e-mail being sent to the user's inbox, flooding the user. However, new privacy settings means e-mail received from Facebook is greatly reduced, as the user is expected to visit the site if they want to check their updates.

Steps have also been taken regarding the privacy issue. Networks like Google+ were built from the ground-up with privacy in mind by introducing the concept of "circles", which let a user specify who in their life should be able to see posts. Facebook has implemented a similar features using groups.

Perhaps the greatest problem of social networks is that of them being a time waster. There is not much the networks can do about that - they more time you spend using them the more revenue they make. It comes from the individual to regulate the time the spend online and remember that there is a real world out there full of opportunity.

a blog post about...

Wednesday 4 July 2012

0
The Experience

A video was compiled to show all the features created working all together on Second Life.



Future Enhancements

There are several ways how this idea could be enhanced to portray the Institute's presence on Second Life at all times.

Improvements related to Design
  • The six course sheets present on the shelves should be skinned according to each course offered.
  • The kiosk would be attended by an ICE Malta receptionist - to be able to help people even on Second Life.
  • The user interface for the method used to communicate in-world would be greatly improved using a form integrated into the ICE Malta intranet.
  • Land should be bought for a proper Second Life presence. In this case, the current operational building could be designed on Second Life in order to portray the environment of the school without having to actually visit or viewing pictures.
Improvements related to Added Functionality
  • Another possibility would be to integrate Second Life with a 'canned-replies' robot, providing answers to frequently asked questions as well as suggesting study paths to students given their target and knowledge.
  • Further still, the Facebook integration could be improved to allow avatars to post statuses and update their Timeline from within Second Life without having to load the Facebook web page externally.
  • Sample lessons can be given in an ICE Malta 'auditorium' featuring recorded lessons or scheduled live lessons.
Conclusion


Despite all the room for improvement, the ICE Malta kiosk designed and developed for this coursework is a very good start towards the company's Second Life presence. In real-life, showing students the whole environment and explaining the whole student experience makes it a whole lot more interesting than reading the default paragraphs highlighting the positive aspects of a company. However, creating a real-world identical environment (building, demo lectures, group talks ecc..) on a virtual platform is beyond doubt a step ahead to reach users at any time, from any place. For this particular reason, the management at ICE Malta are considering actual use of this project.
a blog post about...
0
As the last feature of the ICE Malta Second Life Kiosk, some Facebook integration was added. As the user is exiting the kiosk, a message is displayed.



When clicking OK, the user is redirected to Facebook where they can post a message on their timeline, or on the timeline of another user.


Once posted, a link is displayed on the user's timeline.


Clicking on the link will take the user to the Second Life maps page, where they can also teleport to the location of the kiosk.


The message is displayed when the user leaves the kiosk. This is done by detecting the Volume of the avatar on the base prim.

default{
    state_entry(){
        llVolumeDetect(TRUE); // Starts llVolumeDetect
    }
    collision_start(integer total_number){
            llSay(0, "Welcome to ICE Malta on Second Life!");
    }
    collision_end(integer total_number){
            llLoadURL(llDetectedKey(0), "Share your experience at ICE Malta on Second Life with your friends on Facebook!", "http://www.facebook.com/sharer/sharer.php?u=http://goo.gl/q8o8U");
    }
}

When the the "collision" with the prim ends, a URL is loaded which links to the Facebook share API.

a blog post about...
0
For this last installment in my blogs on Second Life, I will build two objects supporting outside-world communication. One will allow communication from the outside world into Second Life, and the other will allow Second Life to send data to the outside world. 

Communicating Inwards

For the icemalta.com area, it was decided to create an "Announcer" object. This object would receive data from the outside world and shout it within the icemalta area. This could be used to send general messages to the people in the icemalta area - use like a PA system in a department store.

First, a cube was created. This cube would eventually be sculpted to be shaped like a loud speaker. Then, the following LSL script was attached.

default{
    state_entry(){
        // Request URL
        llRequestURL();
    }
    http_request(key id, string method, string body){
        if (method == URL_REQUEST_GRANTED){
            llOwnerSay("My URL: " + body);
        }
        else if (method == URL_REQUEST_DENIED){
            llSay(0, "Something went wrong, no url. " + body);
        }
        else if (method == "GET"){
            // Get [GET] vars from header
            string get = llGetHTTPHeader(id, "x-query-string");

            // Split
            list get_parsed = llParseString2List(get, ["&"], [""]);
            integer i;
            integer pos = llGetListLength(get_parsed);
            llOwnerSay("\News From ICE:");           
                        
            for(i = 0; i < pos;i++){
                string str = (llList2String(get_parsed, i));
                string parsed =  llDumpList2String(llParseStringKeepNulls((str = "") + str, ["%20"], []), " ");
                llShout(0, parsed);
            }
            //Response (what you see in your browser)
            llHTTPResponse(id,200,"Message Sent to SL");
        } else{
            llHTTPResponse(id,405,"Unsupported Method");
        }
    }
}
When the object is created, it will say its SLURL to the owner.



The SLURL is the in-game URL of the object within Second Life. Every object within Second Life has its own URL, which can be used to communicate with the object. A user will then use this URL to send a message to Second Life. In this case, a GET parameter is being added directly to the URL in a browser, however this could easily be made to respond to a form - for example integrated into the icemalta intranet. 


When the URL is requested, the GET parameters are sent to the object. The object will loop through the parameters received and shout them within the area. Since web browsers convert spaces to the %20 key code, a function was used to replace these with spaces. 





Communicating Outwards 


Conversely, this next object allows Second Life to send data to the outside world. A service bell object is placed within the icemalta area. When the user touches the bell, a database record is created within the icemalta MySQL database which adds the username of the user requesting attention and the time the message was requested. A timer can then be implemented via AJAX which notifies ICE employees of incoming requests. The following LSL was attached to the attention bell.

integer SECRET_NUMBER={Hidden from blog};
string SECRET_STRING="{hidden from blog}"; 
key http_request_id;

xrequest(string url, list l){
    integer i;
    string body;
    integer len=llGetListLength(l) & 0xFFFE; // make it even
    for (i=0;i<len;i+=2){
        string varname=llList2String(l,i);
        string varvalue=llList2String(l,i + 1);
        if (i>0) body+="&";
        body+=llEscapeURL(varname)+"="+llEscapeURL(varvalue);
    }
    string hash=llMD5String(body+llEscapeURL(SECRET_STRING),SECRET_NUMBER);
    http_request_id = llHTTPRequest(url+"?hash="+hash,[HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],body);
}

default{
    state_entry(){
        llSay(0, "Hi there! Press me for attention!");
    }
    touch_start(integer total_number){
        string name = llGetDisplayName(llDetectedKey(0));
        llSay(0, "Thank you " + name + " someone will be with you shortly!");
        xrequest("http://www.icemalta.com/slnotify.php",["sluser",name]);
    }
}
When the bell is touched, the player is notified that someone will shortly be with them. The name of the player is then sent as a parameter to the xrequest() function. This function will encode the username within a URL and make a request - in this case to icemalta.com/slnotify.php. To ensure the request is verified, a secret number and secret string (hidden from this blog) are needed. If these are incorrect or empty, the server-side PHP script ignores request.


<?php
  // this function tweak slightly urlencode to make it behave exactly like llEscapeURL in Second Life.
  function llEscapeURL($s){
    $s=str_replace(
      array(" ","+","-",".","_"),
      array("%20","%20","%2D","%2E","%5F"),
      urlencode($s));
    return $s;
  } 

  // this my main SL page XML-RPC page
  function checkHash(){
    global $body;
    $hash=$_GET["hash"];
    $body="";
    $cpt=0;
    $SECRET_NUMBER={hidden from blog};
    $SECRET_STRING={hidden from blog};

    foreach ($_POST as $name => $value) {
      if ($cpt++>0) $body.="&";
      if (get_magic_quotes_gpc()) {
        $value = stripslashes($value);
        $_POST[$name]=$value;
      }
      $body.=llEscapeURL($name)."=".llEscapeURL($value);
    }
    $calcHash=md5($body.$SECRET_STRING.':'.$SECRET_NUMBER);
    if ($hash!=$calcHash){
      sleep(2); // slow down the requests
      echo "result=FAIL\nMSG=Invalid request.";
      die;
    }
  }

  checkHash();
$pdo = new PDO(
    '{connection string hidden from blog}'
);

$qry = "INSERT INTO notifications (sluser) VALUES (\"" . $_POST['sluser']  . "\")";$pdo->query($qry);
mail('{hidden from blog}', 'E-mail from SL', $_POST['sluser']);
echo "OK";
?>

In the code above, the secret number and secret string will be checked. Then, the values received will be placed inside the $_POST[] PHP super global array. A connection to the database is then established using PHP Data Objects (PHP) and the data is posted into the database. Additionally, an e-mail is sent notifying the user of a new request. Perhaps in later versions this couch due changed to an instant message or a text message.


The notifications, as seen above, are then added to a MySQL database. A simple PHP script is then used to retrieve the list of pending notifications.

<?php
$pdo = new PDO(
    '{connection string hidden from blog}'
   $qry = "SELECT * FROM notifications ORDER BY ntime DESC";
   $result = $pdo->query($qry);
   while ($res = $result->fetch()) {
      echo $res['sluser'] . " at " . $res['ntime'];
   }
?>

In future releases, this can be integrated into the icemalta intranet including better graphics, direct links to the user location within Second Life, expiry and so on.
a blog post about...

Friday 29 June 2012

0
For this task, the kiosk being built into the previous tasks is given a visual overhaul. A set of two kiosks were created, along with other items, to create a virtual presence for icemalta.com.



The new area incorporates all the aspects of the previous stages including the stool, the kiosk, e-mail sender, notecard giver and more. Clicking on the leaflets in the shelf will give the user a note card.



The post box functionality is still present.



The camera angle of the stool has been tweaked to make the user look directly at the kiosk screen when they site on it.



The image above shows that the kiosk is in fact displaying the icemalta.com website. This site can be interacted with inside the game just as if the user was browsing the website in a normal browser.



The user can then click the "stand" button to go back to normal view. Showing the website is a matter of using a script to load the appropriate content onto the appropriate face of an object.

show(string html){
    llSetPrimMediaParams(2,                  // Side to display the media on.
            [PRIM_MEDIA_AUTO_PLAY,TRUE,      // Show this page immediately
             PRIM_MEDIA_CURRENT_URL,html,    // The url if they hit 'home'
             PRIM_MEDIA_HOME_URL,html,       // The url currently showing
             PRIM_MEDIA_HEIGHT_PIXELS,1024,   // Height/width of media texture
             PRIM_MEDIA_WIDTH_PIXELS,2000]);  //   rounded up to nearest power of 2.
}

string build_url(){
    return "data:text/html,
    <html>
    <head>
          <title>ICE Malta</title>
    </head>
    <body>
          <iframe align=\"center\" width=\"2000px\" height=\"100%\" frame-border=\"0\" src=\"http://www.icemalta.com\"></iframe>
    </body>
    </html>";
}

default{
    state_entry(){
        show(build_url());
    }
}

Here we see that the script is set to display the page on side "2" of the prim (i.e. the screen of the kiosk). We also specify the height and width of the displayed item. Finally, we use the build_url() function to build the content of the site. In this case we are loading an iframe into the body of the displayed content which will display the icemalta.com page. Whilst browsing the site, the user can also detach the view from the kiosk and browse the site in a normal browser - this is handled automatically by Second Life.
a blog post about...

Wednesday 27 June 2012

0
Note cards are to Second Life what postcards are to the real world. Note cards are used to describe a location within section life including an in-world URL which can be used to teleport to locations within the Second Life universe. Note cards can contain many other things. Players can attach objects to notecards and give them to each other. Notecards can also have embedded text, video and audio - making them very versatile. 

In this section, a notecard giver will be created. For now, the functionality will be implemented as a second button on the virtual kiosk.



When the player touches the button, a notification will be displayed asking the user whether to accept the note card which has been given.



If the player accepts the note card, it will be added to their inventory and immediately displayed.



In this sample note card, the player is greeted with some text and then given a copy of the kiosk we are working on. The user can then add the kiosk to their inventory.

To achieve this, two items are required. First, a note card has to be created and added to the inventory of the button. To do this, go to your inventory, right-click on "Calling Cards" and select "New note card". After naming the note, double-click on it to start typing text.



To add an object to the note, simply find it in your inventory and drag it inside the note. The item dragged in the note must have the unrestricted "next owner" permission, or it may not be owned by other players. To set this permission, right-click the item you want to attach in the inventory and grant all permissions to the next owner group.



Once this is done, the object can be transferred to the note card. With the note card created, it must now be dragged into the inventory of the button. Right-click the button and select "build", then go to the contents tab. Drag the note card from your inventory to the contents area.



The last piece of the puzzle is to create a script which gives the notecard to the user when the object is touched.

default {
    touch_start(integer total_number) {
        llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
    }
}

As can be seen, the script is very simply. The llGetInventoryName function is used to get the name of the first item (number 0) matching the INVENTORY_NOTECARD description within the object inventory. This item is then given to the owner by using the llGiveInventory function, which additionally needs the name of the player the item is going to be given to, which can be obtained using the function llDetectedKey(0). All the rest is handled automatically by Second Life.

Expanding the concept: A post box

Expanding on the concept above, a post box was built. This allows players to store notecards in an item and then retrieve them at a later date. First, a post box-like shape was added to the side of the kiosk.



When the user right-clicks the post box, they can select "open". This will show the user the inventory of the post box - but will only show items owned by the user.



Once opened, items can be dragged to the post box, in this case, "My New Note".



At a later date, when the post box is clicked, the user's items are returned.





The code for the post box is shown below.

default{
    state_entry(){
         llAllowInventoryDrop(TRUE);
    }
    touch_start(integer total_number){
        llOwnerSay("Giving you your items...");
        key owner = llGetOwner();    

        integer i=0;
        if (llDetectedKey(0) == owner) {
            for (i=0; i<llGetInventoryNumber(INVENTORY_NOTECARD); i++) {
                llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_NOTECARD, i));
            }
        }
    }
}

When the post box is initialized, the llAllowInventoryDrop function is used to allow the player to drop items in the inventory of the post box. When the post box is touched (touch_start()) A loop is used which goes through every note card in the inventory. Each note card's owner is checked, and if the owner of the card matches with the current player, the item is offered to the player.
a blog post about...
0
In this section, an object will be built which responds to user commands. For this simple example, we shall start building a kiosk. The stool created previously will be placed in front of a terminal resembling an arcade machine. For the purposes of this test, a large button will then be placed on the kiosk which sends an email when it is touched. 

The kiosk was built by placing a prism prim onto an elongated cube prim. The button was then created by placing a smaller cube on top of the larger one.



The action desired is for the "button" to send an e-mail when it is touched. Using LSL, the user will be asked for the e-mail address to use to send the e-mail. An e-mail will then be sent.



All interaction with the user happens via the chat window. To accomplish this task, the following LSL script was added to the button.


integer listen_handle;

default{
    state_entry(){   
        listen_handle = llListen(0, "", llGetOwner(), "");
    }
    touch_start(integer num_detected){
        llOwnerSay("Please type in an e-mail address");
    }
    listen( integer channel, string name, key id, string message ){  
        llOwnerSay("An e-mail has been sent to " + message);
        llEmail( message, "E-mail from Kiosk", "Hi there!");
        llListenRemove(listen_handle);
    }
    on_rez(integer param){   
        llResetScript();
    }
    changed(integer mask){   
        if(mask & CHANGED_OWNER){
            llResetScript();
        }
    }
}
When the user touches the button, a message is sent to the owner (i.e. the user touching the button) instructing them to type in their e-mail address. In the state_entry() state (the initial state of the button) a listener is registered which will "listen" for text which the user will type in the chat window. When text is typed, an e-mail will be sent to the address typed in by the user. This is done using the llEmail function. The user is also informed that the message has been sent. When received, the message is as follows:


As can be seen, the message "Hi there!" which is specified in the script is received in the main content. Second Life also sends via e-mail the name of the object, the region where the object resides and the current local position. When the e-mail has been sent the script resets itself and is hence ready to send another e-mail. The script is also reset if another user touches the button - creating separate instances for all the users currently using the object. This makes it possible for several players to be using the object concurrently. To create the script, the "New Script" button was used from the content pane of the build window. This brings up a code editor where script can be typed. The script is compiled on saving, and any syntax errors are displayed in the window.


The editor features code coloring, but no completion or in-line debugging. Luckily, the Second Life wiki (Link) as well as Internet searches provide a wealth of documentation regarding the functions of LSL, as well as ready-made code to use freely or to purchase. The Second Life marketplace (Link) is the primary store for all things Second Life, including objects, clothing and scripts.

a blog post about...

Saturday 23 June 2012

0
Describing Second Life is not an easy task. Some call it a virtual world, others call it a game, whereas others call it an interactive building environment. The truth is that Second Life is all of this, an economy, a social experience and much more. 

In this section, I shall build a basic object in Second Life which the user can sit on - a stool.

The first step in building is to find a sandbox. In Second Life, land is owned by players, consequently items cannot be built on other player's land. However, several public sandboxes exist, where players can practice building their items without having to purchase land.

To build the stool, I chose the St. Leo University Public Sandbox found at - Link. The first step is to right-click on the terrain and enter build mode. This brings up the build dialog where players can create their objects. Objects are created using a number of basic shapes known as "prims" (short for primitives). The prims are dragged onto the landscape and rotated, shized, shaped and combined together to create an item.



To create the stool, two cylinder prims were used. First, a long, thin cylinder was used as the stool's base, and then a flat short cylinder was placed on top to create the seat of the stool.



Once an object is created, textures can be applied to each face of the stool.



This is done by using the "Select Face" mode of the build tool, and then selecting a texture from texture tab. Once the textures are applied, the two cylinders making up the stool have to be combined to form one object. To do this, both prims are selected and the "link" button is used.



With the object created, the primary test was next - sitting on the stool. When an object is created, Second Life automatically makes the top face of the object an area which the player can sit on. Hence, right-clicking and selecting sit makes the player sit on the face.



Taking it Further - Changing the Camera View

For this task, it was also decided to change the camera view of the player when the player is sitting. This is accomplished using LSL - Linden Scripting Language. LSL scripts can be attached to object which control what happens in response to a number of triggers such as a player approaching an object, sitting on an object, touching an object, taking an object etc…


default{
    state_entry(){
        llSitTarget(<0.2,0.0,0.45>, ZERO_ROTATION );
    }
}

As can be seen from the script above, the camera angle is set when the user sits. Additionally, a target for sitting is defined using the LSL function llSitTarget, which specifies the rotation, elevation and depth of the player when sitting on the stool. This script will make the player face the same direction when sitting, no matter how the stool is placed or which angle the stool is approached from.

Taking it Further - Adjusting Height


To make the stool more realistic, it was decided to add a functionality to adjust the height according to the avatar's preference. To accomplish this function, a script was written to adjust the Z Position of the stool which would result in either increasing or decreasing it's height. The core part of the written script is shown below.

            else if (message == "Size--"){
                    vector currentPosition = llGetPos();
                    if (currentPosition.z > 24.180){
                        vector scaledPosition = <currentPosition.x,currentPosition.y,currentPosition.z-0.2>;
                        setPosition(scaledPosition);
                    } else {
                        setPosition(currentPosition);
                         llOwnerSay("Minimum Height Reached.");
                    }
            }
            else if (message == "Size++")
            {
                    vector currentPosition = llGetPos();
                    if (currentPosition.z < 24.640){
                        vector scaledPosition = <currentPosition.x,currentPosition.y,currentPosition.z+0.2>;
                        setPosition(scaledPosition);
                    } else {
                        setPosition(currentPosition);
                         llOwnerSay("Maximum Height Reached.");
                    }
            }

As can be seen above, the script is first requesting the current Z Position of the stool. Once that is obtained, a decision is made to check whether the prim has gone above a set maximum or minimum height. If this decision results to be true, then an output message is displayed to the user informing him that the maximum/minimum height have been reached. Otherwise, the stool is seen changing height in 0.2 (meter) increments.
a blog post about...