Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

changing the texture on linked prims

Jamus Gillespie
Registered User
Join date: 8 Jan 2005
Posts: 10
03-23-2005 13:55
I'm trying to use the following script to change the texture on an object at touch:


default
{

touch_start(integer total_number)
{
integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
float rand = llFrand(number);
integer choice = (integer)rand;
string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (name != "";)
llSetTexture(name, ALL_SIDES);
}
}


I have three prims linked but the script only changes the texture on on eof the prims.
I know very little about scripting and so I'm wondering if there is a way to change the texture on all three (even better stretch the texture across the surface of all three linked prims.

Any help would be greatly appreciated.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-23-2005 14:05
Yep. You'll have to make it so all three prims have a texture-changing script. The easiest means to do this is with a link message.

Insert Strife comment: "I want llSetLinkTexture!" here.

Anyway, some example code would look like this for the master prim:
CODE
touch_start(integer total_number)
{
llMessageLinked(LINK_SET,0,"TextureNameHere","TextureKeyHere");
}


... then place this in every other prim in the set
CODE
link_message(integer sender, integer num, string str, key id)
{
if(str != "") llSetTexture(str, ALL_SIDES);
else if(id != "") (string)llSetTexture(id, ALL_SIDES);
}


See here for more information.
_____________________
---
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-23-2005 15:29
From: Jeffrey Gomez
CODE
link_message(integer sender, integer num, string str, key id)
{
if(str != "") llSetTexture(str, ALL_SIDES);
else if(id != "") (string)llSetTexture(id, ALL_SIDES);
}


think you mean

CODE
link_message(integer sender, integer num, string str, key id)
{
if(str != "") llSetTexture(str, ALL_SIDES);
else if(id != "") llSetTexture((string)id, ALL_SIDES);
}


but it's all good
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-23-2005 16:14
Ack! I forgot it, didn't I? Thanks. :D
_____________________
---
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
03-24-2005 10:41
You don't have to typecast a key to a string in that function, at least, I never do. I always use keys for my textures, never names.
_____________________
~ Tiger Crossing
~ (Nonsanity)