Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

linkset texture changer help

Billy Islander
Registered User
Join date: 3 Nov 2006
Posts: 35
11-09-2007 08:38
hi all , after modifying a script kindly posted by DoteDote Edison hhttp://forums.secondlife.com/showthread.php?t=173465&highlight=linked+prims+texture
to make it for use by only certain avatars , as it cycles to the last texture i get a script error "can't find texture 00000-000 etc" , can anyone help with this so the script goes back to the start of the list of textures.Code is as follows

CODE

integer total;
integer index;
list avatars =["billy islander" , "natasha malibu","luanna1love oh"];

default {
state_entry()
{
string avatar = llToLower(llDetectedName(0));
integer iIndex = llListFindList(avatars, [ avatar ]);
if(iIndex >= 0)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
}
changed (integer change) {
if (change & CHANGED_INVENTORY) total = llGetInventoryNumber(INVENTORY_TEXTURE);
}
touch_start(integer num_detected) {
if (index == total) index = 0;
string texture = llGetInventoryKey( llGetInventoryName(INVENTORY_TEXTURE, index++) );
llSetLinkTexture(LINK_SET, texture, ALL_SIDES);
}
}
CODE
Billy Islander
Registered User
Join date: 3 Nov 2006
Posts: 35
linkset texture changer help (resolved)
11-09-2007 09:58
finally managed to work it out myself , just put script in root prim with textures , obviously offsets and repeats have to be played with to line textures up, many thanks to DoteDote Edison for his post .code as follows
CODE

list avatars =["billy islander" , "another avatar",""]; // Use lowercase to avoid typing problems
integer total;
integer counter;
default
{
state_entry()
{
}
touch_start(integer total_number)
{

string avatar = llToLower(llDetectedName(0));
integer iIndex = llListFindList(avatars, [ avatar ]);
if(iIndex >= 0)
{
string pic = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(pic == "")
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
pic = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(pic ,4);string texture = llGetInventoryKey( llGetInventoryName(INVENTORY_TEXTURE,counter) );
llSetLinkTexture(LINK_SET, texture, ALL_SIDES);

if(total)
counter = (counter + 1) % total;
}
}
}
CODE