Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help Needed - llSETLINKPRIMPARA

smoky Sweetwater
Very Intrested Lurker ...
Join date: 7 Nov 2008
Posts: 19
09-24-2009 14:50
Hi Everyone

I am fairly new to scripting but i love to learn new things but I really need some help on this one (meaning, please take pity on me lol)

I am trying to get a script to change textures on individual prims that are linked via a dialog menu.

but I have ran into a problem on the last section of the script enabling it to select the texture itself (i have entered ?????? where I am stuck) ....if i type in a texture name then it will work but it will only accept one texture name, I have tried using inventory_texture or choice, etc with no joy!!

I have attached the script below.

I know that I am doing something wrong but i just cant work out what, please could someone help me to correct this so it will work or point me in the right direction of where to go?

Thanks for any advice given


list MENU1 = [];
list MENU2 = [];
integer listener;
integer MENU_CHANNEL = 1000;


// opens menu channel and displays dialog
Dialog(key id, list menu)
{
llListenRemove(listener);
listener = llListen(MENU_CHANNEL, "", NULL_KEY, "";);
llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);
}

default
{

on_rez(integer num)
{
// reset scripts on rez
llResetScript();
}

touch_start(integer total_number)
{
integer i = 0;
MENU1 = [];
MENU2 = [];
// count the textures in the prim to see if we need pages
integer c = llGetInventoryNumber(INVENTORY_TEXTURE);
if (c <= 12)
{
for (; i < c; ++i)
MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
}
else
{
for (; i < 11; ++i)
MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
if(c > 22)
c = 22;
for (; i < c; ++i)
MENU2 += llGetInventoryName(INVENTORY_TEXTURE, i);
MENU1 += ">>";
MENU2 += "<<";
}
// display the dialog
Dialog(llDetectedKey(0), MENU1);
}

listen(integer channel, string name, key id, string message)
{
if (channel == MENU_CHANNEL)
{
llListenRemove(listener);
if (message == ">>";)
{
Dialog(id, MENU2);
}
else if (message == "<<";)
{
Dialog(id, MENU1);
}
else
{
llSetLinkPrimitiveParams(3,[PRIM_TEXTURE, ALL_SIDES, ??????", <1.0,1.0,1.0>,<0,0,0>,0.0]);

}
}
}
}
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
09-24-2009 15:53
You can use a texture UUID (right-click the texture from your inventory and choose "copy uuid";). Or, you can use the name of a texture. But, if you use the name of a texture, that texture must be copied to the contents of the prim.

Also, if only changing a linked texture, you can use the llSetLinkTexture() function which doesn't require the extra params that llSetLinkPrimitiveParams() requires.
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
09-25-2009 00:06
Since your textures are in the inventory of the prim and you use their names to build the buttons, just use the answer of the dialog i.e. the string you get in the listen() event.

So...

llSetLinkPrimitiveParams(3,[PRIM_TEXTURE, ALL_SIDES, message, <1.0,1.0,1.0>,<0,0,0>,0.0]);

If you don't need to change the offset/repeat/rotation but only the texture, use simply:

llSetLinkTexture(3, message, ALL_SIDES);

...as DoteDote suggested.
smoky Sweetwater
Very Intrested Lurker ...
Join date: 7 Nov 2008
Posts: 19
Thanks for your help
09-25-2009 09:12
Thankyou to you both for your help!

Both ways work brilliantly.