LSL: AOL IM Status Indicator

I think this might be my very first LSL script, from back in 2005! This script indicates whether your AIM (AOL Instant Messenger) account is online by changing the color of an object. You can configure it to either share your AIM ID publicly, or keep it private.

AIM Indicators in Second LIfe

AIM Indicators in Second LIfe

This script uses the AIM web services API to check your online status — you only need to give it your username, not your password! This is not a proxy service. You can’t send messages through this script, just show your online status in SL.

To use this script, create an object in your favorite shape, create a new script inside of it, paste this code into it and save.

key request_id;
string aim_id;
string av_name;
key data_card;
integer nLine = 0;
integer public = TRUE;

default
{
    state_entry()
    {
        llSetText("AIM Indicator... setting up",<1,1,1>,1);
        data_card = llGetNotecardLine("Settings",nLine); // load settings
        llSetTimerEvent(60); // check once per min
    }
    
    // reset when owner touches it
    touch_start(integer total_number) {
        if (llDetectedKey(0) == llGetOwner()) {
            llResetScript();
        }
    }
    
    // read settings from notecard
    dataserver(key query_id, string data) {
        if (query_id == data_card) {
            if (data != EOF) { // not at the end of the notecard
                if (nLine == 0) {
                    av_name = data;
                } if (nLine == 1) {
                    aim_id = data;
                } if (nLine == 2) {
                    if (data == "private") { // if they do not want their ID shared
                        public = FALSE;
                    }
                }
                ++nLine; // increase line count
                data_card = llGetNotecardLine("Settings", nLine); // request next line
            }
        }
    }
    
    timer() {
        string url = "http://api.oscar.aol.com/SOA/key=hi15uD79wuEukQTS/resource-lists/users/*anonymous*/presence/~~/resource-lists/list%5Bname=%22users%22%5D/entry%5B@uri=%22user:"+aim_id+"%22%5D";
        request_id = llHTTPRequest(url,[HTTP_METHOD, "GET"],"");
    }
    
    http_response(key req_id, integer status, list metadata, string body) {
        if (req_id == request_id) {
            list result = llParseString2List(body,["<",">","n"],[]);

            // if user is online
            if (llList2String(result,24) != "http://cdn.digitalcity.com/presence/offline.gif") {
                if (public == FALSE) { 
                    llSetText(av_name+"'s AIM account is online",<1,1,1>,1);
                } else {
                    llSetText("AIM "+av_name+": "+aim_id+" is online",<1,1,1>,1);
                }
                llSetColor(llVecNorm(<160,237,160>),ALL_SIDES);
            } else { // user is offline
                llSetText(av_name+"'s AIM account is offline",<1,1,1>,1);
                llSetColor(llVecNorm(<237,160,160>),ALL_SIDES);
            }
        }
    }
}

This script is released under Creative Commons License. Have fun!

Create a notecard called “Settings” with your avatar name on the first line* and your AIM username on the second line. If you do not want your AIM username shared, put the word “private” on the third line. If you do want it shared, change the line to anything else (“public”, or even blank will do). For example:

Ann Enigma
hilm1
private

The script polls the AIM server every 60 seconds, so give it a minute to update. It will reset if the owner clicks on it.

* I’m aware that you can get the avatar name via LSL — this was my first script, be nice!


LSL: Newspaper Stand (Pull Data From an API and Display it in Second Life)

Second Life news stand

Second Life news stand

One of the more popular objects that I created in Second Life is the News Stand. This charming device takes any query term and displays the two latest headlines from Yahoo! News. Clicking the news stand will load the top news story for the topic in a web browser.

I’ve gotten more requests to customize the script than I can possibly keep up with, so I’ve decided to release the code under a creative commons license. I hope you find it useful! Please let me know if you make improvements, so that I can link to them from here.

Unfortunately, parsing XML at all and RSS feeds in particular is extremely messy in LSL. This script doesn’t contain a general RSS feed parser — the parsing code was written specifically for the Yahoo! news feed.

// News Stand script
// by Ann Enigma

string url="http://news.search.yahoo.com/news/rss?p=";
key requestid;
string current_url = "http://news.yahoo.com";
integer gLine = 0;
key data_card; // for settings notecard
string query;

integer mins = 10; // number of minutes between refreshes

get_news() {
    llWhisper(0, "Refreshing the news...");
    requestid = llHTTPRequest(url,[HTTP_METHOD,"GET"],"");       
}

default
{
    state_entry()
    {
        data_card = llGetNotecardLine("Settings",gLine); // load settings from notecard
    }

    // read data from the notecard
    dataserver(key query_id, string data) {
        if (query_id == data_card) {
            if (data != EOF) {    // not at the end of the notecard
                if (gLine == 0) {
                    query = data;
                } 
            }
        }
        state setup;
    }
    changed(integer change) {
        llResetScript();
    }
}

state setup {
    state_entry()
    {
        url += llEscapeURL(query); // set the url
        get_news(); // get the news!
        llSetTimerEvent(60*mins); // every mins # of minutes
    }

    touch_start(integer total_number)
    {
       llLoadURL(llDetectedKey(0), "Current Top Story", current_url);
    }
    http_response(key req_id, integer status, list metadata, string body) {
        
        integer count = 0;
        string display;
        
        if (req_id == requestid) { // parse the results (unfortunately messy)
            list result = llParseString2List(body,["<",">","n","[","]"],[]);
            integer length = llGetListLength(result);
            integer i = 0;
            for (i = 0; i < length; i++) {
                if (llList2String(result,i) == "title" && llList2String(result,i+4) == "/title") {
                    display += llList2String(result,i+3) + "n";
                    if (count == 1) { 
                        current_url = llList2String(result,i+6);
                    }
                    count++;
                }
            }
            llSetText(display, <1,1,1>, 1.0);
        }
    }
    timer() {
        get_news();
    }
    changed(integer change) {
        llResetScript();
    }

}

This script is released under Creative Commons License. Have fun!

Create a notecard called “Settings”, with a single line containing your search term. For example:

Educational Technology

The original news stand comes with these instructions, which may come in handy:

To set up the News Stand, simply open the "Settings" notecard, delete the default search term, and type in your own!

This gadget will refresh every 10 minutes, and will display the top two headlines on Yahoo! News for any search term. If you click on the news stand, it will load the top story in a web browser.

If you would like to build your own news stand, you can simply drag the script and "Settings" notecard into any object.

If you want the no-assembly-required version, the News Stand is available for L$350 at Xstreet SL Marketplace or from the ICT Library on Info Island in-world.

The original news stand object was created by (now former) student Kyle Pouliot.


Welcome

Hello, and welcome to everyone who found this site via Torley’s story on the Second Life blog!

I lead the Immersive Media Lab at J&W University. Several of our projects have utilized Second Life, including Virtual Morocco (cultural exchange and tourism promotion for the country of Morocco) and SLMetrics (a study of behavior modeling in virtual environments).

This isn’t a Second Life blog, but you will find LSL scripts and other related ephemera around.

You can subscribe to the RSS feed for this site, or find out more about me at HilaryMason.com.


LSL: Notecard Selector

One of my friendly librarian colleagues in SL asked if I had a script to generate dialogs and allow users to select notecards handy. I didn’t, so I coded it up. It seems like it could be useful to others, so here you go:

This script is in LSL, for Second Life. Just copy and paste it into a script, throw a few notecards into the object, and you’ll be ready to go!

//  Notecard Selector
//  by Ann Enigma
//  This script presents users with a list of notecards in a dialog box, and allows them to select one
//  Note: The names of the notecards must be less than 24 characters long

// This script is licenced under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
// http://creativecommons.org/licenses/by-nc-sa/3.0/us/

// configurable options
string message = "Which notecard would you like to read?"; // the message on the dialog box
integer command_channel = 616; // the channel on which to listen for commands (you probably won't need to change this)

// the script
list notecards;

default
{
     state_entry() {
          integer i = 0;

          // read the title of each notecard into a list
          for(i=0;i
						

How to Control Second Life with a Wii-mote (on a Macbook Pro)

wii + SL = cool

My research group had some fun controlling SL with a Wii-mote a few weeks ago. It’s easier than you think! Several people have asked how we did it, so I hope these quick instructions might come in handy.

  1. Download, install, and run DarwiinRemote.
  2. Turn Bluetooth on on the Macbook. You can do this by opening the Bluetooth Preferences Pane (Apple menu, System Preferences and choose “Bluetooth” under Hardware) and clicking the big “Turn Bluetooth On” button. If Bluetooth is already on, you can skip this step!
  3. Hold the Wii-mote in front of the Macbook and press buttons 1 and 2 simultaneously. The LEDs on the Wii-mote will flash.
  4. As you move the Wii-mote, you’ll see your movement plotted on the screen, as you see below.
  5. Drop down the option box and choose “Mouse Mode On (Motion)”.
  6. Load up Second Life.
  7. Fly! By default, you can control the direction with the direction keys at the end of the Wii-mote.
  8. Laugh with glee, because this is cool.

darwiinmote


What’s wrong with this hat?

hat

The vendor containing this hat was recently deleted from Virtual Morocco by an employee of Linden Lab without any notification to me. Why? Because an anonymous person complained that it is “broadly offensive”.

Virtual Morocco was created to be both a tourism promotion platform and a space for cultural exchange. It was built entirely by undergraduate students as an educational service-learning project.

We give space in the Marrakesh Marketplace to several Moroccan artisans with virtual goods for sale. Our only requirements are that they keep everything appropriate to the sim’s theme and to the educational context of the space. The vendor selling the hat was owned by a college student (not from our institution) who specializes in items appropriate for the Morocco of the 1940s.

This hat does appear to be in the Nazi style. Even if it is, it is historically and thematically appropriate for Virtual Morocco.

Managing a space for cultural communication is not always an easy task. We have dealt with anti-Muslim intolerance, anti-American intolerance, and other forms of inappropriate behavior. When an incident occurs, I try to use it as a learning opportunity and prompt for discussion for my students and the members the our Virtual Moroccan community.

This incident has implications far beyond one college student and an ambiguously offensive hat. How can we create an academic space – a space for the free exchange of ideas – if our content can be deleted arbitrarily, by a third party?

I’m posting this now because my support request has gone unanswered for several weeks. I will post updates as the situation develops.


Teen Second Life College Fair

teen SL college fair

I was immensely privileged to participate in the first ever Teen Second Life College Fair. The event was on the Eye4You Alliance TSL island. At least 18 institutions were represented (see some of the booths in the image to the left), and approximately 200 teens attended.

I gave a short presentation on my own educational experiences and the incredible possibilities for careers in technology, but my favorite part of the college fair was the casual conversations that took place outside of the sessions and in the booth area. We talked about everything from education in Europe vs the US to tagging to SL building and scripting to politics… you get the idea!

For educators and recruiters, this was a fantastic event for connecting with young people who are excited, passionate, and resourceful. The students were able to talk directly with representatives of various institutions, and were not shy about asking difficult questions and getting the answers that they were interested in. I’m looking forward to the next one!

The event has been written up:


Autoscript Creates LSL Scripts Without Code

This week, I created autoscript, a simple LSL script generator for Second Life. The concept is to translate the way you think about interactive design – what should happen, and when – into functional code.

Scripting is one of the most creative parts of designing immersive spaces, and I hope this will make it accessible to more people. Please feel free to use this code however you like!

Writing a program like this requires a balance between simplicity and flexibility, and I’m erring on the side of the former. I do plan to add more functionality to it and would love your suggestions and ideas! Also, if you encounter anything that doesn’t work, please let me know in the comments here.

The link: autoscript


Second Life Community Convention

I just returned from the Second Life Community Convention in Chicago. I really appreciate all of the wonderful people that I had the chance to meet (or smeet) or just spend time with. There wasn’t nearly enough time for all of the conversations that I wanted to have!

There were a wide variety of presentations. We’ve come a long way since last year! The diversity of disciplines was astounding. I think the strongest work presented was in the sciences and medicine, and I was particularly impressed with the Second Health machinima.

Here are the slides from my presentation on Experiential Learning:

I’m hoping it inspires people to think about how we now have this capacity to create learning experiences that were simply never possible before. What do we do with it? How do we measure it?


Where the Sun Rises… in Second Life

WindLight 1

WindLight 1,
originally uploaded by Lex Zhaoying.

The Second Life Scripters mailing list just had a great discussion on the cycle of the sun and the seasons in Second Life. As very detail-oriented residents may have already determined, the sun and moon in SL do not follow the Earth’s natural course.

Scripter Extraordinaire Zyzzy Zarf (who doesn’t seem to have a web site, but if I’m wrong, please let me know in the comments!) provided some code obtained from a Linden that indicates that the sun moves in a circle around a tilted plane. The angle of the plane rotates around each year.

This results in a “good enough” simulation of how the sun and moon ought to behave. When we design virtual environments, do we really need accurate simulations of the sun and moon? Or is this “good enough” simulation good enough?

I’m also fascinated by the emergence of a class of SL Astronomers… studying the Second Life skies.