Colour changing script
|
|
David DiPrima
Registered User
Join date: 29 Sep 2006
Posts: 15
|
11-24-2006 08:22
I have a script that changes the colour of a prim (llsetcolor) and several and other prims with scripts that wait for link_message to change their colour too. It seems to work fine until I have several copies of the linked object rezzed and when I changed the colour on one linked object it changes the colour of the other copies too even though they are not linked. Is there a way to change the colour of the prims in ONLY the linked object as I don't want it to change them all?
TY
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-24-2006 08:29
David, check that script and make sure it is not changing colors using llSay, llWhisper, or llShout intsead. If it is using them then all you have to do is change the channels.
In case you are interested in making everything better and less laggy. You can actually take the scripts out of the child prims if all they do is change color. Use llSetLinkColor instead in the root prim.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
David DiPrima
Registered User
Join date: 29 Sep 2006
Posts: 15
|
Colour changing script
11-24-2006 08:42
Hi Jesse, the colour change is definetly implemented with the llsetcolor command and I would remove the scripts, but it is important in the linked object that one of the prims remains unchanged.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-24-2006 09:09
Right, I understand it is using the llSetColor command. But one linkset cannot communicate with another linkset using link_message. When you touch one linkset and it changes the colors of another linkset it has to be using either chat ie: llSay, llWhisper etc or email.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
David DiPrima
Registered User
Join date: 29 Sep 2006
Posts: 15
|
Colour change problem
11-24-2006 09:22
Thank you responding again. That's what I thought regarding the llsetcolor command and was very suprised to see it changing the colour of the copy aswell. I have this script in the prims waiting for the change colour command.
default { link_message(integer sender_num, integer num, string str, key id) { llSetColor( (vector)str, ALL_SIDES); } }
This is the message_link command sent: llMessageLinked(LINK_SET, 0, "<1.0,1.0,0.5>", NULL_KEY);
Exactly what I did was have my linked, scripted object and copy it to one side. So I have two copies of the same linked object. There are certainly no llwhisper, llsay etc commands in my scripts
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
11-24-2006 09:32
I think Jesse is suggesting that the controlling script is receiving its instruction to itiatiate the colour change on a common channel... and that all the separate object's control scripts are listening and responding to the commands coming from that common channel. Without knowing how you're are 'talking' to the controlling script it's difficult to give specific advice but the bottom line is that if controlling scripts are using llListen then they need to use a different channel to prevent them from 'over-hearing' each other's instructions. For example, if you are using llDialog this is an example of establishing a 'secure' channel: llListenRemove(mnuHandle); mnuChannel = llRound(llFrand(900000) + 100000) * -1; mnuHandle = llListen(mnuChannel, "", llGetOwner(), ""); llDialog(llGetOwner(), mnuTitle, mnuOptions, mnuChannel); ...this randomly establishes an 'exotic' channel which is very unlikely to suffer from any cross-talk. How are you intitiating the colour change in the script issuing the llMessageLinked?
|
|
David DiPrima
Registered User
Join date: 29 Sep 2006
Posts: 15
|
Colour change problem
11-24-2006 10:01
You guys rock! When you mentioned the dialog channel you were right. They were both using the same channel. I used the "mnuChannel = llRound(llFrand(900000) + 100000) * -1;" you provided to generate the random channel and it worked! I can finally rest lol.
Regarding the colour change with llMessageLinked I just sent a string with the vectors inside it and the receiving script uses (vector)str with the llsetcolor command to change it. I know there is probably an easier way, but my scripting experience stands at a mammoth 2 days lol.
Once again thanks for your help Jesse and Pale.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-24-2006 10:24
Cool! Glad it is working for you now and welcome to the world of scripting
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
11-24-2006 10:55
Good stuff!  To be extra safe it's also a good idea to contiinuously vary that channel prior to each call to the llDialog, hence you notice my code snippet removes the llListen, and then picks a new random channel. If you pull several copies of the same object from inventory without anything causing a script reset then they may still share the same 'random' channel depending on which event is used to set the channel in the first place. Scripts are persistent buggers. 
|
|
David DiPrima
Registered User
Join date: 29 Sep 2006
Posts: 15
|
Colour change
11-24-2006 15:52
Once again thank you, it was literally giving me headache. I understand about the llListenRemove command and have implemented that too in the script. I'm not taking any chances with this thing.
|