Jump to content

Rain proof roof


Isobeast
 Share

You are about to reply to a thread that has been inactive for 956 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey! how to make so that snow or rain particles do not pass through the roof of the house?

 

I will add. You can, of course, just install the emitter at a sufficient distance, but I came across some overlays that do not allow particles to pass ... (or it seemed to me...)

 

 

is it generally possible and I'm wondering how it works?

Edited by Isobeast
Link to comment
Share on other sites

Unfortunately to my knowledge of the llParticleSystem, there is no way for a particle to detect collisions or die on collisions.

 

Although this doesn't entirely render LSL Particle Physics useless as you can (if you have access to the full script) change particle life time rates and have lower values in script objects that are over a roof for example, having the longer life time rates around the roof object.

 

This however is my knowledge on things from using the particle system going back years and years ago, although doesn't seem like they have done much to the particle system since.

 

You could also look at using PSYS_PART_BOUNCE_MASK although this can have strange actual bouncing effects and I'm not expert on particles entirely.

Which is why I tend to use particle huds to help me design particles.

  • Like 1
Link to comment
Share on other sites

The only thing I've seen that works how you describe is the snow system from Studio Skye. I've not looked at it in any detail, but it uses mesh objects rather than particles. Whether this mesh consists of individual or groups of snowflakes, or faces with snow textures, I don't know. Certainly by using objects you can control where they go, or don't go, with precision.

  • Like 2
Link to comment
Share on other sites

1 hour ago, Isobeast said:

Hey! how to make so that snow or rain particles do not pass through the roof of the house?

With the SL particle system .. you can't. Sure you can try and make particles die just as they hit the roof or have them bounce, but that hack only works if you live in a literal box.

Systems that rez and rain actual mesh from the sky are bad. Super bad. So bad the creators should be deeply ashamed.

Plan B ..

  1. Don't care. Have the particles fall right to the ground, right though the house.
  2. Empty out the inside of the house, strip it bare, walls, floors, stairs,. Ditch everything you can't see from outside. Everything.
  3. Place a second copy of the house up in the sky, remove any unnecessary outside details, and decorate.
  4. Link the two by teleporting a user who clicks on the outside door to the inside of the house in the sky (and vice versa).

This is the lowest lag way to do buildings as the viewer wont be downloading/rendering stuff they cant see, and provides privacy between inside and outside spaces.

  • Like 1
Link to comment
Share on other sites

As others have said, there's no way to block particles.

I built a rain/snow emitter that I place around the houses I occupy. Each emitter produces a sheet of particles exactly as thick as the particle size. I place emitters around the house as needed, so the particles are visible through the windows, but never enter the house. If the house has front/back yards, I might stack up more emitters there. The particle textures each contain many snowflakes/raindrops, so the total particle emission rate needn't be terrifically high. I've yet to need more than five emitters to create a passable experience. From inside the house, it's perfect. I use a sensor to detect nearby avatars. If there are none, the emitters turn off.

  • Like 2
Link to comment
Share on other sites

11 hours ago, Coffee Pancake said:

Systems that rez and rain actual mesh from the sky are bad. Super bad. So bad the creators should be deeply ashamed.

If your list of shameful practices gets any bigger, either your head is going to explode or you're going to have a stack=heap collision :)

  • Like 1
  • Haha 1
Link to comment
Share on other sites

7 hours ago, Profaitchikenz Haiku said:

If your list of shameful practices gets any bigger, either your head is going to explode or you're going to have a stack=heap collision :)

I'm pretty much on board with all of Coffee's pet hates around creators abuse of the grid.. So she can use MY "list" as a pagefile anytime she likes.

  • Like 1
  • Haha 1
Link to comment
Share on other sites

24 minutes ago, Sam1 Bellisserian said:
Quote

“The Roof comes with a script that talks to the precipitation emitter and calculates the distance between the emitter and the Roof. It then communicates to the emitter overhead to adjust the lifespan of the rain or snow particle so that it does not rain/snow below the roof. The script can be dropped into your own building roof as well.”

Soo, if your roof is not flat, either the rain won't hit the shingles, or it will pass through the attic.

At least it's not a temp-prim rezzer. . .

  • Like 2
Link to comment
Share on other sites

I quickly set up a snow cabin with my snow system around it, for anyone who wants to see what it looks like. I've rented the place for a week, after which I'll probably abandon it. There are four emitters, one along each of the cabin's three windowed walls and a second in the front yard. The particles are full bright, if you set "midnight" it'll be much easier to see the outlines of the emission patterns. If it doesn't start snowing shortly after you arrive, touch the black box that's tucked in the lower left corner of the bay window behind the sofa. That will toggle the snow system on and off. That system was stripped to the bare minimum. I have emitters that can do rain as well, and a relay that accepts chat commands to control all the emitters. If anyone is interested, I can probably dig through inventory and find the stuff. It's been about a decade since I designed the system.

http://maps.secondlife.com/secondlife/AtomicA/85/135/3651

ETA: That's a rez-on-arrival place, so you might have to wait a few seconds for the snow cabin to assemble itself when you arrive.

Edited by Madelaine McMasters
  • Thanks 1
Link to comment
Share on other sites

AM Radio once had a desolate, snow covered region called "The Quiet", which had snow made of animated textures on megaprim sheets gridded across the area. It was a pretty convincing system that did not snow inside the little cabin, but seemed to snow on it. It was just a matter of carefully locating the megaprims. Rain could work the same way.

Edited by Madelaine McMasters
  • Like 1
Link to comment
Share on other sites

On 10/14/2021 at 6:57 PM, Isobeast said:

I am very interested! Please!

Go visit the LM I posted and set midnight, to get a sense for what the system looks like. Give me a few days (I'm not in world much) to find the more capable system that also does rain. It was a quick hack, done years ago, and is certainly ripe for improvement.

Edited by Madelaine McMasters
  • Thanks 1
Link to comment
Share on other sites

52 minutes ago, Madelaine McMasters said:

Go visit the LM I posted and set midnight, to get a sense for what the system looks like. Give me a few days (I'm not in world much) to find the more capable system that also does rain. It was a quick hack, done years ago, and is certainly ripe for improvement.

Really looks very nice!

Untitled.png

  • Thanks 2
Link to comment
Share on other sites

On 10/13/2021 at 1:28 AM, KT Kingsley said:

The only thing I've seen that works how you describe is the snow system from Studio Skye. I've not looked at it in any detail, but it uses mesh objects rather than particles. Whether this mesh consists of individual or groups of snowflakes, or faces with snow textures, I don't know. Certainly by using objects you can control where they go, or don't go, with precision.

I guess it would be possible to make your own particle system with the magical use of physics and physic functions to create the behaviour while setting the objects as temporary so they don't count to prim limits... but never done anything like it and not sure how it would come out.

Bare in mind, each particle object would need a script within for collision_start

  • Like 1
Link to comment
Share on other sites

6 hours ago, 0xLillithx0 said:

I guess it would be possible to make your own particle system with the magical use of physics and physic functions to create the behaviour while setting the objects as temporary so they don't count to prim limits... but never done anything like it and not sure how it would come out.

Bare in mind, each particle object would need a script within for collision_start

It comes out fairly well, most of the physics stuff you can do via the editor rather than script, although the defaults are plenty good in this case.

integer isOn;
float intervalTimer = 0.044; // lower for more droplets

string nameDroplet;

integer nDroplets=10;

vector scale = <3.0,3.0, 0.25>; // how wide an area to cover with droplets
default
{
    state_entry()
    {
        nameDroplet = llGetInventoryName(INVENTORY_OBJECT,0);
    }

    touch_start(integer total_number)
    {
        isOn=!isOn;
        llSetTimerEvent(isOn*intervalTimer);
    }
    timer()
    {
        vector pos = llGetPos() ;
        integer index = nDroplets;
        while(~--index)
        {
            vector rand;
            rand.x = llFrand(scale.x);
            rand.y = llFrand(scale.y);
            rand.z = llFrand(scale.z);
            rand = rand - scale*0.5;
            llRezAtRoot(nameDroplet, pos+rand,ZERO_VECTOR,ZERO_ROTATION,0);
        }
    }
}

set it phantom and a physical temporary water droplet to its inventory.

Edited by Quistess Alpha
  • Like 1
Link to comment
Share on other sites

Okay, here are the rain/snow textures and the script for the particle emitter (name them "snow" and "rain"). I will make this all available in-world shortly if you don't want to go through the hassle and cost of uploading all the bits.

The textures below are white on transparent backgrounds, so you can't see them, but if you click in the blank white spaces below, you'll catch them. Rez a cube on the ground and drop the script and textures into it. Type "/33 rain" or "/33 snow" to get rain or snow. Type "/33 hide" to make the cube invisible and "/33 show" to make it reappear. The particles are emitted upward in an fan shaped arc 15m above the ground and immediately start falling. They'll vanish a few meters below the cube, so could be used in a skybox if there's nobody right under you. The particles are 4m wide, so the sheet of rain/snow will be that thick and about 30m wide.

It's easiest to see the emission pattern at "midnight" as the textures are set to full bright (emissive mask = TRUE).

In my homes, I place the emitters just over 2m away from the outside walls, turned so the sheet is parallel to the wall. If I have a yard, I'll set a second emitter at the edge of it so I still see rain or snow if I walk outside.

If you want a taller sheet of particles, increase the emitter RADIUS. You'll also have to increase the particle AGEs to make sure they survive the longer fall. If you want a wider spread, increase ANGLE_BEGIN. There might have been a good reason I chose PI/7, probably to avoid the top of the sheet looking too curved.

In the next day or two, I'll post the script for a central controller that senses nearby avatars and starts any emitters in the region when there's someone present and stops them when nobody's there. I implemented this to reduce annoyance to others when I'm not around.

snow:

snow.png.ecff421c59df12439d0e7ac0dba93f54.png

rain:

rain.png.b932cb7dc5e4ff6da98e81a39d7f2db5.png

Script:

integer chan = 33;
integer listen_handle;

mySetParticles(string kind) {
    
    string TEXTURE;
    float AGE;
    float RATE;
    integer COUNT;
    vector ACCEL;
    float  SPEED_MIN;
    float  SPEED_MAX;
    float  END_ALPHA;
    
    if(kind == "rain"){
        TEXTURE = "rain";
        AGE = 10;
        RATE = 0.03;
        COUNT = 3;
        SPEED_MIN = 3;
        SPEED_MAX = 3;
        ACCEL = < 0.00, 0.00, -1.0 >;
        END_ALPHA = 1.0;
    }
    else if(kind == "snow"){
        TEXTURE = "snow";
        AGE = 20;
        RATE = 0.05;
        COUNT = 1;
        SPEED_MIN = .01;
        SPEED_MAX = 1;
        ACCEL = < 0.00, 0.00, -.1 >;
        END_ALPHA = 1;
    }
    else return;

    vector  START_SCALE = < 4, 4, 0 >;
    vector  END_SCALE = < 4, 4, 0 >;
    vector  START_COLOR = < 1, 1, 1 >;
    vector  END_COLOR = < 1, 1, 1 >;
    float   START_ALPHA = 0.0;
    integer INTERP_COLOR = TRUE;
    integer INTERP_SCALE = TRUE;
    integer EMISSIVE = TRUE; // this makes rain/show much more visible
    

    integer PATTERN = PSYS_SRC_PATTERN_ANGLE;
    float   RADIUS = 15; // 0.00
    float   ANGLE_BEGIN = PI/7; // 0.00
    float   ANGLE_END = 0.0; // 0.00
    vector  OMEGA = < 0.0, 0.0, 0.00 >; // < 0.00, 0.00, 0.00 >
    float   LIFE = 0;  // 0.0

    integer      FOLLOW_SRC = FALSE;
    integer FOLLOW_VELOCITY = TRUE;
    integer            WIND = FALSE;
    integer          BOUNCE = FALSE; 
    integer      TARGET_POS = FALSE;
    key              TARGET = llGetKey();
                     
    list particle_parameters = [
            PSYS_PART_FLAGS, ( 
                (        EMISSIVE * PSYS_PART_EMISSIVE_MASK ) | 
                (          BOUNCE * PSYS_PART_BOUNCE_MASK ) | 
                (    INTERP_COLOR * PSYS_PART_INTERP_COLOR_MASK ) | 
                (    INTERP_SCALE * PSYS_PART_INTERP_SCALE_MASK ) | 
                (            WIND * PSYS_PART_WIND_MASK ) | 
                (      FOLLOW_SRC * PSYS_PART_FOLLOW_SRC_MASK ) | 
                ( FOLLOW_VELOCITY * PSYS_PART_FOLLOW_VELOCITY_MASK ) | 
                (      TARGET_POS * PSYS_PART_TARGET_POS_MASK ) ),
            PSYS_PART_START_COLOR,     START_COLOR,
            PSYS_PART_END_COLOR,       END_COLOR,
            PSYS_PART_START_ALPHA,     START_ALPHA,
            PSYS_PART_END_ALPHA,       END_ALPHA,
            PSYS_PART_START_SCALE,     START_SCALE,
            PSYS_PART_END_SCALE,       END_SCALE, 
            PSYS_SRC_PATTERN,          PATTERN,
            PSYS_SRC_BURST_PART_COUNT, COUNT,
            PSYS_SRC_BURST_RATE,       RATE,
            PSYS_PART_MAX_AGE,         AGE,
            PSYS_SRC_ACCEL,            ACCEL,
            PSYS_SRC_BURST_RADIUS,     RADIUS,
            PSYS_SRC_BURST_SPEED_MIN,  SPEED_MIN,
            PSYS_SRC_BURST_SPEED_MAX,  SPEED_MAX,
            PSYS_SRC_TARGET_KEY,       TARGET,
            PSYS_SRC_ANGLE_BEGIN,      ANGLE_BEGIN, 
            PSYS_SRC_ANGLE_END,        ANGLE_END,
            PSYS_SRC_OMEGA,            OMEGA,
            PSYS_SRC_MAX_AGE,          LIFE,
            PSYS_SRC_TEXTURE,          TEXTURE
        ];
        
    llParticleSystem( particle_parameters );
    if ( (AGE/RATE)*COUNT > 4096) {
        llOwnerSay( "Too many particles, decrease AGE and/or COUNT and/or increase RATE.");
    }
}

default{
    
    on_rez(integer param){
        llResetScript();
    }
    
    state_entry() {
        listen_handle = llListen(chan, "", NULL_KEY, "");
        llOwnerSay("Weather System Starting");
    }
    
    listen( integer channel, string name, key id, string message ){
        if(message=="rain" || message == "snow"){
            mySetParticles(message);
        }
        else if(message=="off"){
            llParticleSystem([]);
        }
        else if(message=="hide"){
            llSetAlpha(0,ALL_SIDES);
        }
        else if (message=="show"){
            llSetAlpha(1,ALL_SIDES);
        }
    }
}

 

Edited by Madelaine McMasters
  • Like 1
  • Thanks 3
Link to comment
Share on other sites

On 10/22/2021 at 7:59 AM, Madelaine McMasters said:

Okay, here are the rain/snow textures and the script for the particle emitter (name them "snow" and "rain"). I will make this all available in-world shortly if you don't want to go through the hassle and cost of uploading all the bits.

The textures below are white on transparent backgrounds, so you can't see them, but if you click in the blank white spaces below, you'll catch them. Rez a cube on the ground and drop the script and textures into it. Type "/33 rain" or "/33 snow" to get rain or snow. Type "/33 hide" to make the cube invisible and "/33 show" to make it reappear. The particles are emitted upward in an fan shaped arc 15m above the ground and immediately start falling. They'll vanish a few meters below the cube, so could be used in a skybox if there's nobody right under you. The particles are 4m wide, so the sheet of rain/snow will be that thick and about 30m wide.

It's easiest to see the emission pattern at "midnight" as the textures are set to full bright (emissive mask = TRUE).

In my homes, I place the emitters just over 2m away from the outside walls, turned so the sheet is parallel to the wall. If I have a yard, I'll set a second emitter at the edge of it so I still see rain or snow if I walk outside.

If you want a taller sheet of particles, increase the emitter RADIUS. You'll also have to increase the particle AGEs to make sure they survive the longer fall. If you want a wider spread, increase ANGLE_BEGIN. There might have been a good reason I chose PI/7, probably to avoid the top of the sheet looking too curved.

In the next day or two, I'll post the script for a central controller that senses nearby avatars and starts any emitters in the region when there's someone present and stops them when nobody's there. I implemented this to reduce annoyance to others when I'm not around.

snow:

snow.png.ecff421c59df12439d0e7ac0dba93f54.png

rain:

rain.png.b932cb7dc5e4ff6da98e81a39d7f2db5.png

Script:

integer chan = 33;
integer listen_handle;

mySetParticles(string kind) {
    
    string TEXTURE;
    float AGE;
    float RATE;
    integer COUNT;
    vector ACCEL;
    float  SPEED_MIN;
    float  SPEED_MAX;
    float  END_ALPHA;
    
    if(kind == "rain"){
        TEXTURE = "rain";
        AGE = 10;
        RATE = 0.03;
        COUNT = 3;
        SPEED_MIN = 3;
        SPEED_MAX = 3;
        ACCEL = < 0.00, 0.00, -1.0 >;
        END_ALPHA = 1.0;
    }
    else if(kind == "snow"){
        TEXTURE = "snow";
        AGE = 20;
        RATE = 0.05;
        COUNT = 1;
        SPEED_MIN = .01;
        SPEED_MAX = 1;
        ACCEL = < 0.00, 0.00, -.1 >;
        END_ALPHA = 1;
    }
    else return;

    vector  START_SCALE = < 4, 4, 0 >;
    vector  END_SCALE = < 4, 4, 0 >;
    vector  START_COLOR = < 1, 1, 1 >;
    vector  END_COLOR = < 1, 1, 1 >;
    float   START_ALPHA = 0.0;
    integer INTERP_COLOR = TRUE;
    integer INTERP_SCALE = TRUE;
    integer EMISSIVE = TRUE; // this makes rain/show much more visible
    

    integer PATTERN = PSYS_SRC_PATTERN_ANGLE;
    float   RADIUS = 15; // 0.00
    float   ANGLE_BEGIN = PI/7; // 0.00
    float   ANGLE_END = 0.0; // 0.00
    vector  OMEGA = < 0.0, 0.0, 0.00 >; // < 0.00, 0.00, 0.00 >
    float   LIFE = 0;  // 0.0

    integer      FOLLOW_SRC = FALSE;
    integer FOLLOW_VELOCITY = TRUE;
    integer            WIND = FALSE;
    integer          BOUNCE = FALSE; 
    integer      TARGET_POS = FALSE;
    key              TARGET = llGetKey();
                     
    list particle_parameters = [
            PSYS_PART_FLAGS, ( 
                (        EMISSIVE * PSYS_PART_EMISSIVE_MASK ) | 
                (          BOUNCE * PSYS_PART_BOUNCE_MASK ) | 
                (    INTERP_COLOR * PSYS_PART_INTERP_COLOR_MASK ) | 
                (    INTERP_SCALE * PSYS_PART_INTERP_SCALE_MASK ) | 
                (            WIND * PSYS_PART_WIND_MASK ) | 
                (      FOLLOW_SRC * PSYS_PART_FOLLOW_SRC_MASK ) | 
                ( FOLLOW_VELOCITY * PSYS_PART_FOLLOW_VELOCITY_MASK ) | 
                (      TARGET_POS * PSYS_PART_TARGET_POS_MASK ) ),
            PSYS_PART_START_COLOR,     START_COLOR,
            PSYS_PART_END_COLOR,       END_COLOR,
            PSYS_PART_START_ALPHA,     START_ALPHA,
            PSYS_PART_END_ALPHA,       END_ALPHA,
            PSYS_PART_START_SCALE,     START_SCALE,
            PSYS_PART_END_SCALE,       END_SCALE, 
            PSYS_SRC_PATTERN,          PATTERN,
            PSYS_SRC_BURST_PART_COUNT, COUNT,
            PSYS_SRC_BURST_RATE,       RATE,
            PSYS_PART_MAX_AGE,         AGE,
            PSYS_SRC_ACCEL,            ACCEL,
            PSYS_SRC_BURST_RADIUS,     RADIUS,
            PSYS_SRC_BURST_SPEED_MIN,  SPEED_MIN,
            PSYS_SRC_BURST_SPEED_MAX,  SPEED_MAX,
            PSYS_SRC_TARGET_KEY,       TARGET,
            PSYS_SRC_ANGLE_BEGIN,      ANGLE_BEGIN, 
            PSYS_SRC_ANGLE_END,        ANGLE_END,
            PSYS_SRC_OMEGA,            OMEGA,
            PSYS_SRC_MAX_AGE,          LIFE,
            PSYS_SRC_TEXTURE,          TEXTURE
        ];
        
    llParticleSystem( particle_parameters );
    if ( (AGE/RATE)*COUNT > 4096) {
        llOwnerSay( "Too many particles, decrease AGE and/or COUNT and/or increase RATE.");
    }
}

default{
    
    on_rez(integer param){
        llResetScript();
    }
    
    state_entry() {
        listen_handle = llListen(chan, "", NULL_KEY, "");
        llOwnerSay("Weather System Starting");
    }
    
    listen( integer channel, string name, key id, string message ){
        if(message=="rain" || message == "snow"){
            mySetParticles(message);
        }
        else if(message=="off"){
            llParticleSystem([]);
        }
        else if(message=="hide"){
            llSetAlpha(0,ALL_SIDES);
        }
        else if (message=="show"){
            llSetAlpha(1,ALL_SIDES);
        }
    }
}

 

Many thanks! Just tried your script, it's perfect!
It was such a rainy day, very impressive! :)

 

Snapshot_007.png

Link to comment
Share on other sites

Okay, here's the control panel for the weather system. Apply the texture to a cube, resize it to taste, and drop the script inside. I recommend making the cube three times higher than it is wide and/or deep. You can squish it flat or bury it in a wall to hide unwanted faces. You can also make unwanted faces transparent. Though you won't see them, they'll still respond to touch.

857672013_WeatherControlPanel.jpg.cbaf7dafe7cbfbfceed04f797fbf11a9.jpg

Touching the raindrop button will start any weather emitters in the region, using the rain texture and its associated particle parameters.
Touching the snowflake button will start any weather emitters in the region, using the snow texture and its associated particle parameters.
Touching the power button will stop any weather emitters in the region.
 

Here's the script:

integer channel = 33; //Using a positive channel number allows control via chat commands, but is less secure.

//These two constant factors are used to scale the returned touch position such that they can be used as indices.
//This is a single column interface, so "numberofColumns" isn't really needed.
//I've kept it to allow easy expansion of the interface to more buttons.
integer numberOfColumns = 1;
integer numberOfRows    = 3;

integer scanTime = 10; // Look for avatars within sensorRange every scanTime seconds.
integer sensorRange = 60; // Anyone within this distance (in meters) of the control panel will trigger the weather system.

string weather; // This string holds the desired state of the weather system, when enabled by nearby avatars.
 
doWeather(){
    llRegionSay(channel, weather);
//    llOwnerSay(weather);
}

default
{
    state_entry(){
        weather="off";
        llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, sensorRange, PI, scanTime);
    }
    
    sensor(integer num_detected){ // There's someone nearby to see the weather, so make some.
        doWeather();
    }
    
    no_sensor(){	// There's nobody nearby to see the weather, turn it off to avoid bothering others.
        if(weather != "off");
        llRegionSay(channel, "off");
    }
    
    touch_start(integer total_number)
    {
        vector  touchST     = llDetectedTouchST(0);
 
//      touchST.x goes from 0->1 across the face from the left to the right
//      touchST.y goes from 0->1 up the face from the bottom to the top
 
        integer columnIndex = (integer) (touchST.x * numberOfColumns);
        integer rowIndex    = (integer) (touchST.y * numberOfRows);
 
//        llOwnerSay("ST grid (" + (string)columnIndex + ", " + (string)rowIndex+")");
                            
        if(columnIndex==0){ // Not needed for this single column control panel
            if(rowIndex==0){
                weather="off";
            }
            else if(rowIndex==1){
                weather="snow";
            }
            else if(rowIndex==2){
                weather="rain";
            }
            doWeather();
        } // Not needed for this single column control panel
    }
}

Rather than place these things out on the lawn in front of my snow cabin, which is only a temporary rental, I'll send them to anyone who asks for copies.

Remember, this is a quick hack. There's probably a better way to do it. I could see adding a few more commands to set parameters like RADIUS and AGE in the particle emitters, so you could adjust them to your liking without having to dig into each and every emitter's script. You'd place the parameters in the control panel and message them out to the emitters.

ETA: I've added comments and the "scanTime" variable to the script, to improve readability and comprehension. Hopefully it still compiles!

Edited by Madelaine McMasters
  • Thanks 1
Link to comment
Share on other sites

On 10/24/2021 at 5:35 PM, Madelaine McMasters said:

Okay, here's the control panel for the weather system. Apply the texture to a cube, resize it to taste, and drop the script inside. I recommend making the cube three times higher than it is wide and/or deep. You can squish it flat or bury it in a wall to hide unwanted faces. You can also make unwanted faces transparent. Though you won't see them, they'll still respond to touch.

857672013_WeatherControlPanel.jpg.cbaf7dafe7cbfbfceed04f797fbf11a9.jpg

Touching the raindrop button will start any weather emitters in the region, using the rain texture and its associated particle parameters.
Touching the snowflake button will start any weather emitters in the region, using the snow texture and its associated particle parameters.
Touching the power button will stop any weather emitters in the region.
 

Here's the script:

integer channel = 33; //Using a positive channel number allows control via chat commands, but is less secure.

//These two constant factors are used to scale the returned touch position such that they can be used as indices.
//This is a single column interface, so "numberofColumns" isn't really needed.
//I've kept it to allow easy expansion of the interface to more buttons.
integer numberOfColumns = 1;
integer numberOfRows    = 3;

integer scanTime = 10; // Look for avatars within sensorRange every scanTime seconds.
integer sensorRange = 60; // Anyone within this distance (in meters) of the control panel will trigger the weather system.

string weather; // This string holds the desired state of the weather system, when enabled by nearby avatars.
 
doWeather(){
    llRegionSay(channel, weather);
//    llOwnerSay(weather);
}

default
{
    state_entry(){
        weather="off";
        llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, sensorRange, PI, scanTime);
    }
    
    sensor(integer num_detected){ // There's someone nearby to see the weather, so make some.
        doWeather();
    }
    
    no_sensor(){	// There's nobody nearby to see the weather, turn it off to avoid bothering others.
        if(weather != "off");
        llRegionSay(channel, "off");
    }
    
    touch_start(integer total_number)
    {
        vector  touchST     = llDetectedTouchST(0);
 
//      touchST.x goes from 0->1 across the face from the left to the right
//      touchST.y goes from 0->1 up the face from the bottom to the top
 
        integer columnIndex = (integer) (touchST.x * numberOfColumns);
        integer rowIndex    = (integer) (touchST.y * numberOfRows);
 
//        llOwnerSay("ST grid (" + (string)columnIndex + ", " + (string)rowIndex+")");
                            
        if(columnIndex==0){ // Not needed for this single column control panel
            if(rowIndex==0){
                weather="off";
            }
            else if(rowIndex==1){
                weather="snow";
            }
            else if(rowIndex==2){
                weather="rain";
            }
            doWeather();
        } // Not needed for this single column control panel
    }
}

Rather than place these things out on the lawn in front of my snow cabin, which is only a temporary rental, I'll send them to anyone who asks for copies.

Remember, this is a quick hack. There's probably a better way to do it. I could see adding a few more commands to set parameters like RADIUS and AGE in the particle emitters, so you could adjust them to your liking without having to dig into each and every emitter's script. You'd place the parameters in the control panel and message them out to the emitters.

ETA: I've added comments and the "scanTime" variable to the script, to improve readability and comprehension. Hopefully it still compiles!

Wow! I tested it and I like it! Thanks! 

Conveniently, this switch doesn't need separate buttons. 👍👍👍👍👍

Snapshot_001.png

Edited by Isobeast
Link to comment
Share on other sites

49 minutes ago, Isobeast said:

Wow! I tested it and I like it! Thanks! 

Conveniently, this switch doesn't need separate buttons. 👍👍👍👍👍

You're welcome!

llDetectedTouchST( ) is very handy for making button panels. I left in the logic for multi column panels. The hardest part of making multi-button panels is the creation of the panel graphic. HUDs often use this technique. If you take your control panel prim into inventory and then attach it to HUD center, you'll see how that works. The touch portion of the interface will work properly, but the avatar sensor won't, as attached sensors can't detect their wearers.

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 956 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...