Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linked item texture change

Katanya Mistral
The Lonely Tigress
Join date: 6 Oct 2005
Posts: 87
05-24-2006 06:41
Hi all. I have a chair I want to change the texture of simply by clicking. I have a texture switcher script, but apparently need to add link script to the other prims to make everything change at once. Unfortunately I don't understand the link stuff yet at all. Could anyone help me figure out what I need to add?
_____________________
Visit my website: Katanya.net
My SL site: Kitty's SL Adventures
Ledje Gorky
Registered User
Join date: 1 Jun 2005
Posts: 126
05-24-2006 06:50
http://secondlife.com/badgeo/wakka.php?wakka=llSetLinkTexture
Katanya Mistral
The Lonely Tigress
Join date: 6 Oct 2005
Posts: 87
05-24-2006 07:45
Doh, thanks Ledje, I completely missed that one when I looked.
_____________________
Visit my website: Katanya.net
My SL site: Kitty's SL Adventures
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-24-2006 08:20
I'm afraid that you misread it. It says, "There is NO llSetLinkTexture function.".
You have to let it communicate with all prims by llMessageLinked(LINK_SET.... And you have to receiving and changing texture script into all prims.
_____________________
:) Seagel Neville :)
Katanya Mistral
The Lonely Tigress
Join date: 6 Oct 2005
Posts: 87
05-24-2006 10:15
I saw that when I went to look Seagel, and had hope for the code snippets it had posted. I don't understand the variables however in ||MessageLinked or link_message.
Does anyone have a linking script snippet I could look over?
_____________________
Visit my website: Katanya.net
My SL site: Kitty's SL Adventures
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-25-2006 00:47
It is not the problem of linking, but llSetTexture's feature. llSetTexture can affect only a prim which the script is included in. Your chair should be linked, or you can link them manually. So you don't have to link prims again by any script. All you have to do is put the proper script in each prim you want to change texture.

I'm not sure what script you're using. I just put down, no test.

Put this into the root prim. Don't forget to put your texture's UUID in the first line.
CODE

key TEXTURE = "Put your texture's UUID here";
key WHITE = "5748decc-f629-461c-9a36-a35a221fe21f";
integer TouchFlag = FALSE;

default
{
state_entry()
{
llSetTexture(WHITE, ALL_SIDES);
}
touch_start(integer total_number)
{
if(!TouchFlag)
{
llSetTexture(TEXTURE, ALL_SIDES);
llMessageLinked(LINK_ALL_OTHERS, 0, "", TEXTURE);
}
else
{
llSetTexture(WHITE, ALL_SIDES);
llMessageLinked(LINK_ALL_OTHERS, 0, "", WHITE);
}
TouchFlag = !TouchFlag;
}
}

Put this into all children prims.
CODE
default
{
link_message(integer sender_num, integer num, string str, key id)
{
llSetTexture(id, ALL_SIDES);
}
}
_____________________
:) Seagel Neville :)
Katanya Mistral
The Lonely Tigress
Join date: 6 Oct 2005
Posts: 87
05-25-2006 03:47
Thanks Seagel. I was using Strife Onizuka's script from the libray, and only need to add one line to make it work with the child script you posted. I'll post it below.

CODE
//From the script library
//Writen by Strife Onizuka
//http://secondlife.com/badgeo/wakka.php?wakka=LibraryTextureSwitcher

float time = 0; //give me a value if you want time based shifting otherwise set to zero

integer total;
integer counter;

next()
{
string name = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(name == "")
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
name = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(name ,ALL_SIDES);
llMessageLinked(LINK_ALL_OTHERS, 0, "", name);
if(total)
counter = (counter + 1) % total;
}

default
{
state_entry()
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
next();
llSetTimerEvent(time);
}
touch_start(integer a)
{
llSetTimerEvent(0);
next();
llSetTimerEvent(time);
}
timer()
{
next();
}
}


I just needed to add:
CODE
llMessageLinked(LINK_ALL_OTHERS, 0, "", name); 


Thanks for all the help
_____________________
Visit my website: Katanya.net
My SL site: Kitty's SL Adventures
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-25-2006 03:55
That section you put down "name" is for key. But actually "name" is string. So you have to write like this.

llMessageLinked(LINK_ALL_OTHERS, 0, name, "";);

Then, in the reciever script,
CODE
default 
{
link_message(integer sender_num, integer num, string str, key id)
{
llSetTexture(str, ALL_SIDES);
}
}

And you have to put all textures into every prim.
_____________________
:) Seagel Neville :)