Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scripting a button to control another object.

Ploy Vogel
Registered User
Join date: 27 Aug 2004
Posts: 133
08-08-2005 17:06
I would like to know how I can control one object by clicking on another object.

For example, I would like to click a button that would hide or unhide another object that is not linked to the button.

Is this possible?

Thanks.
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
08-09-2005 00:30
yup use llSay and listen.
im at work so i cant post an example
but look at the elevator button script
in the script libaray.
-LW
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
08-09-2005 01:04
In the object to hide:
CODE

integer is_hidden;

default
{
state_entry()
{
is_hidden = FALSE;
llListen(-126, "", "", "");
llSetAlpha(1.0, ALL_SIDES);
llSetLinkAlpha(LINK_SET, 1.0 ALL_SIDES);
}

on_rez(integer c) { llResetScript(); }

listen(integer chan, string name, key id, string msg)
{
if (llGetOwnerKey(id) != llGetOwner()) return;
if (is_hidden)
{
is_hidden = FALSE;
llSetAlpha(1.0, ALL_SIDES);
llSetLinkAlpha(LINK_SET, 1.0 ALL_SIDES);
} else {
is_hidden = TRUE;
llSetAlpha(0.0, ALL_SIDES);
llSetLinkAlpha(LINK_SET, 0.0 ALL_SIDES);
}
}
}


And in the controller object:
CODE

default
{
touch_start(integer c)
{
if (llDetectedKey(0) != llGetOwner()) return;
llShout(-126, "whatever");
}
}
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.