Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking for a script

Chipmunk Chickenwing
Owner of WACKO shop
Join date: 5 Mar 2006
Posts: 5
06-14-2006 10:01
Hi I'm no scripter myself so I'm wondering what kinda code that requires to do this:

Example:
I press a prim button this sets of another linked prim which contains other scripts
that becomes active when i push the button.

Thanks in advance
/Chipmunk
Androclese Torgeson
I've got nothin'
Join date: 11 May 2004
Posts: 144
06-14-2006 18:30
I think I know what you are asking, but I'm not sure it can be done the way you are describing it.

There is a mechanism in LSL where you can use a function called llMessageLink() to send a pre-formatted message to other scripts within a linked object. That message can be used to execute commands within the other scripts.

For instance, in a 2 prim linked object, prim 1 contains the scripts that spawn a dialog menu.

By selecting a menu opion, a message is sent to the other prim which sets the text display for the object.

Is that close to what you are trying to do?
_____________________
Androclese Torgeson

Real Life, also known as "that big room with the ceiling that is sometimes blue and sometimes black with little lights"

Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
06-14-2006 19:16
As Androclese said, the best way to do this is to use a llMessageLinked() function, and in the scripts you want to trigger have two states, the default, for when it is waiting to be active, then the active state. In the active state, if you want an off button, you have it wait for a linked message that kicks it back to the default state.

CODE


default
{
link_message(integer sender_num, integer num, string str, key id)
{
if(str == "On")
{
//Got a message to activate , change On to anything you want to indicate activation.
state ON;
}
}
}

//State for what you script wants to do.
state ON
{
link_message(integer sender_num, integer num, string str, key id)
{
if(str == "Off")
{
//Was told to shut off
state default;
}
}

//Do what you want the script to do here in this state
}


and in the prim that you want to be touched

CODE
integer OFF = TRUE;

default
{
touch_start(integer num_detected)
{
//do a check if you want restrictions using the detect functions
if(OFF)
{
llMessageLinked(LINK_ALL_OTHERS, 100, "On", SomeKey);
}
else
{
llMessageLinked(LINK_ALL_OTHERS, 100, "Off", SomeKey);
}
}
}


Hope that helps :)
Chipmunk Chickenwing
Owner of WACKO shop
Join date: 5 Mar 2006
Posts: 5
06-16-2006 00:56
Thanks alot guys, much appreciated. Will test it when i come home from work