Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Change attached prim by clicking on it

Multimedia Hax
Registered User
Join date: 22 Mar 2007
Posts: 5
07-31-2008 17:06
Hi all, was wondering if anyone knows a tute that can help me with my question. I've made a spacey/scifi suit and have 2 helmets. One with visor open and the other closed. I was wondering if it's possible to somehow combine the 2 into one then add a script which will alternate between open and closed position when clicked on while wearing it.
Cheewha Palen
Registered User
Join date: 27 Nov 2007
Posts: 78
07-31-2008 20:22
Hi

I have a cloak with a hood that does this, the hood can be up over my head or down like a hoodie. by wearing both attachments and using a show hide script in them which will alpha one and de-alpha the other. this will give the allusion of changing helmuts gear etc. This is also used in guns and lightsabers that go from your belt to your hand.
the script I am posting is set up a lil differently it is for touching one prim to make another alpha, but from this you can see how the script is set up and either modify it to your needs or maybe some one else has such a script. You might also search script library for a show/hide script.

effectively you could make two copies of the alpha script and switch the lines:

appear()
{
llSetAlpha(1, ALL_SIDES); (for second script change "1" to "0";)
}
disappear()
{
llSetAlpha(0, ALL_SIDES); (for second script change "0" to "1";)
}



and then put one of each copy in the two helmuts and have another prim to touch with the toggle script in that and that should do what you are looking for.

anyhow hope this helps you and good luck!

alpha script
CODE

init()
{
llListen(69, "", "", "");
llSetAlpha(1, ALL_SIDES);
}
appear()
{
llSetAlpha(1, ALL_SIDES);
}
disappear()
{
llSetAlpha(0, ALL_SIDES);
}


default
{
state_entry()
{
init();
}
on_rez(integer start_param)
{
init();
}
attach(key attached)
{
init();
}
listen(integer chan, string name, key id, string msg)
{
if(llGetOwnerKey(id) == llGetOwner())
{
if(llToLower(msg) == "on")
{
disappear();
}
if(llToLower(msg) == "off")
{
appear();
}
}
}
}




and the toggle switch

CODE


integer on = 1;

default {
touch_start(integer n) {
if(on)
llSay(69, "on");
else
llSay(69, "off");
on = !on;
}
}

Cheewha Palen
Registered User
Join date: 27 Nov 2007
Posts: 78
07-31-2008 20:55
Smiles ok another idea just hit me. Look into the scripts library do a search for "timeless door script". Place this script in the visor prim and follow the direction for setting the open and close positions. you can delete out all the silly sounds this script has.

What this will do is make the visor a door that opens and closes when touched. This will eliminate the need for two versions of the helmut and streamline your build.

the timeless door script "remembers" the open and close position so the prim making up the visor can be any shape. This will only work for you if the visor is one prim however.

So if the visor is more than one prim you can go back to the alpha script. I would reccomend making two visors on one helmut and using the alpha script that way instead of having two versions of same build, that again helps streamline the build for you.

Okay, well there are a few options for you now Hope to see you drifting by in that suit any time now!

Good luck!