CHAPTER 1
CHAPTER 2
CHAPTER 3
CHAPTER 4
CHAPTER 5
CHAPTER 6
CHAPTER 7
CHAPTER 9
CHAPTER 11
CHAPTER 12
CHAPTER 13
CHAPTER 14
CHAPTER 15
APPENDIC
E
S
241
CHAPTER 10
default
{
state_entry() {
mySnowStorm();
}
touch_start(integer i) {
mySnowStorm(); // touch to reset/turn on the particles
}
}
Unlike in the real world, not every snowflake in SL is unique. Each particle emitter can support only one
texture. If you want variation in your flakes, make several emitters, each with a different texture, and place
them a few meters apart from one another. Figure 10.5 shows the results of using three different emitters.
Figure 10.5: Three snowflake textures are used in this set of
particle emitters.
You can augment this script by testing for cloud density using llCloud(). If the clouds are thick, turn
on the snow. Going back to our earlier discussion of sunlight and shadows, you can also use this function to
control how dark shadows are (more cloud density means less sunshine and therefore less shadow).
llCloud(vector offset)
Returns a float that is the cloud density (0.0 to 1.0) at the object position, plus offset.
DEFINITION
Care to make your snow flurry more realistic? Have snowdrifts accumulate (grow) in corners when it's
snowing, and melt (shrink, with watery particle effects) when it's not. If you're making a thunderstorm, SL
has a built-in thunder sound that would be great (look for the key on the wiki page Internal_sounds).
SUMMARY
Manipulating time and weather are extremely useful techniques for creating an environment. An important
part of an environment's ambience is the sounds you hear: bird noises, wind chimes, loud engines, and so
on. The next chapter covers sound, but the ideas in this chapter help you make it interesting: make your
sounds change or depend on things such as time of day, season, or what an object can sense.

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.