Wednesday, August 15, 2007

More Fun with Media

The release notes for the recent update to the Second Life client said, much to my delight, that streaming video was now available in the Linux client. Well, a number of us have had trouble getting it to work, even though we've got all the dependencies installed.

Someone posted, in one of the video troubleshooting threads, that he thought we were all trying to view videos with too high a bitrate, and suggested we go by his store to try out his TVs. In plugging them, he said that they:

can coexist with land media, this allows private landowners to still use their 'pay per view' media to run in their skyboxes and private theatres, without interferring with all their tennants at ground level having their own TV channels, even in the same parcel.
Well, this sounded interesting, especially given my video vendor project, so I dug into the LSL Wiki and saw an option for llParcelMediaCommandList() which I hadn't noticed before: PARCEL_MEDIA_COMMAND_AGENT.

When you pass this option in, followed by an avatar's UUID, it doesn't change the media settings for the parcel, like it normally would - it changes the settings just for the specified avatar.

So if you wanted someone to see a random video when he or she touches a prim, but not affect anyone else, you might do something like this:

key theVideoTexture = "12345678-9abc-def0-1234-56789abcdef0";
string VideoBaseUrl = "http://www.myserver.com/videos/";
list RandomVideos = [ "video1.mov", "video2.mov",
"video3.mov", "video4.mov" ];

PlayVideo( key theAvatar ) {
integer VideoCount = llGetListLength( RandomVideos );
integer theVideo = (integer) llFrand( VideoCount );
string VideoName = llList2String( RandomVideos, theVideo );  
llParcelMediaCommandList([
PARCEL_MEDIA_COMMAND_AGENT, theAvatar,
PARCEL_MEDIA_COMMAND_TEXTURE, theVideoTexture,
PARCEL_MEDIA_COMMAND_URL, VideoBaseUrl+VideoName,
PARCEL_MEDIA_COMMAND_LOOP
]);
}

default {

touch_start( integer numTouchers ) {
integer i;
for (i = 0; i < numTouchers; ++i) {
PlayVideo( llDetectedKey( i ));
}
}

}

Even though the object is affecting an avatar, and not the parcel, it still follows the parcel media permissions rules. If you don't own the land the object's on, the object must be deeded to the land's group - so it's a good idea to include some way for the object to delete itself when you want it to. The video texture should be the UUID of a texture on the prim that will be replaced by the video.

Yesterday, I wrote a video vendor kiosk, similar in operation to some of the JEVN vendors (a main static display button/pay receiver, four smaller buttons for changing the product on the main button, and Previous/Next buttons), with the addition of a large video screen which will show a movie of whatever product is on the main static display.

Because it uses the PARCEL_MEDIA_COMMAND_AGENT option, it works without affecting video for any other residents in the parcel, so it doesn't require the parcel to be subdivided to the shop or booth the vendor is in. :)

Configuration is via notecard, but with all the functionality I put into it, it quickly runs out of space - with only twelve products in the vendor (including landmark, vendor textures, info notecards, and sometimes multiple items per product), available script memory is down to less than 2K. I guess the next step would be a networked vendor which communicates with a Web server, rather than keeping the lists of product names, prices, descriptions, textures, video URLs, and so forth in the script memory.

Monday, August 13, 2007

Voice on Linux - partway there

Somebody on the Linux Client Users group mentioned a wrapper script to run the Windows voice client in WINE, providing limited functionality of the voice client under Linux. I found the script attached to an issue in JIRA, then downloaded the Windows client, extracted SLVoice.exe and the libraries it depends on, and copied them into my secondlife directory.

It works... kind of. It takes forever to get connected to voice, and it disconnects after a very short time - but I did manage to hear somebody say part of a sentence!

Sunday, August 5, 2007

HUD Fever

A couple of days ago, someone posted a comment on one of my entries, saying that she'd seen the emotion buttons running down the side of some of my screen shots, and asking what HUD lets me do it.

As a matter of fact, it's a HUD I wrote a few months ago (and which, quite coincidentally, I had put up for sale in my store only a couple of hours before she posted her comment). I love HUDs, and if you design them properly, they can actually be really simple. The example HUD I made for LSL205 (a jump assistance HUD, shown at the right, which lets you select from five different jump strengths) consisted of six prims, one texture, a main script of 19 lines (not including comments and blank lines), and a 28-line script that goes into each of the five buttons.

I've made quite a few HUDs, come to think of it. There's the class schedule HUD I blogged about a little while ago (which is actually pretty complex, admittedly); the aforementioned emotion HUD; a HUD I made for landscaping (I loathe the built-in "Edit Land" tool, I always end up making things look worse than when they started); a favorite-places teleporter HUD; a "PowerPoint" controller HUD...

Students seemed to have so much fun with the jump assist HUD that I'm planning to teach a workshop just on designing and making HUDs - the one in LSL205 was really only a demonstration of link messages, and I didn't really get into the planning, texturing or physical construction of the HUD.

Now I just need to decide what the example HUD for the workshop should do. Time to hit the LSL Wiki and look at function names until an idea germinates, I guess.

Saturday, August 4, 2007

Video Vendors

One of the problems I've found with trying to sell jewelry is that, especially for the finely-detailed pieces, a static image on a vendor doesn't really do it justice. You want to give the customer the ability to see it from all angles, and close up. Even worse - if you're selling a scripted object, how do you show it in action?

So today I wrote a simple "video vendor" system for my store - individual vendor boxes which, when touched, communicate with a video screen. The screen sets the parcel's video media URL, resets the texture repeat and offsets on the main face to match the video's dimensions (so that "Auto scale content" doesn't need to be enabled), and starts the video in looped mode.

Maybe one day I'll even get to see it in action. The 1.18.1(2) release of the viewer purportedly added streaming video support for Linux users, but many of us can't get it to work.

(Next, multi-vendors and networked vendors! Muah ha ha ha ha!)

Thursday, July 26, 2007

Shameless Vote Whoring

Now that the Mozilla library has been incorporated into the Second Life viewer, it strikes me that it might be possible for the non-working llSetPrimURL() and llRefreshPrimURL() functions — which were intended to display a Web page on a prim, but which (to my knowledge) have never actually worked — could be made to trigger a client-side retrieval of the specified Web page, which would then be rendered to a (local) texture and displayed on the prim, in much the same way that media textures are.

And since the page retrieval would be done client-side, it wouldn't cause any appreciable lag on the Second Life servers.

I've created a JIRA feature request about this. If you think it would be nifty too, please vote for it! Tell your friends! Tell all your alts!

Wednesday, July 25, 2007

Why was I not told this?

You can put a script into a prim without having it automatically start running, by holding down the CTRL key as you drag it from your inventory.

Monday, July 23, 2007

Yet More Schedule Stuff

In between working on classes (I'm up to five now; the latest one will debut Thursday evening, and will cover dialogs, link messages, HTTP and XML-RPC communication), I've been back at work on more schedule stuff.

My latest device is a HUD for students, showing the next five classes scheduled to be taught at Rockcliffe:


Unfortunately, for the text to be readable, it does have to take up a hefty amount of screen space, so the Rockcliffe logo serves as a minimize/restore button:


Features include:

  • "Class Info" buttons cause it to tell its owner more information about the selected class (full class name, date and time, teacher's name, location, duration, etc.)
  • "Teleport!" buttons bring up the Map screen, with the classroom location selected
  • The green "?" button delivers a notecard with usage information
  • The "Preferences" button brings up a dialog with several options:
    • Alarms On - causes the HUD to play a sound and pop up a dialog indicating that one or more classes will be starting in ten to fifteen minutes (and identifying which classes)
    • Alarms Off - suppresses the class notification
    • TP to RUSLC - brings up the Map screen, with Rockcliffe's reception area selected
    • RU Website - Loads the Rockcliffe University Web site into the user's browser
    • Schedule - Loads the Rockcliffe class schedule into the user's browser
But the stuff that was the most fun to do is all behind the scenes:
  • Checks the schedule about once every five minutes
  • If a new version is released, the HUD is automatically updated the next time the user visits the Rockcliffe sim
  • All the hardcoded URLs (the location the script the HUD communicates with to download the schedule, the Rockcliffe Web site, and the schedule Web page) can be changed by the server-side script without requiring a full update, in case of a site move, page relocation, etc.
  • When downloading the schedule, it passes version information to the server-side script, so that new features may be implemented without breaking older versions of the HUD
One of these days, I will actually finish building my house and make more jewelry...

Monday, June 25, 2007

Fun fun fun!

In between business trips and sickness, I've had precious little SL time lately. And what time I've had has been spent on Rockcliffe University.

First, I've been developing and teaching classes in scripting (three have been completed, and I'm nearly done with the fourth). It's shocking how much time it takes to come up with one class; even though I've already got the first twelve classes outlined, there's lecture text to write (and proofread, and verify to make sure every sentence is accurate), examples to script and test, "Powerpoint" slides to create. And then go through the lecture a couple of times and try to anticipate students' questions, then rework the text to preemptively answer them...

But since I can't really play in Second Life while I'm on a trip (I tried once, and my laptop overheated and killed the master boot record of the hard drive, so I won't be doing that again!), I've been working on the class scheduling application, which has been a lot of fun to do.



We're getting a dedicated server set up, which will run a whole bunch of off-the-shelf software (Moodle, forums, etc.), but I developed a customized scheduling database in MySQL, with a PHP frontend. This will display the upcoming schedule in several formats (the simple list as shown here, a calendar view, an RSS feed, etc.), and permits the teachers to post and modify their own classes. But where it really shines is in its communication with Second Life.



First, it automatically updates an in-world schedule board. Classes will disappear from the board fifteen minutes after they've started, and as new classes are added to the database, they appear on the schedule board. Unless explicitly overridden, each class displays in an alternating color to make it easier to read the board. After a week or so of testing, I'll be able to replace the current version in the reception area with the new auto-update board. Another improvement is in primmage: the new board has 33% more characters (80x24, as opposed to 72x20), while still reducing the number of prims by about 20%.

Another component which I'm working on now is a smaller board which displays the names of the classes currently in progress, with a "Teleport!" button to take a student directly to the classroom. Other components will include classroom detectors which send the list of students to the database, to keep track of attendance; and tip jars which record the amounts given during a specific class (for sharing the tips between the university and the individual teachers).

All this is accomplished with the HTTP and XML-RPC functions of the Linden Scripting Language (which will be the subject of one of the classes in my scripting course).

Maybe one of these days, I'll have enough free time to actually build a house on the land I'm renting!

Wednesday, June 13, 2007

Hate Voice?

Switch to Linux!

Not only is there no Linux voice-enabled client, but the Lindens steadfastly ignore anyone who comments on the official blog to ask about when we'll get one.

Thursday, May 24, 2007

...Sculpted jewelry!

A really simple set to start out with, while I design more complex things.


The necklace and the earrings, following my tradition, are scripted so the gem and metal colors can be independently changed. The sculpted heart has my usual nine colors: amethyst, blue topaz, citrine, diamond, emerald, garnet, ruby, sapphire and topaz.


And I finally have a better store location, on Flotsam Beach. Part of what makes it better is that I can actually make landmarks and SLURLs which teleport directly there. Also it's bigger, it's not stuck in the back corner of a mall with little foot traffic, and it's in a beautiful new themed sim (an Atlantic beach resort).

I have to design up a nice floor plan, but until that's done I've just stuck vendor boxes on the walls.