Friday, December 19, 2008

A Walk in the Garden

Of course I have a Second Life garden just as I have a first life garden. Most of the plants were bought in Second the very back is a wall textured with a cool little Ficus-at least I think that is what it is- taken from a photo I shot in Florida over break. And my goal for the garden is to make it completely interactive as an introduction to plants.

Visit my SL garden at:

You can also visit my First Life garden via this Flickr stream set.

Thursday, December 18, 2008

Simone's Simple Scripts #2 Image maps in SL?

One neat feature of the web is the ability to create image maps. We take for granted that you can often interact with images and get different responses depending on where you click. But until very recently this has not been possible in Second Life.

However now it is, thanks to a new function called llDetectedTouchST. This function allows you to return coordinates you have touched on the face of a prim. If you have a rectangular face the upper left corner is 0,0 and the lower right corner is 1,1.

I have found that with successive calls to this function, you can design rectangular hot spots for a texture. The texture can be anything from an image of a leaf, to menu items or a city map that you want a visitor to interact with. For learning purposes, I decided to set up an interactive leaf using this function. The object tells the visitor what the part is and displays a short text explanation as a texture of an object rezzed when the visitor touches on the appropriate spot on the leaf. I thought about displaying the textures as particles but decided that rezzing objects would give me greater flexibility.

I built in an interesting feature and this came about because I haven't quite mastered how SL handles coordinates. When I rotated the leaf prim, the objects with the explanations often ended up behind or on the wrong side of the leaf. Rather than mess with figuring out the right set of coordinate functions. I decided on a different strategy. I made an invisible prim called "positioner" linked to the leaf object and let it determine where the explanations are rezzed.

This is cool because it allows me to customize where the explanations rezz without with any sort of code. I just move the positioner prim to the right position. To make this little feature I linked the leaf prim to the positioner prim and then used the following set of statements in the Leaf's code to rezz the objects:

puthere = llGetObjectDetails(llGetLinkKey(2),[OBJECT_POS]);
llRezObject(part_name, llList2Vector(puthere,0), <0,0,0>, llGetRot(), 0);

The variable "puthere" is a list and the position of puthere has to be extracted from the list by llList2Vector.

The image shows the invisible prim highlighted (translucent red cube) in the middle of the object for Phloem.

Right now the hot spots and object names for rezzing are written into the code, but it should be easy to have all this be somewhat more automated were I to make this tool generally available. Unfortunately you need to find the prim coordinates for the hot spots by hand via repeated calls to llDetectedTouchST.

If you want to play with the leaf, and assuming SL is installed on your machine, just teleport to my home in Carmine at:

Tuesday, December 9, 2008

Simone's Simple Scripts #1

One of my pre-sabbatical tasks is to learn the scripting lanquage. So I am starting a new occasional feature Simone's Simple Scripts to share some scripts and amuse more advanced scripters with my fumbling around.

A useful tool in Second Life is a viewer that visitors to flip through textures or text-the holy grail of course is true web on a prim where users could essentially use a prim as a web browser, thus bringing the web into Second Life. Failing that, a standard thing to do is display information as textures and flip through that and there are of course lots of such viewers out there.

Prowling around the SL scripting portal I found a really cool and new function, llDetectedTouchFace(i). This function detects what face of a prim you are touching. Now this has possibilities. So I decided to make a simple viewer that uses only one prim and real simple controls. I like simple.

So I tool a box prim, flattened it out so that the central face is a display and the left and right faces are for flipping through images-which could be text captured as a texture of course.

The accompanying picture shows the result:

The script is pretty simple.

Unfortunately Blogger seems to mangle SL script.
So if you want a copy of my one prim viewer that you can copy and modify contact me in world (Simone Gateaux) or e-mail me. sgateaux at gmail dot com and I will send you the script or if you want, in world give you a copy of the one prim viewer.

Of course feedback and suggestions are always welcome.

P.S. If any one has an idea how to stop Blogger from mangling SL code...let me know.