User:Becky Pippen/RuthCloudScript

From Second Life Wiki
< User:Becky Pippen
Revision as of 17:09, 13 February 2011 by Becky Pippen (talk | contribs) (Yet Another version of a Ruth Cloud LSL script.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Ruth Cloud

Just for giggles, here are the secret parameter settings used to make a Ruth Cloud. There was already a copy of a Ruth Particle Cloud script on the wiki, but this version corrects one minor error in one parameter, and adds a scaling factor that you can change to make the cloud larger or smaller than normal. Just copy and paste this into a script and drop it into any prim to make a Ruth Cloud. Touch to turn on and off. See the comments in the script for more information.

Are you tired of being a Ruth Cloud? See this article for some suggestions.

<lsl> // This is the default Ruth cloud. The particle parameters were extracted from the viewer source file

// indra/slbrowser/newview/llvoavatar.cpp, in function void LLVOAvatar::idleUpdateLoadingEffect(),
// (near line 2856 in version 1.23.4). The original viewer source code comment is:
//
//           // fancy particle cloud designed by Brent
//
// referring to Brent Linden. Thanks Brent, they're cute! Now... just make them go away, ok? :-)

// This script was concocted, formulated, and priminized by ❤ Becky Pippen ❤

// Set the scale of the Ruth cloud here. A scale of 1.0 makes a normal sized
// cloud; 0.5 makes one half as high and wide as normal; 2.0 makes one twice as
// wide and high as normal. The maximum scale is 4.0, because that makes the
// particles the maximum size allowed by the SL particle system.
//
float Scale = 4.0;  // must be in the range (0.0..4.0]


integer ItIsCloudy;
list RuthCloudUnscaledParameters;


default
{
    on_rez(integer param)
    {
        if (Scale <= 0.0 || Scale > 4.0) {
            llSay(0, "Oops! Please edit this script and change the variable named\n" +
                     "Scale to a number above 0.0, and no greater than 4.0.");
        } else {
            if (llGetPos() == llGetLocalPos()) {
                // We're in a single prim, or root prim, and not in an attachment,
                // so adjust our height a little based on the scale of the Ruth Cloud
                // so that the cloud won't be half underground: (Comment out this
                // line if you don't want that):

                llSetPos(llGetPos() + <0.0, 0.0, Scale / 2.0>);
            }
        }
    }

    state_entry()
    {
        integer flags = PSYS_PART_INTERP_COLOR_MASK | 
                        PSYS_PART_INTERP_SCALE_MASK |
                        PSYS_PART_EMISSIVE_MASK |
                        PSYS_PART_FOLLOW_SRC_MASK |
                        PSYS_PART_TARGET_POS_MASK;

        RuthCloudUnscaledParameters = [
            PSYS_PART_FLAGS, flags,
            PSYS_PART_MAX_AGE, 4.0,                  // particle age (yes, 4, not 3)
            PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,   // major mode
            PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,  // starting particle color
            PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,    // final color (<1,1,1>=white)
            PSYS_PART_START_ALPHA, 0.5,              // beginning alpha (1.0=opaque)
            PSYS_PART_END_ALPHA, 0.0,                // final alpha (0.0=clear)
            PSYS_SRC_TEXTURE, "f525c30a-1bde-c858-a907-3d4df5e736a7", // cloud-particle.j2c
            PSYS_SRC_BURST_RATE, 0.02,               // burst interval
            PSYS_SRC_BURST_PART_COUNT, 1,            // particle count per burst
            PSYS_SRC_BURST_RADIUS, 0.0,              // burst radius
            PSYS_SRC_MAX_AGE, 0.0,                   // overall duration
            PSYS_SRC_ANGLE_BEGIN, 3.14159,           // starting angle 180°
            PSYS_SRC_ANGLE_END, 0.0                  // ending angle
        ];
    }

    touch_start(integer num)
    {
        ItIsCloudy = !ItIsCloudy;

        if (ItIsCloudy) {
            llParticleSystem(RuthCloudUnscaledParameters + [
                    PSYS_SRC_BURST_SPEED_MAX, Scale,
                    PSYS_SRC_BURST_SPEED_MIN, Scale * 0.1,
                    PSYS_PART_START_SCALE,    Scale * <0.8, 1.0, 0.0>,
                    PSYS_PART_END_SCALE,      Scale * <0.02, 0.02, 0.0> ]);
        } else {
            llParticleSystem([]);
        }
    }
}</lsl>