Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parent, Child Texture Changer and Linking

MadamG Zagato
means business
Join date: 17 Sep 2005
Posts: 1,402
12-22-2005 08:22
I am using this texture changer script and when I link the parent and child prims together, it does not matter which I touch, they ALL respond to touch and change the textures of all the linked prims.

Even when I link them all to prims that do NOT have the script and make the parent the last prim linked, if I touch an object that does NOT have a script in it, it changes the scripted textures on touch.

I don't understand how that happens. For example, in a house, I have a control box with the parent script, and all the windows have the child script. If I link the whole house, and touch a wall for example, the windows will change. (???) How can I make it so they only change if I touch the control box with the parent script in it?

:) Thanks

From: someone

//Parent Script

setLinkTexture(integer linkNumber, string textureKey, integer side) {
llMessageLinked(linkNumber, side, textureKey, "setTexture";);
}
integer currentTexture;
default {
touch_start(integer totalNum) {
string textureName = llGetInventoryName(INVENTORY_TEXTURE, currentTexture);
if (textureName != "";)
setLinkTexture(LINK_SET, textureName, ALL_SIDES);
integer numTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
if (curTexture < numTextures) { // If we have more textures.
++curTexture; // Go to the next one.
} else {
curTexture = 0; // Go to the beginning of the list.
}
}
}


From: someone

//Child Script

default {
link_message(integer sender, integer side, string textureKey, key methodName) {
if (methodName == "setTexture";) {
llSetTexture(textureKey, side);
}
}
}
MadamG Zagato
means business
Join date: 17 Sep 2005
Posts: 1,402
12-22-2005 08:26
Nevermind. I got it.

I had the child script inside the parent prim as well. I removed the child script and it works fine now.

Doh!
_____________________