Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Sunday, June 7, 2015

When a rezzer system doesn't remove the hover text

I'm currently working in a full makeover of our SL home, and one of the things I've added is a house that came in a rezzer box. It's one of these systems that puts hover text on all the parts involved, and when you're done, in theory, the hover text is removed. But at times, for any reason (delays in communication, a network hiccups... you name it), the hover text isn't removed from all the objects.

Oh noez. Do I have to remove all objects and start again?

If the objects are modify, you don't have to remove all and start again :-)

Hover text is a primitive property that can be removed by using a self-deleting script. Since objects may consists of more than one linked prim, it's advisable that you use a script that removes the hover text from all prims on a linkset. For example, this one:

// Delete Hover Text (complete linkset)

default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_TEXT, "", <1.0, 1.0, 1.0>, 1.0]);

        // All done, let's clean-up ourselves for not forgetting the script inside
        llRemoveInventory(llGetScriptName());
    }
}

If you don't feel sure about doing this, because oh my god no, scripts, don't worry: you can grab this set of little (but useful) scripts that I have for free on Marketplace, knowing that the script to use is Delete Hover Text (complete linkset). And if you want to learn more about primitive properties and little scripts that set/remove them, then click here for the full text of my "Low lag scripts for builders" class.

That's it. Short and sweet today. I'm working hard, you see! :o)


Have a great day :-)

Sunday, April 5, 2015

Things you need to know about mesh bodies (Part 3)

This article was published in Fusion Magazine, April 2015. Click for the magazine!

Greetings everybody! We know, now, what a mesh body is and what we can expect with it. We also know that in order to use mesh clothes with a mesh body, we'll need to use a HUD that will hide slices of the body to avoid pokethrough.

Mesh bodies offer another alternative, for clothing. They may offer two or three extra layers, to wear painted clothes similar to the clothing system layers. These extra layers are usually organized like the SL avatar: a tattoo layer, to wear tattoos, or body make up... then an underwear layer, and then a clothing layer, which tends to be a little loose over the mesh body.

We will not be discussing here whether this is a step forward or a step back. The relevant thing is that mesh bodies do offer this option, and what matters to us is: how do we get those painted clothes over our mesh body?

By using something called appliers.

Appliers are scripted HUDs that will communicate with the mesh body, giving it specific instructions, i.e. which texture to apply over which of the available layers. Each mesh body has its own scripting system. This means that we would need appliers that work for our mesh body, in order to use them. If we see an applier product that explicitly says it will work with our mesh body/attachment, then we can purchase it, confident that it will work.

With so many mesh bodies and other parts, it sounds like this is a nightmare for applier creators. And it was, until a set of scripts called Omega came to life. The Omega set of scripts allows clothing designers to create one applier HUD, and this will work in all bodies that support Omega. Maitreya Lara and Belleza Venus, two of the most used mesh bodies at the moment, support the Omega system.

We have to purchase this set of scripts by teleporting to the Love N Lust Designs location (currently at http://maps.secondlife.com/secondlife/Jacuma/79/77/25, but double check in case they moved). Then either we spend L$99 for the kit corresponding to our mesh body/attachment, or we may join their group, and purchase it for L$1 or L$3. At the moment of this writing, those kits are on the first floor. Kits are also available on Marketplace. Just type omega system kit in the search box. Then, unpack the kit(s) in your inventory, if they were packed.

Once we have the kit that corresponds to our mesh body/attachment, what do we do? The procedure is a little different, depending on the mesh body. I will describe the procedure for two of the three mesh bodies I had the chance to try out: Maitreya Lara and Belleza Venus.

Maitreya Lara: The kit for this body includes a relay HUD. Simply, wear this HUD while at the same time you're wearing a HUD for your clothes. The picture shows an example.

Figure 1.1: Maitreya's relay, its body HUD, and an Omega applier HUD

We do not have to click anything on this relay HUD. So we can resize it to a small size, like in the picture, so it occupies the least possible space on our screen. Make sure that you're showing the corresponding clothing layers on the mesh body. Toggle on/off if in doubt; the script could be remembering a wrong state for them, and all you have to do is toggle again.

Notice also that whenever we select what we want to wear, by clicking on the HUD, a popup menu will appear, asking us to which layer we want the clothes applied (since version 2 of the body).

Figure 1.2: Pop-up menu when clicking on the Omega applier HUD,
to select on which layer the clothes should be applied

Belleza Venus: This kit includes an installer HUD. This will be a one-time operation, and it will not be necessary to wear a relay when we want to use Omega appliers. This installer HUD is named Omega System Installer - Belleza.

First, we have to wear Belleza's body. After this, we wear the installer HUD, and click on it. We will receive the following message in local (nearby) chat, like the picture shows: Thank you for Activating the Omega System!

Figure 1.3: Belleza Installer, notifying of success

We can now detach the installer, and use the Omega appliers we own. At this point, we do not need a relay. The body is ready to show the textures sent by the Omega applier.

One note, though: Since there are three versions of the body included, we need to activate the Omega system for each one of them. The three versions are: full body; body with hands but no feet, to use Slink feet, and body with no hands and no feet, to use Slink hands and feet.

Using this body, we have to make sure that the corresponding clothing layers we click on the Omega applier are visible. We have to wear Belleza's body HUD, to make sure of this. Once we're sure, we can detach Belleza's HUD and just use the Omega applier.

Figure 1.4: Using Omega appliers with Belleza

If you own other mesh bodies/attachments that support Omega, you may have to rez the item on the ground and drop a script inside, then take it back into your inventory. (That is the case with Wowmeh.) Follow the directions included in their documentation notecard. Keep in mind that you will find, together and on top, directions for the final user (the one who simply wants to dress up), and then for the creator who needs to prepare the HUDs. Unless you plan on creating applier HUDs, we are in the first case.

And with this, the mini series on mesh bodies is complete. Enjoy your SL.

Saturday, March 7, 2015

Things you need to know about mesh bodies (Part 2)

This article was published in Fusion Magazine, March 2015. Click for the magazine!

Greetings everybody! In the previous issue of Fusion, we started defining what a mesh body is, what the UVs of the mesh body are, and why this means a lot more work for skin and clothes creators... Particularly when some parts do not conform to the SL avatar UVs.

In this issue, we're going to talk about alpha zones.

Similarly to when we wear clothes over our SL avatar, some clothes will completely cover the avatar in the areas they occupy, and some other clothes won't, resulting in the effect that the mesh body pokes out of the clothes. When using the SL avatar, the solution consists of using a special clothing layer called the alpha layer. These alpha layers, as we know, will make the indicated areas of the SL avatar transparent. In the process of rebaking, the server shows the avatar's skin, minus the alpha areas indicated in the alpha layer.

We might think that the same process could be translated to mesh bodies: Have a texture as an alpha layer, and apply it to the body. The bad news: Currently, we cannot do this to prims (Remember that mesh items, in the end, are also prims.)

That's why creators of mesh bodies adopt this approach: They decide where to create slices of the body (alpha cuts, or alpha zones), and then, by using a HUD, a script makes those alpha zones hide or show, as needed.

Maitreya's HUD
Belleza's HUD
Slink's HUD, v1 (the updated body was released after this article was ready to publish)

Now, keep this in mind: Each mesh prim may have a maximum of eight texturable faces. This means that for every eight alpha cuts, maximum, a new prim will be required, to be able to have more alpha cuts. It's not something that affects the final user, but when you ask to a creator to make more alpha cuts in their body HUDs... remember that this creates more technical issues for them. They can be overcome, but thank them for taking all the hassle.

We'll finish this issue with a note: If you're wearing a mesh body, and you have to alpha all of it, to wear your mesh clothes... just take the mesh body off! Your graphics card will thank you for it, and the graphics cards of those around you will, too.

The reason? Transparent or not, that geometry is still there, and so, is still transmitted. We don't want to add extra stress to servers and our own computer (and those of people around). Living in SL is also living in a community; be the nice neighbour and try to minimize the impact you cause on others' machines.

That's it for this issue! We'll finish the mini series in the next one, talking about appliers and the Omega system. Enjoy your SL.

Tuesday, February 3, 2015

Things you need to know about mesh bodies (Part 1)

This article was published in Fusion Magazine, February 2015. Click for the magazine!

Who hasn't heard about mesh bodies nowadays? Like mesh hands and feet did before, they improve the appearance of our avatar, making it quite smoother than the default SL avatar. If you're interested in acquiring one, or even if you already have purchased one (or more than one), this mini series will clarify a few key concepts.

Daily, I see questions about what can/cannot be done with mesh bodies, or wondering if scripts could do things to them that are simply not possible. I also see questions about appliers, and particularly, the Omega applier. My goal is to take the mystery out of all this.

First of all: What is a mesh body? Technically, a mesh body is a set of linked SL primitives of mesh type, containing data about the geometry defining it, how this geometry should conform to the SL avatar and changes in some sliders (rigged mesh), and the textures to be applied.

It is important to realize that mesh objects, no matter how complex their geometry, are still seen as fancy boxes by the server, fancy boxes that have several faces that can be easily textured by scripts.


Figure 1. This is a mesh body too. Not so fancy, but it illustrates the idea of several linked objects and faces that can be textured

Also, mesh bodies are made of more pieces than the very simple concept shown in the picture. One of the reasons is because of the alpha zones and the fact that each mesh primitive may have up to eight different faces to be textured. If a ninth face is needed, then another mesh primitive has to be used. But let's not confuse ourselves with this yet.

Before that, let's talk about the naked skin shown on a mesh body. Later in the series we will get into clothing and the alpha zones.

Within the modelling program, whether this is Blender or others, we have several ways to texture a mesh. But because this mesh will be later exported and uploaded to SL, the mesh needs to be unwrapped. What does this mean? It means that we have to lay flat our mesh object (so textures can be created), creating a map, or guides if you will, indicating which point of the mesh will be textured by which pixel of the texture.

In order to create a texture that will fit that mesh object, we have to use these guides, painting by following its shape. We may hear that those guides are the UVs of the mesh object. It's good to be familiarized with the general idea: The UV of a mesh can be understood as the guides used to paint the texture. Of course, this is a very simplistic explanation of the term UV, but remember: the purpose of this mini series is understanding some basic concepts. We don't need to know all the technical details in order to learn what can be achieved with mesh bodies, and what cannot be.

Each creator of a mesh body could use their own UV if they wanted to. But this would be a nightmare for skin creators that create skin appliers, to begin with. Suppose that we have three different mesh bodies, and three different UVs for them, as this picture shows:


Figure 2. Three different arrangements of UVs done with Makehuman

Now, suppose you're a skin creator, you have ten skin tones, and you want to offer appliers for the three mesh bodies, so your customers can purchase the appliers that fit with their body. This means that you should work the ten tones over three different UV configurations. It sounds like a lot of work!

Instead of this, what mesh body creators do (at least, the creators of the four mesh bodies I've tried), is to unwrap their mesh bodies so they conform to an already known UV that saves a lot of work to skin and clothes creators. This UV is the UV of... the default SL avatar.


Figure 3. The UVs of the SL avatar upper and lower body

Still, making skin appliers is no click and go. Each mesh body has their own appliers system, which means creating a different set of HUDs per body, and skin creators could also need to retouch the tones of their skins, fix mistakes, then upload them again.

Actually, when I've said "at least, the creators of the four mesh bodies I've tried", that wasn't 100% accurate. There's a mesh body from the four I've tried, Belleza Venus, which has different UVs for hands and feet than the UVs of the SL avatar. This means that skin creators making appliers for the Venus body, have to redo the textures of their hands and feet, in all the tones they consider they will be supporting. This may also have consequences for clothes creators making appliers for this body.

We will continue in the next issue, but before closing this first part, I'd like to point one consequence of all we've explained here.

We've pointed out that some body parts, like the Belleza Venus hands and feet, do not conform to the UV of the SL avatar. There is no script solution for this. A script cannot magically transform one texture conforming one UV, to a different texture conforming another UV. A script can apply a texture onto the faces of a mesh. And that's it. The texture needs to exist. This means, the creator has to create and upload it.

This is why not conforming to the UV of the SL avatar is a bad idea. There's already a lot of work to do creating appliers for all the systems and brands a creator decides to support. Giving them more work than necessary is not a good idea.

Now, yes... See you in the next issue! Enjoy your SL.

Monday, December 8, 2014

Your Zero-Lag Events Avatar

This article was published in Fusion Magazine, November 2014. Click for the magazine!

Do you like shopping events? I do! But if there's anything that can ruin the experience, that is lag. Currently, the large amount of mesh attachments in our avatars, together with the high resolution textures that many of them use, provoke slow rez times that test our patience, not to mention all the stress over our graphics cards and viewer crashes.

All this could be alleviated if each of us stopped by events, particularly on the first days (when they're the most crowded), in an avatar prepared to use the minimum possible amount of resources.

We may think that this is not our problem and that people should upgrade their machines. But the truth is that we do not know if people could actually upgrade their machines, or if their slow connection could be upgraded to a faster one. We don't know. But we know this: with a little collaboration on our side, we will be contributing to improving everybody's SL experience, including ours, being smoother when visiting crowded places, such as shopping events.

A very easy way to do this, which will make of you the lowest lag avatar possible, both from the script side and from the mesh/textures side, is creating an outfit that will make us completely invisible, without attachments. Outfits have a great advantage: using them is immediate. We don't have to look in our inventory for all its parts, we only have to wear the outfit, to replace our current one. How do we do all this? That's what we explore now.

First of all, we may want to save our current outfit. Click on the Appearance button.


This opens a window. Then move your mouse to the bottom of the window that opens, and click the down arrow next to Save As.


Give your outfit a name and click OK.


Now, detach everything you're wearing. If you don't know what you're wearing, you can access to the WEARING tab of your inventory.


Then right click over each item, and either Detach (if it's an object) or Take Off (if it's a clothing layer). Beware that we are not able to take off our skin, head base, eyes and shape. Our avatar will always be wearing one of these items, the rest are optional. If you're a Firestorm user, you may want to leave the bridge attached. It's not going to be an issue for scripts lag.


We could now look for an already done completely transparent alpha layer, but let's take this opportunity to learn how to create our own. First, close the Appearance window, and open your Inventory. Locate the Body Parts folder, right click with your mouse over it, and select New Clothes: New Alpha Mask


Rename it as something like Full Alpha, and Wear it. Once worn, right click on it, and Edit. You will see a window like this:


Making a full alpha is the simplest case, for we don't have to drop any textures on these boxes. All we have to do is tick all the checkboxes, like the next picture shows (we'll see our avatar vanishing as we tick boxes), and then hit the Save button at the top of the window.


Once we've done this, we save this outfit as we've learned before, giving it a name as Invisible - Ready for Events (or anything along these lines that makes sense to you).


Whenever we want to wear it, all we have to do is open up the Appearance window, right click over the outfit, and select Wear - Replace Current Outfit.


This will immediately replace our outfit, and we'll be ready to visit the event, causing the least lag possible to other avatars, and of course, to ourselves.

Share this with your friends, and help events being more lag-free places!

See you in the next issue. Enjoy your SL.

Saturday, September 13, 2014

Resident Resource - "Lag! Your Animation Overrider"

This tutorial is available at: Resident Resource - "Lag! Your Animation Overrider"



This class was written in September 2011. Since then, viewers like Emergence and Phoenix succumbed, so the bits referring to them can be safely skipped. I've kept them for the sake of completion, since this was the original material I used to teach. The text hasn't been updated, but hopefully some ideas will still remain interesting to know about. Please forgive my 2011-English (Of course, suggestions to correct it are more than welcome.)

Also, I've decided to set out the original supplies for this class in a box at the store, within the books section, for free. Head over here and get the class supplies if you wish to follow the practice. The items are inside a Black Tulip textured box.

LAG! YOUR ANIMATION OVERRIDER


Welcome everybody. I am Auryn Beorn and I'll be your instructor for this class.

It's a while since we're discussing in some classes about the sources of lag, and what we can do to avoid it the most possible (as much as us, as residents, can do about). It all began as an unique class that was intended for 90 minutes. It went for three hours and the AO topic had no time for being discussed, so I've finally found the moment to do it separately.

As you sure know, "lag" is the common word used to name a slow reaction time when we're using an online application, like Second Life, World of Warcraft... anything like this that you can think of.

The fact of existing a slow reaction time means that "something's happening", either at client side, or at server side. The reasons and main culprits are discussed in detail in the class "LAG! Every script counts" and will not be the focus for this class.

In other classes we see why the scripts are such a big deal, as well as which effects and properties assure us that we can remove scripts from the objects if necessary. Also, we all know about resizers being the evil, etc, etc, regarding the avatar appearance, more specifically.

This class is to study what an animation overrider is, and what we can do to create a low scripted animation override, as well as be conscious of why we're asked to take it off when in crowded places, among other details.

WHAT IS AN ANIMATION OVERRIDER?


When we all get to SL, we're gifted with walking like ducks and standing like robots.

We, as avatars, have a predefined set of states that can be animated: Walking, standing, sitting, jumping, turning to left, turning to right, crouching, hovering, etc.

But the default animations are not... How to say... Specially glamorous.

Not even human (I know nobody walking like ducks.)

So, since scripts allow to animate avatars, and scripts allow to control your avatar keys, people smarter than the designer of the default animations decided to script what is called an "animation overrider" (and better animators, to create decent animations.)

So there we have them again: if we want to walk like humans, we need to wear scripts attached.

WHY ARE THEY ALWAYS A TARGET OF THE REQUESTS FOR DETACHING SCRIPTS?


We know that an important problem we have with scripts is... If there are many, they fill quick the memory. That's why it's so important to proceed deleting as soon as we can the resizers, specially the older ones, with one script per child prim.

But sometimes, just reducing the script count is not enough. We may have an animation overrider that only needs from two scripts (and we're preparing such an AO here, at class), and still, 40 avatars wearing the AO is an issue.

What does the AO have that makes it being so painful?

A 0.25 seconds timer (or even more frequent!)

That means: Per avatar, the server needs to pay attention each 0.25 seconds to all of our animation overriders.

Why such a small time?

Because that's a reasonable time for the script detecting a change in our state, so it can stop the previous animation and run the appropriated one.

An example for what I mean with this: When we are walking, it doesn't make sense to play other than a walking animation. But as soon as we stop walking to, say, sit, the walking animation should be stopped, then the sitting one animation initiated. Those state changes happen quick, that's why the script needs to be asking for our current state so often. That's why nobody would program an AO script and give the timer 5 seconds, to reduce lag... The requirements for an AO mean a timer that runs quick.

So yes, we can cut down the total of scripts that our AO's have, and that will of course improve the memory usage for the server, but we still have the problem of the timer.

Still, to focus all what we're discussing here, let me try to advance the "sections."

On one hand, yes, because reducing the script count is important, we're seeing how to make a "script cut" version of our AO's, and we'll do it here.

But also... We've said that the AO is requesting each 0.25 seconds our state.

If we detach the AO, yes, problem solved.

But AO's can be deactivated, not needing to be detached.

If we get an AO that needs only two scripts (which is a good thing!), we could simply deactivate it when not needed, and that way, the timer, which is the biggest load for the server this time, won't be active also, right?

So one may wonder, when could we just deactivate a two-scripts-AO, to help with lag?

Like... Right now. We're all sitting, right?

So if we're all the time sitting, why make the server check each 0.25 seconds if we're sitting or not?

I mean, at class, to say an example, we're pretty much aware of when we're sitting (and for a long time! At least at my classes :P )

We could make an habit of this:

  • Sit
  • Deactivate AO
  • Stand up
  • Activate AO

(I know I have an animation active, but I'll say why in a moment)

There are many situations where we spend our SL's sitting on something:

  • A chair
  • A couch
  • A poseball dancing
Among others :P

Why not deactivate the AO in those situations?

Just by doing that, we'll help a lot the server.

For each state, there are default animations. When we sit on a prim, by default, there's a sitting animation that will be activated on us. This can be changed by a script that starts a different animation than the default one.

So having the AO overriding poseballs scripts is not a good idea, since the poseballs themselves have a script to animate our avatar.


We're now completely aware that by creating a script-cut version of our AO plus getting the habit of deactivating the AO each time we *sit* (which is often), we're helping a lot reducing lag.

Also... Some viewers have a client side AO. That's even better!

Emergence, Phoenix, Firestorm and Singularity have client side AO.

That is what I'm using: the client side AO... So that's why I have my sitting animation on... :o)

Not because I was setting a bad example, but because I have the client AO on!

The client side AO relies on the bridge script, which all the users of those viewers always have on. So, since the viewer can take care of the keys we press and that script already can communicate with the server to be aware of state changes/notify of the new animation to play, why use an inworld AO?

Ok, so we've identified a problem: script count + timer.

We've thought about a possible solution: script cut + deactivate when not necessary/client side AO when possible.

CREATING A LOW-SCRIPTED VERSION OF OUR ANIMATION OVERRIDER


Usually, we don't need more functions from our animation overrider than actually... let it override the animations. Dances, facial gestures and other extras are not much needed at a class, shopping or maybe even roleplaying. Even the dances may be an option... as all the dance places already have danceballs... why overload the place with more scripts for that?

So we can create a low-scripted version for our animation overrider, that will cut the script count for it from the usual 20 scripts the AO's have, to only TWO. Now think on a crowded club, and think what if all the avatars use a cut-script version of their AO. We're talking about a serious reduction of the number of scripts. Not as spectacular as when we remove the resizer scripts, but yet, important.

And the best of all! We don't need to renounce to our animations. We don't need to walk like a duck in a club. So let's do *here* the work of creating this low-scripted version of our animation overrider. Once we're finished, you all will have an AO to choose, depending on how crowded do you expect to be the place.

I've chosen creating a couple of prims to hold within the open source animation overrider ZHAO-II, that you can find as the object "AO base (ZHAO interface)" included in the class supplies. All the animation overriders need from a notecard that tells which animations we're using for each state, and the ZHAO notecard type is, by far, the most widely used.

So... Let's begin with how to create a script-cut version of our AO. This work will be useful EVEN if we have a client side AO, since the notecard that we are going to create now has THE SAME FORMAT than the one the client AO requires.

If any of you has, by chance, a no copy AO attached, the following links contain two really basic AO from Vista that can purchase, so we can do the practice here, not risking your own AO at class!

For the girls: https://marketplace.secondlife.com/p/VA-VISTA-BASIC-FEMALE-AO-V08-basic-line/298453
For the guys: https://marketplace.secondlife.com/p/VISTA-MALE-BASIC-AO-V08-basic-line/298450

2014 NOTE: If you have a no copy AO, do not try to do this with it unless you're sure that there's no maintenance going on. One way to know if there's any kind of maintenance going on is by checking the SL status page. Keep in mind this: If there's any issue in the grid, it takes some time until LL are notified and they update the status page. If you notice any kind of inventory issues, or that you cannot attach/detach items... DO NOT REZ no copy items! Wait until you see an update announcement in the status page, and then refresh the page until making sure the issue is resolved.

What should we do, then?

Try not going ahead! We'll follow each step slowly.

Rez a copy of your own AO on the ground: It will be a small thing, so don't lose it from sight :-)

Not the AO from supplies: Your own AO.

Right click on your AO, and select "Open". It will take a moment to load everything.

Do we all have open a window that is loading a (most likely, long) list of animations, some scripts and notecards?

When you have that list loaded, click "Copy to Inventory".

That will make a whole copy in your inventory: once the copy is all done, you can take your AO back.

REZ the object "AO base (ZHAO interface)" from the class supplies and edit it.

Drop all the *animations* from your AO within the same prim that has the two scripts "ZHAO-II-core 7/29.1" and "ZHAO-II-interface 7/21.1".

Just the animations that we've copied in our inventory, at the moment. Let's wait a moment for the notecard.

Now we need to set the notecard.

Since this notecard we're setting is going to be full perms, we can do this step now in our inventory (we can drop FULL PERMISSIONS items within an attached HUD: it's only when the items are NOT full perms when we have to rez it to add contents.)

Before taking the AO back into your inventory, rename it to something that makes sense for you. For example, you can rename your HUD My Script-Cut AO before taking it into your inventory. This is just so you know this will be your script-cut AO with your animations.

Once renamed, take it.

The last step is editing a Default notecard, for it to be contained in the AO, so we can load it once finished, following a specific format.

Create a notecard in your supplies folder named Default.

You can choose other name if you wish, but keep in mind that this notecard name will appear as a button option in a dialog window, so DON'T USE more than 24 characters for the name of the notecard!

I've included several sample notecards in the supplies to show different formats that our AO's may be using: we'll refer to them later.

I've also included a notecard named Default - Sample from supplies: This one has the exact format that ZHAO-II expects from it. So let's study first the format of this notecard, and then we'll study how to "translate" our own AO notecard to this format.

Please, open the Default - Sample from supplies notecard.

After opening it, you all see that it has several lines, and all those lines have the same structure.

That is:

First, between [ and ], it has a word, a very specific word that has to be written as you see there, with the spaces around, exactly as there.

Those special words, like Standing, Walking, Falling... correspond with the states that our avatars allow to have animated, and we have to write that exactly as we see there:

[ Standing ]
[ Falling ]
etc.

Then, after the closing ], we specify which animation corresponds to that state. That animation has to be in the inventory of our AO prim: In the same prim where the scripts are, and we have to use the same exact name that the animation has.

Many states only allow one animation, and ZHAO-II will complain if it finds one of these states having specified for it MORE than one animation. Fix the notecard is simple here: make that state have just an animation, as ZHAO-II indicates in its error message.

But a few allow several animations. When a state allows several animations, what the AO does is, usually, to cycle between them.

Which states have multiple animations allowed? Stands, walks, sits and ground-sits.

How do we assign more than one animation to the states that allow so?

As we can see in the notecard, simply separating each one of the animations we want for the stand, by the | (pipe) character, like the sample from the supplies that you have now open:
[ Walking ]08WALKSEP4|08WALKELEGANT|08WALKSEP2HIPS|08WALKSEPBACK|08WALKHAPPY&SEXY|08WALKH&SHIP|08WALKH&Spocket|08WALKhead|sexywalk

This means that, for the Walking state, ZHAO-II will cycle among the animations:
08WALKSEP4
08WALKELEGANT
08WALKSEP2HIPS
08WALKSEPBACK
08WALKHAPPY&SEXY
08WALKH&SHIP
08WALKH&Spocket
08WALKhead
sexywalk

And that means also, that we should have those animations in the AO prim, OR THERE WILL BE RUN-TIME ERRORS (that are visible, AND VERY ANNOYING, for many users, in their local chat!)

Also important: the animation names can't have spaces between them and the | to join all of them in the same line.

Another note: the Standing state admits more than 12 animations (walks, sits and ground sits are limited to 12), but we have to add up to 12 per notecard line, as we can see in the example notecard open (to overcome a LSL limit about reading notecards):
[ Standing ]VACOOL1.1xF|VACOOL1.2xF|VACOOL1.2bisxx|VACOOL1.3xF|VACOOL1.4xFx|cool27|VACOOL2.2F|VACOOL2.3xF2|VACOOL2.3x2F|VACOOL2.4FX|VACOOL30
[ Standing ]cool6Fbis|VACOOL9b|VACOOL9|cool4.2F1|cool4.2F|VACOOL4.4|cool7|cool6F08|VACOOL2.4Fxxx|VACOOL2.4Fxx2|VACOOL4.4FAUG2|VACOOL1

NOTE: Where the pipe | character is located depends on our keyboard. Some keyboards have it pressing ALT GR + 1, others have it pressing SHIFT + BACKLASH. Check your keyboard configuration for this matter. As a last solution, you can always copy/paste it from this notecard: |


Ok up to here? Clear the format of the notecard, as a start?

Following is the complete list of states that can be animated for our avatar, updated to 2011-08-15, according to the wiki (source, here: http://wiki.secondlife.com/wiki/LlGetAnimation )
Crouching            Hovering         Hovering Down    Hovering Up
Jumping              PreJumping       Running          Sitting
Sitting on Ground    Standing         Striding         Standing Up
Flying               FlyingSlow       Falling Down
Landing              Soft Landing     CrouchWalking
Turning Left         Turning Right    Walking

2014 note: This list remains valid nowadays.

Striding is when the avatar is stuck on the edge of an object or on top of another avatar. About Standing: After falling a long distance, the Landing animation state is skipped and the Standing Up state is used.

IMPORTANT: This means that additions from specific AO's, like turning when swimming or diving, are not a state controlled by a "normal AO script" (like ZHAO-II), but a specific extension of such an AO that also checks the water level in the timer (by using the llWater function: http://wiki.secondlife.com/wiki/LlWater )


Now... How do we "translate" our own AO notecard to this format?

Some AO's will make this task easy. Others will require more work from us. I've prepared several sample notecards that show different formats, and then included how the "translation" should be done.

The notecards (no modify/no transfer so you don't confuse them with the one you have to use in your AO) are:
ORIGINAL AO NOTECARD              "TRANSLATED" AO NOTECARD
--------------------------------------------------------------------
VISTA AO - Example                VISTA AO - For ZHAO-II
VISTA - Old Format Example        VISTA Old Format - For ZHAO-II
GuyMocaps - Example               GuyMocaps - For ZHAO-II
MyAO Default - Example            MyAO Default - For ZHAO-II

The easiest case comes from AO's like Vista which, from the 2.0 version, use the same format that ZHAO-II expects, with a single exception: the [ Typing ] state, which is NOT acknowledged by this ZHAO version.

Open the Vista AO - Example and VISTA AO - For ZHAO-II notecards to see that the differences are minimal. Easy peasy, this case. But sometimes we'll have to do more work.

Close those notecards, and let's open now, to compare, the VISTA - Old Format Example and VISTA Old Format - For ZHAO-II notecards.

To mention an example, notice how the following block in the Vista - Old Format Example notecard:


:: [ Standing 1 ] ::
casual stand 1
:: [ Standing 2 ] ::
casual stand 2
:: [ Standing 3 ] ::
casual stand 3
:: [ Standing 4 ] ::
casual stand 1
:: [ Standing 5 ] ::
casual stand 2


has been translated to the following in a ZHAO-II notecard (Vista Old Format - For ZHAO II in your supplies, removing duplicate animations):

[ Standing ]casual stand 1|casual stand 2|casual stand 3

Similarly, we'd translate the rest. More work to do, but still, easy.


NOTE: When translating an AO notecard to ZHAO-II format, don't forget that only standing, walking, sitting and ground sitting are the states that allow us more than one animation, but none of the rest!

Some AO's may have a notecard format that differs a lot from the standard ZHAO-II format.

To illustrate this, we can check, for example, how the My AO Default - Example notecard refers to the normal and ground sits:
[Sit.N]D1479-Sit.N,D1480-Sit.N,D1481-Sit.N,D1482-Sit.N,D1483-Sit.N,D1184-Sit.N
[Sit.G]D1485-Sit.G (185cm),D1486-Sit.G (185cm),D1487-Sit.G (185cm),D1488-Sit.G (185cm),D1489-Sit.G (185cm),D1490-Sit.G (185cm)

and how this should be written in our ZHAO-II notecard, as the MyAO Default - For ZHAO-II notecard shows:
[ Sitting ]D1479-Sit.N|D1480-Sit.N|D1481-Sit.N|D1482-Sit.N|D1483-Sit.N|D1184-Sit.N
[ Sitting On Ground ]D1485-Sit.G (185cm)|D1486-Sit.G (185cm)|D1487-Sit.G (185cm)|D1488-Sit.G (185cm)|D1489-Sit.G (185cm)|D1490-Sit.G (185cm)

There's another example in the supplies, GuyMocaps - Example which, as an example, has the walking animations as follows:
a,cartwheel,drunkwalk2,fliprun,handstdwalk,MDHUskip,morpheuswalk,mwalk2MC,mwalking1,mwalking3,mwalking4,mwalking2

and this should be written this way in our ZHAO-II notecard, as the GuyMocaps - For ZHAO-II notecard shows:
[ Walking ]cartwheel|drunkwalk2|fliprun|handstdwalk|MDHUskip|morpheuswalk|mwalk2MC|mwalking1|mwalking3|mwalking4|mwalking2

Check these examples on your own in case you need it.


Once we're done getting ready our ZHAO-II notecard, wear the AO we've got ready with your animations.

Edit it, click the "Content" tab.

Rename the empty Default notecard from the AO included in the supplies to Empty (it's always a good idea to have a clean reference of the notecard format.) Supplies have also a copy of this empty notecard, Empty - Keep it as base to start with!

Drop this Default notecard we've created from our AO's configuration after translating to what ZHAO-II expects.

Close the "Edit" window.

Click the white "page" button from the AO. Select "Load" from the menu it shows, then select to load the Default notecard.

Ready to go.

CLIENT SIDE ANIMATION OVERRIDER


Now, why have I insisted this much in having clear the format for the ZHAO notecard?

Because if we're using Emergence, Phoenix, Firestorm, Singularity... We may use a client side AO, and this client side AO requires a notecard with the SAME FORMAT that we've now studied, so all the work made before can be used for this too.

How do we make it work?

IMPORTANT 2014 NOTE: As time went by, each viewer has developed/polished their way of setting up a client side AO, and so the following information might be obsolete/inaccurate. Please DO REFER to the documentation of each viewer for the most current information, if what's explained below doesn't correspond to what your viewer shows. The text below is kept because that's how things worked back in 2011, for the sake of completion with class text, as explained in the opening.

First, we have to copy the ANIMATIONS AND THE ZHAO-II NOTECARD WE'VE CREATED in a special folder. The scripts are not to be copied there.

This folder depends on the viewer we use. So far, I've compiled this list:
Emergence      #emergence
Phoenix        #Phoenix
Singularity    #Phoenix
FireStorm      #FireStorm/#AO

Now, either click CTRL SHIFT O (letter o), or select Phoenix: AO / Emergence/AO / Singularity/Animation Override... from your menu.

That brings up a window.

Do you see a zone of that window saying Drop a ZHAO II Notecard here?

That's it: drag the notecard directly into that zone of the window. We're not done yet! But almost.

Now we have to click "Reload" to make sure the notecard is loaded (still, one more step to follow!)

There it is a "Override Anims" check box below the Reload button. We have to click it!

If we get warnings, that might mean that some animations we've said in the notecard are not in the viewer folder.

Once the notecard is loaded, then we can check clicking "More" for the default animation we want for each state, and if we want to randomly cycle among them. That's it all what we need to have the client side AO working.


And this is all!

You don't need to be ashamed of having an AO and walk like a duck anymore: Now you know how to be as glamorous as animations allow us, at low-lag cost!

-- Auryn Beorn

Saturday, July 12, 2014

Creator Resource - Moving to Blender 2.70 (and 2.71)

This tutorial is available at: Creator Resource - Moving to Blender 2.70 (and 2.71).



There's a new version of Blender since some months ago, 2.70, recently updated to 2.71. This has been a major release with many new updates. If you're following my Blender books, you may wonder if it would be advisable to update, if you can update, and if there will be problems following the books that refer to a previous version. In this post, I will address all the interface changes that may make some Blender screen snapshots to look different, and where some tools are located now. My apologies I couldn't do this before: RL has been a little crazy in the past months, and catching up with all the delayed work involving my Blender classes and books has been quite hard.

Would it be advisable to update? Yes, no doubt, go to the Blender website and download Blender 2.71 right now!

All published books up to date are affected. However, don't feel "oh my gosh, do I need to learn everything again?" You will see that almost everything we learned behaves exactly the same. There are not many interface changes with respect all that was explained in those books, but please refer to this post if you find differences and feel lost :-)

(The affected books, in case there are doubts: Interface Basics, Modelling Basics, UV Mapping and Texturing Basics, Curves. About the upcoming books: Although they say they're using Blender 2.69, I tried to check all the screenshots in Blender 2.70 and 2.71, and there should be no differences.)

Remember two important things before going for the changes that affect the Blender books series:

Blender 2.71 makes even easier the task of moving our settings. Open it up, and read carefully the splash screen:


Yes, it says "Copy Previous Settings" and it's going to do exactly what you think it will do. Click it. Yay! :-)

With that said, let's go now for the changes that are relevant to all of the books published until now.

Tabs

This is the first that's going to strike us as "hmmm... Where did everything go?" When we open up the Toolshelf, we see that it presents this appearance:


Instead of having that long list of tools that made us to scroll until finding them, they have now been arranged into tabs, categorized. There will show more tools if something is selected, related to what is selected:


Hitting TAB for Edit mode we continue to see that the tools change to tools that are available only in Edit mode:


And notice how in particular, the Shading Smooth/Flat buttons that, in Object mode, were under the Tools tab, in Edit mode are under this new Shading/UVs tab, giving us shading option not only for faces (as we were used to), but also for edges and vertices, all in the same place:


By the way, maybe you have noticed that the Info Toolbar no longer has an Add menu:


This has been moved to the Create tab of the Toolshelf:


Personally, I find this to be a more consistent place for these options to be. SHIFT A continues working over the 3D View, showing the Add menu.

Where else are we going to find tabs? Within the Image Editor, in the Toolshelf, for now:


Also, notice that in here there's another consistency change. We know that when we hit T over the 3D View to open up the Toolshelf, it opens to the left, and when we hit N for the Properties panel, it does open to the right. When we worked in the UV/Image Editor, the T panel opened to the right, and the N panel opened to the left. This has changed: Now, when in the UV/Image Editor, the T panel opens to the left, and the N panel opens to the right, to be consistent with the behaviour on the 3D View.

Menus have now separator bars, which in my opinion makes them clearer, specially since similar options are grouped together:


What else?


Not much is left that could affect us and the material that's up to date in the Blender course. So as you can see, even though Blender 2.70 and 2.71 have been major releases, there's not much that did affect us :-) There have been a lot of new features, but our course hadn't reached them yet.

If you want a full description of all features, Gottfried Hofmann from Blender Cookie has made a wonderful course, available for free, here (The course is in video tutorial format, with some text as a summary per section.)

If you have heard about Cycles render, or have worked with it, here it comes the big news: Blender 2.71 supports baking for Cycles! See: You wanted to download Blender 2.71 right now :-)

PS: If you're following the books, remember that in this page you will find a list of questions and answers related to the books, from people having followed them. When other people had trouble and completed the right form in the store, I've tried to help them sort the issues. I find that kind of material quite relevant to learning too, which is why it's published in the store blog. All names are removed. The important is what they asked.

Monday, February 10, 2014

Creator Resource - Writing colors for scripts and/or configuration notecards

This tutorial is available at: Creator Resource - Writing colors for scripts and/or configuration notecards.



At times, we want to modify a simple script, to change a color that's written in it. At times, we have to do some changes in a configuration notecard, and said notecard expects that we write the colors down in a certain format.

But likely, we're not scripters. Likely, we don't know how to obtain that color "code". The case, more often than not, is that we have the color we want on a prim's face, and want the "code" for it. The Firestorm viewer has a tab in the color picker indicating the values a script would want, but not all of us use it, or know what to do with those numbers.

Fortunately, there are simple ways of obtaining said "color code". I will give here a script that will help, explaining how to use it. After it, I will give a long explanation, in case that you want to know more about how colors are written in scripts :-)


The quick way


To create this script, right click in your inventory, in a folder of your choice, and select the "New Script" option. If you don't see this option show: you have to right click over a folder.

Rename this script to something that makes sense to you. For example, rename the script to Tell me the color of a face.

Now double click on it and open it. Select all the text that you will see (the default script) and delete it. Yes, delete it! Fear not :-)

Is your script empty? Completely empty?

Perfect. Now select the code below, which I've colored dark green, so you see clearly where it begins and ends. Copy it into your clipboard (CTRL C), then paste it into the completely empty script's window (CTRL V).


default
{
    touch_start(integer total_number)
    {
        llRegionSayTo(llDetectedKey(0), 0
            , "Color in the touched face is:"
                + "\n" + (string)llGetColor(llDetectedTouchFace(0))
                + "\nDon't forget to delete me when you're done!"
            );
    }
}

Now save this script. If you've performed the previous steps correctly, you should see a Save complete. message showing at the bottom of the script window. Otherwise, you'll see a dreaded script error. We're not bothering in trying to fix it this time. Delete the script and start again, making sure you select all the text :-)

With the script saved, that means that we can now use it.


How to use the script


Rez a box. Change the texture to Blank, so you will see the colors easily. Change any of its sides to the color whose code you want to obtain. Then drop the script inside the box.

Click the face with the color you want to know. You should get a message in chat like:

[09:02] Object: Color in the touched face is:
<0.50196, 0.50196, 1.00000>
Don't forget to delete me when you're done!

That means:

<0.50196, 0.50196, 1.00000>

is the code you were looking for :-)

(As the script instructs you, once you're done, delete the script from the prim. Otherwise, it will always send those messages to whoever clicks the prim.)


The long explanation


Any color is always a combination of Red, Green and Blue values. Usually, these values go from 0 to 255. The higher the value, the more you have of that component. They're usually written it this order: R, G, B.

To mention a few examples:

<255, 0, 0>         RED
   <255, 255, 0>       YELLOW (= RED + GREEN)
   <128, 128, 128>     GRAY 50%
   <0, 128, 0>         GREEN 50%
   <0, 0, 0>           BLACK
   <255, 255, 255>     WHITE

But scripts in SL need this written in a very specific way. We need to convert this. Scripts expect the numbers in a different range, so instead of writing, for example, the color red like this:

<255, 0, 0>

the three numbers have to be within the range from 0 to 1, so the color red would be written as follows:

<1.0, 0.0, 0.0>

What do we do, then, when we have a RGB code for a color we like, to "translate it" to LSL (the scripting language)?

We have to take the RGB, like here: 255, 255, 0
Put the three numbers between < and > and separate by commas, adding a decimal point:

<255.0, 255.0, 0.0>

and then we have to divide the three numbers by 255.0, so we get:

<255.0/255.0, 255.0/255.0, 0.0/255.0>

which gives as result:

<1.0, 1.0, 0.0>

So, in general, once we have the values for R, G and B, we need to "translate" them to LSL, which expects the color as a vector, <R, G, B>, but values for R, G and B have to be from 0 to 1. So, if we have values from 0 to 255, to convert them into 0 to 1, we need to divide them by 255.

This is, we have <R, G, B>, being R, G and B from 0 to 255, as usual, so LSL needs that we perform the following operation:

<R/255.0, G/255.0, B/255.0>

for the definitive values for the color.

NOTE:
<R/255.0, G/255.0, B/255.0>

is basically the same as:
<R, G, B>/255.0

being the last one, preferred if you typed like that in a script.

There are a lot of resources in the web to find the RGB components of a color. The two following links are good resources for this:

http://www.allprofitallfree.com/color-wheel2.html
http://www.ficml.org/jemimap/style/color/wheel.html

EXAMPLE: Suppose we have the blue tone <6, 172, 255>, as it will be written with the standard 0-255 range for RGB. To convert this <6, 172, 255> to a valid color for LSL, we have to perform the following calculation:

<6.0, 172.0, 255.0>/255.0

which means that the value we'll use for the color will be:

<0.023529, 0.67451, 1.0>

(Yes, we could leave it as <6.0, 172.0, 255.0>/255.0, but it's better if we save the script to do unnecessary calculations.)

The colors mentioned above will also be written this way:

<1.0, 0.0, 0.0>         RED
   <1.0, 1.0, 0.0>         YELLOW (= RED + GREEN)
   <0.5, 0.5, 0.5>         GRAY 50%
   <0.0, 0.5, 0.0>         GREEN 50%
   <0.0, 0.0, 0.0>         BLACK
   <1.0, 1.0, 1.0>         WHITE

Wednesday, January 8, 2014

Creator resource - When your object is a trash can, and you don't know

This tutorial is available at Creator resource - When your object is a trash can, and you don't know.



I was sorting inventory a couple of days ago, and rezzed one of the items to see what it contained (oldies from when I was a newbie, that were still hiding). The box had hover text and, as usual, the hover text script was left inside the object (You can safely delete that script! Read here for all the information. Help reducing SL's lag provoked by scripts :-))

The script had the following code:

default
{
    state_entry()
    {
        llAllowInventoryDrop(TRUE);
        llSetText("FREE eyes!!!", <1,1,1>, 1.5);
    }
}

On a picky note, it's worth noting that llSetText will ignore any value greater than one that we pass to the function as a last parameter. In less cryptic words, that means the last 1.5 isn't correct. It should be a number between 0 and 1, although typing a number outside from the range will not make the script to scream.

Anyway, the relevant is the line above llSetText: llAllowInventoryDrop(TRUE);

We don't need that line to have our prim showing floating text. But if we keep the script inside our prim, we are allowing something else: that residents have the ability of dropping assets inside the prim! Which, in practical terms, means that we've made a public trash can of sorts of our prim :-) (Here for all the technical notes on the llAllowInventoryDrop function.)

A script like that would allow you to offer a very simple mailbox (and I believe that's the origin of the "floating text" script I found), but if you only want to show floating text, as it was the case, you really don't need the other line :-) (Even more, as noted at the beginning... You don't even need the script in the prim, once the floating text shows as you want!)

So, what to do?

Easy solution: Simply, delete the script from the prim. You will see that the floating text remains, and your prim is no longer a trash can of sorts.

If you feel insecure that you may have activated any strange property that will make the prim to continue being said trash can, then copy the following text and paste it in a new script in SL, save it, and drop the script in the prim:

default
{
    state_entry()
    {
        llAllowInventoryDrop(FALSE);
        llRemoveInventory(llGetScriptName());
    }
}

You will see the script self deleting: I've included that line so you don't accidentally forget the script inside the prim. Once the script has done its job, you no longer need it inside the prim. In those cases, I make my scripts to self delete :-)

And that's it! Check the prims you have out with floating text, delete the hover text script from them, and if it makes you feel more sure, then drop the deactivate propertie + self delete script. Before deleting the hover text script, make sure it's a very simple script as the one I've shown! Do not delete more complex scripts, they may be doing other tasks you need :-)

Have a great day!

Friday, December 20, 2013

Creator Resource - Creating HUDs: The Builders Part

This tutorial is currently available at Creator Resource: Creating HUDs, the builders part



What is a HUD? What is the purpose? How do I create a HUD?
I'm a builder and want to create a HUD so a scripter works the code, what should I take into account?

Creating HUDs is usually a team work between builders and scripters. Come join this class to have answers for the questions above and learn, as a builder, what to take into account to design your HUD the best way for the scripting it may require.


Table of contents




WHAT IS A HUD?


"HUD" stands for "Heads Up Display", that's it, an object that gets attached to one from a few special points in our viewer and shows in our window, but it's not seen inworld by the rest of avatars around. They provide us with an interface to control many things we can think of: our avatar (like animation overriders), objects around, nowadays with the new viewers they can even display media on them.

We sure have used lots of HUDs, being the most popular uses:

  • Animation overrides
  • Multi-tools
  • RP and combat systems
  • Books, magazines...
  • Texture/Color/etc change for hair, shoes...

and many more.

To use them is very simple: we just have to attach them to any of the EIGHT special HUD points that SL allows us, and begin clicking :o)

The available points for HUDs are:

  • top-left
  • top
  • top-right
  • bottom-left
  • bottom
  • bottom-right
  • center
  • center2

There are no left and no right attachment points, as of 2013-12-20.

However, nowadays we can use the "Add" function instead of "Wear", so we may have several HUD attachments in the same HUD attachment point, if the HUDs are designed to be placed in the same HUD slot.


FIRST COMMON QUESTIONS ABOUT HUD OBJECTS


One of the first questions that may pop into our minds is, Is there any restriction about what we can attach to a HUD?

And the answer is: NO.

We can attach even a castle if we feel in the mood.

Of course, the castles being as big as they are, they'll cover all the screen... But can we attach a big castle to the HUD? Yes, we can do it.

So yes, as long as what we want to attach is an object, there are no limits on what we can attach to HUD: From a jewelry nano bead to any other object, no matter the size or the contents (that this is useful or not, is a different matter.)

There are a few properties that HUD objects won't show: we'll discuss them later in the corresponding section of this class.

Do HUDs affect to lag in any specific manner?

No: If our HUD contains lots of 1024x1024 textures that change often, is heavily scripted, has many listeners, sensors, timers... It will be a laggy object, but if textures are kept to small resolution, the scripting is wise... We should not expect more lag from a HUD object than from the same object inworld.

Even more: since a HUD does not exist inworld, the server does not have to check about the possible collisions against it. So common sense applies here: design the textures (sizes) and the scripting wisely, and your HUD won't be a problem.


HOW DO I BUILD A HUD? ARE THERE ANY RESTRICTIONS?


One could wonder, have HUD objects any specific building requirement?

And the answer is NO: If you know how to build, you know how to build a HUD, as we're going to see now.

The only difference is this: If, after building our HUD, we need to add a new prim, or unlink a prim to delete it... That forces us to REZ the HUD inworld, add/unlink the prim, take it again back to inventory, and then attach.

Let's go over building one by doing a small practice.

So please, rez now a box.

In your "General" tab, name it, for example, "Test Box for HUD":


Texture the box with the blank texture.
Then make a SHIFT COPY by following the Y axis (the green arrow.)

Now for this new copy, select another color than white, just to distinguish them. I will tint mine dark red. Then, make this red one smaller, say, a 0.25 cube (it doesn't matter as long as it's smaller.)

Move the red inside the white like this, and link them:


Just this, it can be a HUD :-)

NOTE: a HUD can be even just *one* prim. One prim that has a very complicated texture with many options drawn could be a HUD :-)

The only limit for the number of prims a HUD can be made of are the SAME limits we have for the objects inworld: 256 linked primitives per object. That's the max of prims we can link, no matter the object is a HUD or not (Check here for the reference: http://wiki.secondlife.com/wiki/Limits#Building)

Ok, so do we have our "Test Box for HUD" object linked?

Take it back to inventory and look for it in the "Objects" system folder.

Now, right click over your object in inventory: this will open a menu.

Look for the "Attach To HUD" submenu and move your mouse over it.

When hovering on it, we see that the viewer offers us the EIGHT attachment points mentioned before, to select one.


Now, select CENTER for this one.
And yes, it's going to cover a lot of the screen :-)


You should have now something very similar to what the picture shows. The red box can be pointing to the same side, or the opposite. It's fine whichever side, don't worry about that :-)

Now that we have this huge thing on... Since it's possible that some of you don't know how to move a HUD object, let's learn that first.

Right click over the HUD object.
Select "Edit".
You see now that arrows appear in the center of the object, same way as when we edit objects inworld, right?


So moving the object in the HUD is done the same way we move an object inworld: we can drag the arrows and the object will move along that direction.

Notice this, though: The HUD is not 3D. The objects attached are 3D, yes, but what we see is a 2D projection of them. Still, we can move objects and ROTATE them in the HUD.

Now, let me explain something... (little side note)

Right after attaching the box in our HUD, the first we've all seen is the attack of a giant box in our HUDs. And the box was simply 0.5 meters inworld!

This leads to an obvious question: What's the size of the HUD display area?

Good and bad news: We can know only the vertical visible size of the HUD. There's no way to know the measure of the horizontal size.

The vertical size corresponds with the Z axis.
Including the menu bars of our SL window and the mottom menu options, the height of our HUD area is ALWAYS ONE METER, no matter the resolution of your screen/SL window size.

This is handy to know if, for example, you have to create a HUD that hides when the avatar goes into mouselook. Your script could change the Z of the HUD to, say, two meters, and the HUD would not be visible by the avatar.

So we have an horizontal, undefined width, and it moves along the Y axis. Then, positive values of Y are when we move from the center of our screen, which always has coordinates (0,0), to the left.

Then, we have the height of the visible area, which is always one meter, and it moves with the Z axis.

And what happens to X?

X measures how "sunk" is the HUD in the screen (although we'll see it always the same size.)

Changes in X may help us to the following: Design a HUD with several panels, they having different X. We know, now, that the ones with a lesser X will be hidden by the ones with a greater X, so a scripter could use this to swap panels.


Now, this is advice that comes from experience: Don't make your buttons to be thin :-)

As you can see in your test HUD now, we only see a 2D projection of our object, no matter how thick are the buttons. If we try now to resize the HUD (how? In a moment,) if our buttons were too thin, we'll quickly stumble against the 0.01 minimal size that SL allows for our prims, and we could not shrink our HUD much.

And since we know, now, that one meter inworld will fill all the vertical part of the screen, it's obvious that we're needing to shrink our HUDs quite a bit.

So let me quickly show an example here of what I mean with what we should NOT do when designing a HUD. I'm going to rez one HUD object I created. (Almost 2014 note: This HUD dates from 2010 =))

Please, zoom around.
Do you see that my buttons are NOT thin, but quite thick indeed?


(the buttons are even thicker... sunk in the main, black prim)

I don't care about the size that, anyway, won't be shown in the screen:


So why make them thin, and find myself stuck soon in a 0.01 problem?
I make them big.

Is there any recommended size to start with? I usually begin building at one meter (which will cover the whole vertical size,) then shrink once I attach in the HUD. Experience will tell you what works best for you.


I've said that the HUD screen area is one meter vertical, undefined, horizontal. But we have know, before editing things, that the total HUD area is quite bigger in fact. If we lose a sock, we may explore that area :o)

Let me explain what I mean.

Please, right click again in your HUD object, select edit.
And now, use the mouse wheel to zoom out.

NOTE: If you don't have mousewheel, you'll achieve the same by holding pressed ALT key, click with the left mouse button, and move the mouse backward.

Do you all see, as here, that it appears a white frame, and there's more space around?


That white frame delimits always the screen area. But yes, we can move objects further (and thus, make them disappear from our sight.)

When one loses a HUD, has to do this to get to the total HUD area: edit something else in the HUD so we can zoom out. Then find your object, click it, and move it back within the white area. (Unfortunately, what we can't do is zoom in MORE than the own HUD screen area.)

So, when we lose a sock, now we know how to look for it, yes? :o) (or when we WANT to lose a sock, where to send it)

It could be possible that we have no attached HUDs in the visible area, and we want to know if there's something out of the visible area. There's no way to zoom in the HUD unless we're editing something in the HUD, so this is a simple solution:

  • Rez a box
  • Take it
  • Attach it to HUD: Center

And now we for sure have something in the visible area to edit, to be able to zoom out in the HUD total area. Once we've found what we've lost, we can detach the box.

If you are in a place where you cannot rez, then you can try this (which might be quicker in many cases):

Check the "Worn Items" tab from the inventory window, and look for your HUD item there. If you don't find it there, then have a look at your "Marketplace" tab. Worn items from that tab do not show (yet?) under the "Worn Items" tab.

NOTE: When we close the edit window, we're closing the zoom-out in the HUD automatically, and will get again only the screen area, 1 meter height.

Now, how can we edit something that is in the HUD, once we've attached the object? Can we do the same edit options we do inworld?

Almost: remember what was said before... We CAN'T link/delink in the HUD: We have to rez first, then link, or delink, take the object back to inventory and attach it again to the HUD.

But apart from that...

Can we edit linked parts?
Yes.

Can we rotate the objects in HUD?
Yes.

Move them?
We've seen also that yes.

And do we rotate, scale, etc, the same way we do it inworld?
Again, yes.

It's very easy to check this: Please edit again your HUD. If you click now, in the edit window, the "Rotate" option, do you see that the wheels to rotate appear?


Rotate doesn't have handles, but wheels, don't forget!

Also, the keys keep working: holding CTRL in edit mode will make the rotating wheels to show up. And we can hold CTRL pressed, click over the wheel and rotate.

But I don't recommend this, for rotating, for a reason: The HUD is a 2D projection, and we can't zoom around it as we do with the 3D objects inworld. So if we're not specially careful using the wheels, most likely we'll rotate the pieces wrong.

What to do then?
Use the edit boxes for the rotation, in the "Edit" window.

But for size... If you want to resize the whole object at once, use the WHITE HANDLES that show when we click "Stretch", because if we type directly numbers in the edit boxes... This will resize ONLY the root prim, or the child prim we had selected.


Trying to resize a whole linkset typing numbers only changes the size of the selected prim: Inworld and in the HUD. If we aren't into "Edit linked parts", this is the root prim.

You can now detach the test HUD.

IMPORTANT: When you prepare a HUD for sale, make sure that you attach it to your HUD, move it to the position you want it, and then detach it, prior to pack it. Why this? Because it is when you detach the HUD when all the data related, including the position within the HUD, is saved. (This is true for any attachment, not only HUD objects.)


PROPERTIES THAT ARE NOT SUPPORTED IN HUD OBJECTS


Now that we're talking about what we can do in our HUDs... It's time to think about what we can't do in our HUD objects.

Yes, we've said that there are no building restrictions, meaning, we can attach any object to the HUD points, and we build them inworld, so same rules for the limit of child prims and others apply too.

But there are a few restrictions when working with HUD objects that we have to know about.

The first difference comes with sounds: If a sound is played using llPlaySound, in a HUD, only the person wearing the HUD listens it.

Also, sadly, particles usually won't work (they could in experimental viewers... but don't take this for granted! most of the people if not all, will not see them in the HUD object.)

Texture animation, sculpted prims and even TARGET OMEGA and flexi prims do work in a HUD object. Glow doesn't, but shininess does.

The hover text is supported BUT this is important: The text does NOT scale with the size of the HUD. If we make the HUD smaller, the hovertext will have the SAME size, so keep this in mind if your HUD is small :-)

The hover text sometimes may help you saving on textures, and it's also useful to display values that change often (like the ones that come from combat/RP HUD objects, with meters for several properties of our player.)

Shared media also works in HUDs, but since V2.2.

And don't forget this... A HUD object is an attachment, so, like any other attachment, if our HUD has a sensor active, it will not detect the avatar that has it attached.


A NOTE ABOUT HUD OBJECTS AND PERMISSIONS OF THE CONTENTS


When our HUD object is attached, the only assets we can drop in the "Content" tab are those that, for us, the owner, have FULL PERMISSIONS. If we have to drop any asset that has any restriction over the permissions *for us*, we'll have to REZ the HUD object inworld, drop the assets while it being inworld, and then take it back to our inventory. (That's why we have to rez our poses HUDs, for example, since we normally purchase them copy/no transfer.)

Be careful when you do this with NO COPY assets!

Make sure in this case that there are no notified problems that could affect to no copy items rezzed inworld. For this, you can check the grid status page.

A couple of related resources:



ADVICE WHEN YOUR HUD HAS TO BE SCRIPTED BY SOMEONE ELSE


Before finishing, I want to give one more suggestion, apart from all what we've said.

If we're the builders of the HUD, but then we have to contact with a scripter to make it work... It helps A LOT if you put names/descriptions in the prims that you want to be, either having an action on click, or that have to display information/textures.

What do I mean with this?
Again, let me look for an example to rez.

The HUD I'm going to show will also show another suggestion, in case you need to switch textures for on/off actions. In this case, the customer used the name field of the prims, for prims that were relevant when clicked.

Please, inspect this object.
Go into edit linked parts.
And click the prims.


Do you see that they have specific, unique names?

Why is it important to put names/descriptions to the prims?
Because each one of this buttons has a specific action, and they could be linked in any order.

Even if you're not a scripter, you should know that is better if a script does NOT rely on link numbers. If the script simply looks for specific names/descriptions, and retrieves the link numbers, that makes a scripter's life a lot easier AND should you unlink/relink your object, the script will (should) continue working THE SAME.

So do you all promise me that, from now on, you'll put names/descriptions in the prims you expect actions from, or information to be displayed? :-)

"Make a scripter happy... Use names/descriptions in the prims" :o)


Now, let me "break" this HUD a bit :-)
Look at this button. (The dagger button in the picture, which has been duplicated twice to show the side faces.)


It has, apart from the visible texture (the only we'll see when we attach the HUD), two more textures.

The two textures that should be used for on/off, each one at one side. The reason of doing this, is to have the textures preloaded, so your user doesn't wait for textures to load when switching on/off.

This is something I recommend doing: If you're building HUDs, and need to switch textures, have them in the sides of the buttons. They're not going to be seen anyway, because we only see the 2D projection. The rest is between the HUD and us :o)

(Make sure, though, of using small textures. For small HUD buttons, 128x128 pixels could be more than enough. Even 64x64 could be enough. 1024x1024 textures for small buttons... NO!)

Now, don't forget this: we can hollow and path cut boxes, so this makes up to 9 textures that we could apply in each face. One has to be always the texture that we show to the user: but that makes 9-1 = 8 textures that we can preload per button, should we need them.


MISCELLANEOUS QUESTIONS


QUESTION: Let's suppose that we want to rez a HUD to be able of link/delink, and turns out that the HUD contains a script that makes the HUD to be deleted if the object is rezzed instead of attached. What to do in that case, to be able to link/delink prims to the HUD object?

If the prims are copy/modify, and the script is copy at least, the following is a possibility:

  • Make a copy of your HUD object
  • Attach this copy
  • Delete the script that is making it to be deleted on rez
  • Detach the copy, rez inworld and work with it
  • Attach it again and add the copy of the script that you deleted, in order to be able to rez and work with it

Alternatively, go to a region where scripts are deactivated. (IMPORTANT: If you do this, make sure you're no higher than 50 meters above the mesh terrain, otherwise, scripts WILL be active.)

If the prims are no modify, you would not be able to link/delink anyway. In that case you can contact the creator to see if they can make the specific variation you want for the HUD object.


QUESTION: If particles can't be shown in the HUD... How could we create a HUD to make particles effects?

For that, your HUD object has to communicate via llWhisper/llSay/llShout/llRegionSay with an emitter inworld, that should receive the parameters, process them, and generate the corresponding particles effect.


QUESTION: Is it advisable to speak with the scripter before building the actual HUD?

Yes, always. Creating a HUD is a team work, so this previous dialog should happen to avoid later changes in the specifications (which can drive mad the scripter, since at times, a change in the specification could mean to have to redesign the whole scripting.)


And this is all for this class. I hope you come away with new knowledge.

-- Auryn Beorn