Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Texture Change via Dialog

Imani Moseley
Registered User
Join date: 23 Mar 2005
Posts: 34
12-21-2006 14:24
I'd like to combine a couple of scripts I have that handle texture changes on a link set. I have 3 rows of objects all linked together. All 3 rows use different textures. Within a row, for instance, 1a and 1c are the same texture. 1b is a different texture.

I have been handling the texture change via channel command, with each row on a different channel (example /1 plaid) Everything in row one will change to plaid as long as the texture inside the prim is called plaid. The problem with this is that a FULL MOD texture needs to reside inside the prim in order for the script to work properly.

--------------------------------
| 1a | 1b | 1c |
--------------------------------
| 2a | 2b | 2c |
--------------------------------
| 3a | 3b | 3c |

Ideally, I would like the ability to change the textures via menu, using the texture UUID instead of placing the textures inside the prim. As for the menu button set-up, I would like to be able to choose Row 1, Row 2, Row 3... with each button opening a sub-menu offering 10 or so texture options. Additionally, the option to hide/show the row would be great.

I'm only proficient at modifying highly commented scripts so I'm more than willing to pay for the scripting service. I appreciate and welcome any help. Contact me in game if you need to see the texture scripts I currently have.

Thanks
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-21-2006 16:14
From: Imani Moseley
I'd like to combine a couple of scripts I have that handle texture changes on a link set. I have 3 rows of objects all linked together. All 3 rows use different textures. Within a row, for instance, 1a and 1c are the same texture. 1b is a different texture.

I have been handling the texture change via channel command, with each row on a different channel (example /1 plaid) Everything in row one will change to plaid as long as the texture inside the prim is called plaid. The problem with this is that a FULL MOD texture needs to reside inside the prim in order for the script to work properly.

--------------------------------
| 1a | 1b | 1c |
--------------------------------
| 2a | 2b | 2c |
--------------------------------
| 3a | 3b | 3c |

Ideally, I would like the ability to change the textures via menu, using the texture UUID instead of placing the textures inside the prim. As for the menu button set-up, I would like to be able to choose Row 1, Row 2, Row 3... with each button opening a sub-menu offering 10 or so texture options. Additionally, the option to hide/show the row would be great.

I'm only proficient at modifying highly commented scripts so I'm more than willing to pay for the scripting service. I appreciate and welcome any help. Contact me in game if you need to see the texture scripts I currently have.

Thanks


Hold the textures either in the root prim or in inventory and either hard code or use notecards to supply the ID's and names to the script.
Are the prims linked in row order? or will we need to store a link to prim look up?
either way is reasonably straight forward.

If we stick to a maximum of 10 textures plus hide/show we only need one dialog per option so makes it easier.
will all rows have the same texture options or is it variable?

here is a simple version with hard coded selections

EDIT:
Reading your post again I think you will need a more complex version since you state that a and c are the same but b will be different and that each row has different textures.
CODE

// Configurable Settings
list Rows = [ "Row 1","Row 2","Row 3"];
// Dont need a show as selecting a texture will automatically show it
list Textures = [ "Texture1","Texture2","Texture3","Texture4","Texture5","Texture6","Texture7","Texture8","Texture9","Texture10","Hide"];


// Dialog Handler
integer Listening;
integer ListenChannel;

key owner = NULL_KEY;


integer RowNumber;

// Functions
UpdateListen(key id)
{
CancelListen();
Listening = llListen(ListenChannel,"",id,"");
llSetTimerEvent(30);
}

CancelListen()
{
if(Listening > 0) llListenRemove(Listening);
Listening = 0;
llSetTimerEvent(0);
}

// Owner Conversation Dialog
ChooseTexture(key id)
{
string text = "Set Texture for Row " + (string)RowNumber;
ListenChannel = (integer)llFrand(2147483646) + 1;
llDialog(id,text,Textures,ListenChannel);
UpdateListen(id);
}

ChooseRow(key id)
{
string text = "Which Row?";
ListenChannel = (integer)llFrand(2147483646) + 1;
llDialog(id,text,Rows,ListenChannel);
UpdateListen(id);
}


default
{
state_entry()
{
owner = llGetOwner();
}

on_rez(integer num) { llResetScript(); }

changed(integer change)
{
// Test for a changed inventory
if (change & CHANGED_OWNER)
{
llResetScript();
}

}

timer()
{
CancelListen();
}

touch_start(integer total_number)
{
// Owner
key id = llDetectedKey(0);
if( (id == owner))
{
ChooseRow(id);
}
}

listen( integer channel, string name, key id, string message )
{
integer index = llListFindList(Textures, [ message ] );
if("Hide" == message)
{
llMessageLinked(LINK_ALL_OTHERS, RowNumber, message, NULL_KEY);
}
else if(index >= 0)
{
//. This example is based on the texture being held in the root prim.
key TextureId = llGetInventoryKey(message);
// We now have a RowNumber and Texture ID
// Use the rowNumber to let the child script decide what to do.
llMessageLinked(LINK_ALL_OTHERS, RowNumber, message, TextureId);
}
else
{
index = llListFindList(Rows, [ message ] );
if(index >= 0)
{
RowNumber = index;
ChooseTexture(id);
}
}
}
}




Obviously you will need a receiver script that would handle the sent commands.
I'd suggest either using link order to select rows or may be a single notecard in each child prim
Imani Moseley
Registered User
Join date: 23 Mar 2005
Posts: 34
thanks Newgate
12-21-2006 19:33
for your quick reply. I have a few questions I would like to ask you, in game, if I may.