Touch object to fade and turn to phantom

Creating scripts
Post Reply
User avatar
Ghaelen DLareh
Posts: 76
Joined: Thu Dec 27, 2012 4:13 pm
Has thanked: 49 times
Been thanked: 59 times
Contact:

Touch object to fade and turn to phantom

Post by Ghaelen DLareh »

I've searched through the numerous opensim sites, forums, blogs, etc for a script that causes a prim to both fade and turn phantom when touched. This would be for doors, secret panels, etc. I looked in the marketplace, too.

Maybe I don't know the correct search terms or terms for the script. I've found scripts that perform one or two of the functions (text to fade, cycled fade in and out, touch to change texture, touch to phantom) but not a script with touch, fade (slowly), turn to phantom, and turn back to solid and opaque after a certain length of time. I'm a total noob at scripting and don't even know how to add missing bits of script. :(

If there is such a script, can anyone point me to it? If not, I'd like to post a couple scripts that almost do what I need if I could get some help adding the missing function.
A Curative Poison (a metaverse story)

De Landria Rising Market

The De Landria Project
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Touch object to fade and turn to phantom

Post by Graham Mills »

That should be fairly straightforward but it would help to know how the object is supposed to reset to default values, e.g. after a short delay?
User avatar
Keith Selmes
Posts: 175
Joined: Fri Jan 04, 2013 1:13 pm
Location: Devon, UK
Has thanked: 174 times
Been thanked: 153 times
Contact:

Re: Touch object to fade and turn to phantom

Post by Keith Selmes »

will this do ?

// fading door
// on touch, fade to invisible, go phantom
// after delay, fade to solid, go solid
//
// Keith Selmes 14/01/16
// free to use


integer closed=1;
float i;
float timeout=10.0; // time door stays open,in seconds

open()
{
i=1;
do
{
i-=0.00001; //adjust for fade out time
llSetAlpha(i, ALL_SIDES);
}
while(i>0);
llSetStatus(STATUS_PHANTOM, TRUE);
}

close()
{
i=0;
do
{
i+=0.00001; // adjust for fade in time
llSetAlpha(i, ALL_SIDES);
}
while(i<1);
llSetStatus(STATUS_PHANTOM, FALSE);
}


default
{

touch_start(integer number)
{
open();
llSetTimerEvent (timeout);
}

timer()
{
close();
llSetTimerEvent (0);
}
}
These users thanked the author Keith Selmes for the post (total 5):
Graham MillsDot MatrixMarstol NitelyAda RadiusCulli Sheerfrost
User avatar
Ghaelen DLareh
Posts: 76
Joined: Thu Dec 27, 2012 4:13 pm
Has thanked: 49 times
Been thanked: 59 times
Contact:

Re: Touch object to fade and turn to phantom

Post by Ghaelen DLareh »

Perfect!

Just tested it in Kitely - worked like a charm, first time. And I can close/fade in a door on touch as well. Beautiful. :)
Thank you, Keith!
A Curative Poison (a metaverse story)

De Landria Rising Market

The De Landria Project
Post Reply