PASTE NAVIGATION MENU CODE

Friday 29 June 2012

Task 4: Displaying a Web Page

| | with 0 comments |
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.

Post a Comment

Please enter your comments here..

0 comments: