Jump to content

Script for Making Objects Appear and Dissapear


Clarity Mesmeriser
 Share

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

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

Recommended Posts

Hello all :)

I would like to create ephemeral objects and images on my sim, for example having rainbows that appear and resolve into nothing and then become visible again.

I am a complete beginner in terms of scripting but I assume I need something that cycles the object transparancy from 0-100 and then back again.

Can anyone help me ? It would be great to be able to adjust the speed of the appearance and dissapperance easily.

Thank you so much for your help.

 

 

 

Link to comment
Share on other sites

Make a script in the prim and copy paste this in,the float delay = how long you want it to take to fade out.

Learn texturing here

http://wiki.secondlife.com/wiki/Texture_Tools

  float delay = 0.10; 
    float i;
    float j;
fadeout()
{
    for (i = 10; i > 0; i--)
    {
        llSetTexture("fa968aa9-2efc-7f8c-124c-05d5c89b1774",ALL_SIDES);
        llSleep(delay);
    }

    llSetTexture("fa968aa9-2efc-7f8c-124c-05d5c89b1774",ALL_SIDES);
}

fadein()
{
    for (j = 0; j < 10; j++)
    {
        llSetTexture("13dc1188-cf65-0c1f-a78b-cacbb77f8bdf",ALL_SIDES);
        llSleep(delay);
    }

    llSetTexture("0def22cf-d519-ae51-16dd-46901698e8f9",ALL_SIDES);
}
fade()
    {
    fadeout();
    llSleep(30.0);
    fadein();
    llSleep(30.0);
    llResetScript();
}
default
{
    
    state_entry()
    {
  fade();
    }
}

 

there are many ways to do this,this is just a simple example to get started with.

Link to comment
Share on other sites

I'm a big fan of particles (and cephalopods, but that's a different matter) because of their versatility and low sim impact (1 prim per emitter, 1 script per object).  When you are new to scripting the instructions and options are rather overwhelming (http://wiki.secondlife.com/wiki/LlLinkParticleSystem) but it's well worth playing around with them to get a feel for what can be done.

Link to comment
Share on other sites

Since the particle-system rules are so daunting I made a demonstration.  Looks awesome with my chameleonic cuttlefish texture.  Have a squd squint at this:

 

list	BaseRules;													// Invariant particle ruleslist	FadeRules = [PSYS_PART_FLAGS, PSYS_PART_INTERP_COLOR_MASK];	// Additional rules for fading in/outinteger	FlipFlopFly;												// (I don't care if I die) particle stepinteger	On;															// Touch on/offfloat	Delay = 5.0;	// <== Change this one - how many seconds each step lastsdefault{	state_entry(){		BaseRules = [PSYS_PART_START_SCALE, <2.0, 2.0, 0.0>, PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0), PSYS_PART_MAX_AGE, Delay * 1.1, PSYS_SRC_BURST_RATE, Delay, PSYS_SRC_BURST_PART_COUNT, 1];	}	timer(){		if(0 == FlipFlopFly){			// Fade in			llParticleSystem(BaseRules + FadeRules + [PSYS_PART_START_ALPHA, 0.0, PSYS_PART_END_ALPHA, 1.0]);		}else if (1 == FlipFlopFly){			// Hold on			llParticleSystem(BaseRules);		}else if (2 == FlipFlopFly){			// Fade out			llParticleSystem(BaseRules + FadeRules + [PSYS_PART_START_ALPHA, 1.0, PSYS_PART_END_ALPHA, 0.0]);		}else{			// Hold off (ie; do absolutely nothing for this step)			llParticleSystem([]);		}		FlipFlopFly = ++FlipFlopFly % 4;	}	touch_end(integer HowMany){		if(llDetectedKey(0) == llGetOwner()){			llParticleSystem([]);			llSetTimerEvent(Delay * (On = !On)); 		}	}}

 

PS:  I also noticed that (un)setting the Z value of the scale vector made absolutely no difference.  This is 'as expected' but contrary to my earlier experience and posts.  Looks like the 'bug' that let you stop the particle tilting as you adjusted camera height has been fixed (Or maybe previously I was just using a wonky viewer, or going mad, or ...).

Link to comment
Share on other sites

That's cool, Peter.  Much gentler than a stepwise fade.  I need to play with particles more.

====

On a relevant but only vaguely related note (from Merriam-Webster):

oc·to·pus

noun \ˈäk-tə-pəs, -ˌps\
plural oc·to·pus·es or oc·to·pi   <<<<<<  Pppppppttth!   ;-)
 

Definition of OCTOPUS


 any of a genus (Octopus) of cephalopod mollusks that have eight muscular arms equipped with two rows of suckers; broadly : any octopod excepting the paper nautilus
Link to comment
Share on other sites


PeterCanessa Oh wrote:

Since the particle-system rules are so daunting I made a demonstration.  Looks awesome with my chameleonic cuttlefish texture.  Have a
squd
squint at this:

PS:  I also noticed that (un)setting the Z value of the scale vector made absolutely no difference.  This is 'as expected' but contrary to my earlier experience and posts.  Looks like the 'bug' that let you stop the particle tilting as you adjusted camera height has been fixed (Or maybe previously I was just using a wonky viewer, or going mad, or ...).

Peter, I've done this as well and it works beautifully and efficiently, so long as  you are emitting the particles with radius, velocity, acceleration, wind, target (and any other motion inducing factors I forget) all set to zero. I'm sure that's what you do in your BaseRules, but it's not shown in your example.

I've never seen the "bug" that lets you stop particle tilting. I'd love to exploit it, but think that your going mad is a more interesting explanation and perhaps even more fun to exploit ;-)

Link to comment
Share on other sites


Madelaine McMasters wrote:


Rolig Loon wrote:


Innula Zenovka wrote:

Wikiepdia
.   My preferred term, btw, when discussing the creatures in Greek, is
.

/me retracts her "pppppppth" .

Scoots back to Wikipedia to discover what kind of creature has retractable "pppppppths"

Scoots off to the jira to petition for llSetLinkPrimitivePppppppthsFast()

Link to comment
Share on other sites


Innula Zenovka wrote:


Madelaine McMasters wrote:


Rolig Loon wrote:


Innula Zenovka wrote:

Wikiepdia
.   My preferred term, btw, when discussing the creatures in Greek, is
.

/me retracts her "pppppppth" .

Scoots back to Wikipedia to discover what kind of creature has retractable "pppppppths"

Scoots off to the jira to petition for llSetLinkPrimitiveP
ppppppthsFast()

We need this! I'll vote for it!!!

Link to comment
Share on other sites


Innula Zenovka wrote:


Madelaine McMasters wrote:


Rolig Loon wrote:


Innula Zenovka wrote:

Wikiepdia
.   My preferred term, btw, when discussing the creatures in Greek, is
.

/me retracts her "pppppppth" .

Scoots back to Wikipedia to discover what kind of creature has retractable "pppppppths"

Scoots off to the jira to petition for llSetLinkPrimitiveP
ppppppthsFast()

Doesn't LSL already have that?  It's one of those God functions that LL uses whenever they think we've pushed the envelope too far.

Link to comment
Share on other sites

Lol, thank you all for your informative posts. 

 

I managed to find several options that will make linked prims disappear and then re-appear but they all depend on an avatar clicking the prim to activate this effect. Is it possible to have a script where the object fades in and out of view without any interaction necessary ?

Thank you all for your help. 

 

Link to comment
Share on other sites

Well, something has to trigger it, even if that something is you.  You can trigger with a timer, with a sensor, with a collision, with a chat message (sent any number of ways), or by wearing it, rezzing it, moving it, sitting on it, ..... (geez, how many ways?)... or you can put virtually all the innards of the script into the state_entry event so that they start when the script is reset and they never stop.  In general, I see little reason to have a script doing things while there's nobody around (if a tree falls in the forest .... ), but sometimes that's the actually the best solution.

Link to comment
Share on other sites

In the example I gave you can simply start the timer in state_entry() if you wish.  I've created it with an owner on/off switch for convenience but once you've started it it'll go on forever.

PS:  It's easy to write a sensor routine so that any/every- thing only happens when there are avatars around to see them.  It's harder to detect cephalopods because their camouflage is so good.

Link to comment
Share on other sites

I'm trying this script Peter - thank you.

Works beautifully... except I can't seem to increase the size of the particle (thought it would just be a simple matter of increasing the PSYS_PART_START_SCALE values).

Can someone help me make a gorgeous big rainbow over the sim?

P.S. I got the texture :).

 

Emma :) 

Link to comment
Share on other sites

PSYS_PART_START_SCALE is absolutely the only change you should need to make for a constant-size particle.  Note, however, the range limitations: "Valid values for each direction are 0.03125 to 4.0, in meters".  Beyond 4m particles aren't going to be much use - I thought of an emitter placing different long-life particles in different positions to 'tile' a bigger image but given that they always face the camera there's no practical way to arrange them.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4454 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...