Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Texture from other prim

Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-09-2008 19:19
From: Yumi Murakami
What I presume you're thinking here is that after the llMessageLinked, the message will to go off to the green prim, which will then send its reply, and the reply will be picked up by the link_message event of the red prim which will load up the variable str.

Unfortunately, it doesn't work that way. :(

Only one event can be active at a time. So after the MessageLinked call, the message does go to the green prim, and it does indeed send its reply. Unfortunately, since the touch_start event in the red prim is in progress, the message waits until the touch_start event is done before arriving and triggering the link_message event. This means that the variable str isn't set by the time your "llSetTexture(str,0);" line runs.

The solution is to set the texture in the link_message event.


Correct! Now I understand why it does not work. It should be easier to get it the way I want. Thanks.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-09-2008 19:27
From: Jesse Barnett
See if this helps with the basics:

CODE
integer n;

default
{
touch_start(integer total_number)
{
integer link = llDetectedLinkNumber(n);
llOwnerSay((string)link);
llSetLinkTexture(link,llGetInventoryName(INVENTORY_TEXTURE,link - 1),ALL_SIDES);
}
}


Example: Link 4 prims and put 4 textures in the root prim along with this script. Touch the 1st prim and the 1st texture will be applied to it, 2nd prim = 2nd texture, etc.


Thanks as well JB
Everything becomes a little less hazy due to the one small bit of info that I did not know.
Will go try now.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-09-2008 19:31
From: Kornscope Komachi
Correct! Now I understand why it does not work. It should be easier to get it the way I want. Thanks.

Or as I posted you can forgo sending and decoding a message for the setting texture part and skip straight to llSetLinkTexture.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
06-09-2008 20:53
From: Kornscope Komachi
I really appreciate anyone putting in time to help me.:) Thank you very much!
I won't bother anyone again.


I wish you would bother them as that's the main way most of us learn. Sometimes I don't know I need to learn something until someone asks a question that I didn't think about.

I honestly don't think anyone of these people that are helping you think you are bothering them.
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-10-2008 15:51
Aww shucks... Thanks for your kind comments, (everyone) they are like a hot shower on a cold day.

To business!
EDIT: I should add that I'm using Jess's example in the root prim.
I tried putting this into a dialog.

else if (message == "One";){

llSetLinkTexture(link,llGetInventoryName(INVENTORY_TEXTURE,link - 1),ALL_SIDES);}


How can I save/use llDetectedLinkNumber(n), from any prim, to be used by llSetLinkTexture(link, for use in a dialog choice?

edited again...
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-10-2008 19:41
Is it possible to write the link number to Object Description and reuse that to send llSetLinkTexture?
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-10-2008 20:07
What is the final outcome of the script you are looking for. Not how to do it but what you envision?

HUD texture organiser?

Walls or windows that change in a house?

It might be easier saying what you want as a final product and then we can more easily help you achieve it.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-10-2008 21:08
Yes, walls and windows changer, mostly. I already have a script that does all I want but i want to get the textures into one prim instead of all of them. I will make it easier for a customer to upgrade to a new texture pack to change the whole look of a build.

I got the link number to be written to the objects description but am having trouble re casting it back to integer to be used by set link texture.(I think that's what Im trying to say)

CODE

integer n;
string linkit;
integer link;
integer s;
integer CHANNEL = -12569; // dialog channel
list MENU_MAIN = ["One","Two"];

default
{
state_entry() {
llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
llSetLinkTexture(LINK_SET,"5748decc-f629-461c-9a36-a35a221fe21f",0);
//integer link = llDetectedLinkNumber(n);
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL);
integer link = llDetectedLinkNumber(n);
llSetObjectDesc((string) link);
llOwnerSay((string)link);
//llSetLinkTexture(link,llGetInventoryName(INVENTORY_TEXTURE,link - 1),ALL_SIDES);
}

listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_MAIN,[message]) != -1) // verify dialog choice
{
llSay(0, name + " picked the option '" + message + "'."); // output the answer

if (message == "One")
{
llOwnerSay(llGetObjectDesc());
llOwnerSay((string)n);
}
else if (message == "Two")
{
string linkit = llGetObjectDesc() ;
//llSetLinkTexture(3,llGetInventoryName(INVENTORY_TEXTURE,2),0);//Works ok
llSetLinkTexture(llGetObjectDesc((integer) linkit),llGetInventoryName(INVENTORY_TEXTURE,2),0); //No working here
}
}
else
{ llSay(0, name + " picked invalid option '" + llToLower(message) + "'.");} // not a valid dialog choice
}
}
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
Success!
06-10-2008 21:37
Well I got it in the end. At least I think I got what I want it to do.Until I do some more testing. But It looks right.

string linkit = llGetObjectDesc();
llSetLinkTexture((integer) linkit,llGetInventoryName(INVENTORY_TEXTURE,3),0);
Do you know how many combinations there are of where brackets can go? Trial and error is how I do it.

Now I can click any prim and set a particular texture to a particular side with the textures contained inside only one prim.If I can get this implemented into my existing script successfully I can move onto adding access lists.
Ok step 134.2 done. lol.Ill bet it's not the end though. Another many to go. Thanks for your help too.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-10-2008 22:12
Now I think about it, I must have everything linked to the root prim which will contain the main script. I cannot link the whole build anymore or every prim will be live among other issues like hollow box prims and different sides.
So It's gonna be a long time before I get what I actually want. At least this tiny part of my problem is solved. I think. It can be used for other things so that's a bonus. Bye for now.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
06-11-2008 01:09
From: Kornscope Komachi
Now I think about it, I must have everything linked to the root prim which will contain the main script. I cannot link the whole build anymore or every prim will be live among other issues like hollow box prims and different sides.
So It's gonna be a long time before I get what I actually want. At least this tiny part of my problem is solved. I think. It can be used for other things so that's a bonus. Bye for now.


Not sure why you are using the link number by description idea?
Unless your script is resetting itself any data stored in a global variable is persistent.
I tend to build lists of named sections against link numbers i.e. "wall 1 3 5 6", "window 2 7 9" ..... to hold this kind of data and then iterate the list to set the textures as required.

You dont need everything linked, but you will need more scripts.
You can use a localised 'texture server' that contains all of the main system for texture look up and assignment but have it broadcast the UUID on a "secured" channel to other repeaters for other link sets or individual prims. The repeaters would then listen and perform the required functions.
_____________________
I'm back......
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-11-2008 02:50
From: Newgate Ludd
Not sure why you are using the link number by description idea?

I used that because I thought it was the way to go. I don't know any better and because it worked when I tried it.
I'll look into lists Newgate and thanks for your suggestions.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
1 2