CHAPTER 2
64
MOVING
YOUR AVATAR
AROUND THE
WORLD
ATTACHMENTS
ANIMATION
CONTROLLING
YOUR
ATTACHMENTS
SUMMARY
CONTROLLING YOUR ATTACHMENTS
This chapter is full of neat toys...that could get extremely annoying in the wrong situations. Therefore, most
good-quality builds provide a way to turn the effects on and off. One way to do this is with a simple HUD.
HUDs are scripted objects that attach to "HUD points"essentially the user's screeninstead of points
on the avatar that are visible to others, as shown in Figure 2.10.
Figure 2.10: A floating avatar with
a green HUD button showing that
the "yoga_float" animation is
enabled.
As you learned earlier, attachments are any objects your avatar wears, whether on the body or as a
HUD and animation overrides (AOs) are sequences of internal commands that change the way your avatar
moves. When you run an AO, the script asks your avatar permission to trigger the animation. While AOs
do not need to be placed in attachments, they often are. In this case, the permissions are granted implicitly.
If you want to be able to control details of the attachment—for example to turn on the face light, to
allow friends to wind up your key, or to float instead of walk—you can either create a chat interface for
commands (as shown in Chapter 3) or create a HUD.
If you want to control an object that is not part of the HUD, you will probably want to add
communication between the controller on the HUD (invisible to others) and the object you want to wear
or otherwise have visible in the world. Chapter 3 talks about how to make this communication happen.
Listing 2.12 shows a modification to the WalkAO script from Listing 2.10. To make it work, put it in a
box that you've sized to <0.2, 0.2, 0.2>. Instead of "wearing" it, attach it to your HUD at the bottom-left
point. You'll see it on the lower-left corner of your SL screen, just above the communication buttons
other users will not be able to see it. It turns red when not enabled, and green when enabled. The bowling
project on the SYW website demonstrates another example of a HUD.

Get Scripting Your World: The Official Guide to Second Life® Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.