Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetLinkColor acting odd

Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
12-15-2006 01:05
From: someone

llSetLinkColor(15,<9,.1,.5>,ALL_SIDES);


I am using a script that uses LinkColor a lot. It works like I want it to, and every thing in the object I have...up until I have 2 or more coppys of the object out.....every link #15 will change color in every coppy out....what am I doing wrong?
From: someone

if ( choice == "2" )
{
llSetLinkColor(13,<9,.1,.5>,ALL_SIDES);
llSetLinkColor(2,<.6,.5,.1>,ALL_SIDES);
llSetLinkColor(14,<.6,.5,.1>,ALL_SIDES);
pic1 = pic1 + 2;
state line2;
}

here is a coppy of typical code you'll find this in
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-15-2006 01:11
Check that you are not also broadcasting via chat which is getting relayed because of a common channel number. If it definitely isnt that then I'd say its a rather nasty bug in the latest release.
Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
12-15-2006 01:17
yup, I had the chat diolog brodcasting...if I make the channel "0" will it stop doing that?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-15-2006 01:35
Nope, will make it worse! You will get all chat.
Firstly does the listen need to be open all the time or can it be touch activated?
Most configuration type controls dont really need to be always on, just when you are actually configuring the item.

If its a touch activate dsystem then use a timer to clear down the listen after you have finished processing the commands.

Are you using a dialog or just text chat control?

For text chat I generally use either a notecard controlled channel number or a low range random channel number between 1 and 100 selected at rez time.

If it is a dialog then I'd suggest that you use a randomised channel number and a timer to limit the length of time the chat is open.


here is the simplified code I generally use for Dialogs
CODE

integer Listening = 0;
integer listenchannel;


UpdateListen(key id)
{
CancelListen();
Listening = llListen(listenchannel,"",id,"");
llSetTimerEvent(30);
}

CancelListen()
{
if(Listening > 0) llListenRemove(Listening);
Listening = 0;
llSetTimerEvent(0);
}

// Owner Conversation Dialog
ShowMainMenu(key id)
{

listenchannel = 0 - (integer) llFrand(2147483646);
string text = "Main Menu\nPlease Select an Option";
// finally show the dialog
llDialog(id,text,MenuChoices,listenchannel);
UpdateListen(id);
}


You will also need a Timer event handler to clear the listen down.

CODE

timer()
{
CancelListen();
}


Add the same code in the start of the listen event handler

CODE

listen( integer channel, string name, key id, string message )
{
CancelListen();
// Process messages
}



Its reasonably good practise to use a control script for the chat stuff and have it communicate to the main script(s) via linked messages.
Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
12-15-2006 15:49
what I have is menue driven dialog, were the selection woud triger multi things to happen at once. I crammed 3 menues into 1 script, with 10 options each. Basically the first menue is used, followed by the second, followed by the 3rd. there is 10 if's per menue and 30 llLinkColor's per menue. (making a total of 60+ if's and 120+ change colors in 6 states.)
I may try llFrand to make the channels random, so there isn't so much script being rewritten, but will keep that in mind when dealing with less bulky scripts.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-17-2006 12:45
From: Shippou Oud
what I have is menue driven dialog, were the selection woud triger multi things to happen at once. I crammed 3 menues into 1 script, with 10 options each. Basically the first menue is used, followed by the second, followed by the 3rd. there is 10 if's per menue and 30 llLinkColor's per menue. (making a total of 60+ if's and 120+ change colors in 6 states.)
I may try llFrand to make the channels random, so there isn't so much script being rewritten, but will keep that in mind when dealing with less bulky scripts.


Thats a pretty high concentration of if's, you could possibly reduce it somewhat by using lists for the sub menu handlers but it would be dependant upon exactly what your code is trying to accomplish.