Farewell to XYText, Hello to the Data URL Scheme

February 26, 2010 at 9:59 pm | Posted in Uncategorized | 2 Comments
Tags: , ,

Until this week, Second Life has been notoriously weak in its ability to render in-world text.  The 2.0 client, with it’s ability to render HTML on any prim, changes all that.  With the new client, you can assign a URL to the face of any prim, and the contents of that URL will be rendered on the face.

For those Web designers who already know how to whip up an HTML page and have a Web host to serve it, there’s not much more to say.  But if you’re an SL builder, and you just want to make a simple sign that doesn’t require extra prims, scripts or custom textures, here’s how.  I’m not going to try to make this a building tutorial, though, so you will need basic building skills to fill in the details.

Let’s start with an example.  Since you’re undoubtedly reading this in a Web browser, open up a new tab.  Cut and paste the following into the address bar and press [Enter].

data:text/html;,This is how to specify text  in a URL itself.

Your browser will simply display the text “This is how to specify text  in a URL itself.” on an otherwise blank page.  Not very fancy. But effective enough, and you can’t ask for much simpler.

The important thing is, you can now do this on any prim in Second Life.  (Of course, other people will have to be running a 2.0 client to see the text, and it will take awhile before you can count on most people doing that.)  In the new 2.0 client, there”s a new Media section on the Texture tab of the Edit window.  Select a specific face, press the + sign in the Media Section, and paste the data URL into the Home Page text box.  Click on Reset to make it the Current Page, then on Apply, and Voilà! your message appears on the prim!

To get nicely formatted text, you need to add HTML markup tags.  Here’s an example with a little markup:

data:text/html;,<body bgcolor=”lime”><font size=”5″><center><h1>Welcome to the Riverwalk</h1>There will be reception for our newest artist, Truly Hopeful, this Saturday at 7:00PM SLT.  We hope you will join us.</center></font></body>

If you paste this into either your browser address bar or the Sl client’s Texture Media window, you’ll see the effects of the various tags:

  • <body bgcolor=”lime”></body> set the background color to a light green.
  • <font size=”5″></font> made the font larger than the default value of 3.
  • <center></center> caused all the text to be centered.
  • <h1></h1> designated a heading, which caused the enclosed text to be displayed larger and emboldened.

There’s lots of fancier things you can do with HTML markup; it’s the basis for displaying all Web pages.  If you’ve never used it before, go ahead and learn some while you’re waiting for the 2.0 client to be widely adopted.

One last caveat: There is a limit to how long a URL you can enter into the Media window.  I didn’t count it exactly, but it seems to be about 1024 characters, which would be a typical limitation for the SL client.  A data URL is not going to be able to handle your fancy dancy display with animated text and slick effects.  But for whipping up a quick sign, it’ll be hard to beat.

Update: Azwaldo Villota points out that for Firefox to render the second example correctly, you need to remove the quotes around “lime”. And Internet Explorer?  Well, lets just say that if you are still using IE, you really ought to get a better browser . Google Chrome gets it right, at least, as does SL.

Advertisements

Create a free website or blog at WordPress.com.
Entries and comments feeds.