Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

color menu

Amiz Munro
Registered User
Join date: 8 Jul 2008
Posts: 54
11-06-2009 07:43
I have a menu in a linked couch but I only want parts of the couch to change. I used the script to get the linked parts number 1,20,28 but I get lost where to change Link_root to Link_number

[/php]
integer CHAN = -172;
list buttons = ["Red", "White", "Blue", "Green"];

default
{
state_entry()
{
llListen(CHAN,"","","";);
}

touch_start(integer num)
{
llDialog(llDetectedKey(0),"Choose a texture",buttons,CHAN);
}

listen (integer channel, string name, key id, string message)
{
llSetLinkTexture(LINK_ROOT,message, ALL_SIDES);
}
}

[/php]
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-06-2009 08:00
From: Amiz Munro
I have a menu in a linked couch but I only want parts of the couch to change. I used the script to get the linked parts number 1,20,28 but I get lost where to change Link_root to Link_number


integer CHAN = -172;
list buttons = ["Red", "White", "Blue", "Green"];

default
{
state_entry()
{
llListen(CHAN,"","","";);
}

touch_start(integer num)
{
llDialog(llDetectedKey(0),"Choose a texture",buttons,CHAN);
}

listen (integer channel, string name, key id, string message)
{
llSetLinkTexture(LINK_ROOT,message, ALL_SIDES);
}
}

[/php][/php]

The first parameter of llSetLinkTexture is the link number. You can use one of the LINK_* flags like LINK_ROOT or an actual link number. BTW LINK_ROOT is the same as providing the number 1 for link number if it's a linkset.

replace

CODE

llSetLinkTexture(LINK_ROOT,message, ALL_SIDES);


with

CODE

llSetLinkTexture(LINK_ROOT,message, ALL_SIDES);
llSetLinkTexture(20,message, ALL_SIDES);
llSetLinkTexture(28,message, ALL_SIDES);


Or put your link numbers in a list and loop through the list using llSetLinkTexture.
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-06-2009 08:24
I think I would also suggest not opening a listen that stays open all the time. You can start a timer and turn the listen ON when they touch and off when you receive a response or the timer fires.

Something like the following:

CODE

integer CHAN = -172;
list buttons = ["Red", "White", "Blue", "Green"];
integer listen_handle;
key toucher;

default
{
touch_start(integer total_number)
{
if (llDetectedKey(0) != NULL_KEY)
{
toucher = llDetectedKey(0);
llDialog(toucher,"Choose a texture",buttons,CHAN);
listen_handle = llListen(CHAN,llKey2Name(toucher),toucher,"");
llSetTimerEvent(30.0);
}
}

listen (integer channel, string name, key id, string message)
{
llListenRemove(listen_handle);
llSetTimerEvent(0.0);
llSetLinkTexture(LINK_ROOT,message, ALL_SIDES);
llSetLinkTexture(20,message, ALL_SIDES);
llSetLinkTexture(28,message, ALL_SIDES);

}

timer()
{
if (toucher != NULL_KEY)
{
llInstantMessage(toucher,"Dialog timer expired.");
}
llListenRemove(listen_handle);
llSetTimerEvent(0.0);
}