Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Setting A Prims Texture Via Another Prim

Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 12:52
I know my title is confusing so let me go into some detail. I am working on scripting a anew object, but know very little of the language so I am fumbling through the LSL Wiki in the dark. I want to try to script this object myself, but before I spend a lot fo time on it, I want to make sure the things I want to do are even possible. One thing I am wondering if it is possible to change the texture of multiple prims by changing the texture of a single prim. The primss will not be linked or even near each other. Is it possible to set the texture of the object to be the same as that of another object?
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
10-15-2006 12:59
Check the communications page of the wiki, you will need to have full permissions on the texture displayed on the prim, and then use some sort of communication method to send the uuid of the texture to the other prim, then you will have to use llSetTexture, providing the UUID of the texture to be used.

Ps. Their is currently no llSetLinkTexture, so if you want to put the texture on multiple prims, I would use llMessageLinked to send the UUID from the main controller script to the child scripts in the objects other prims, then use llSetTexture for each individual prim.
_____________________
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 13:03
How do you get the UUID of a texture uploaded to the game by a user? I read the section on it it and am a little confused.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
10-15-2006 13:05
If you have full permissions to a texture, you can right click it in your inventory and select "copy uuid" then ctrl + v that copied uuid to your script editor. If you have an object that is full perms, you can use llGetTexture to return the uuid of the texture.
_____________________
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 13:07
Also, llMessageLinked seems to be for linked prims. My prims will not be linked or even near each other.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
10-15-2006 13:08
From: Boq Beauchamp
Also, llMessageLinked seems to be for linked prims. My prims will not be linked or even near each other.

I meant to use it if one of the objects you are sending the UUID to is multi prim and needs the texture on more than one prim of the object.
_____________________
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-15-2006 13:08
You can't use llMessageLinked if the objects aren't linked. Just depending on the distance you can use llWhisper = 10 meters, llSay = 26 meters, llShout = 100 meters. Any farther then that and you will have to go with email.

There is a list on the bottom of the communications page showing what can communicate with what.
_____________________
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
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-15-2006 13:11
To get the UUID of a texture just right click it in your inventory and "Copy asset UUID"
_____________________
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
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 13:41
Decided I have to use email and am setting that up. I have the "llGetTexture" code in the base object, now how do I send that number in the message of the email? Once sent how do I take that number from the email in the second object and use it as the texture. I'm used to working with variables in C++ and I feel like this just doesn't work the same at all lol, what do I do? What does it do with the knowledge it gets from "llGetTexture" and how do I retrieve it. Thanks for all the help.
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 14:43
Okay, I think I figured out how to send the number, but how do I retrieve it from the email so I can set the texture of the receiving prim. I tried making a variable like below but it doesn't work.

CODE

string Texture = llGetNextEmail;
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-15-2006 15:43
You need to use the email event. That will, amongst other things, let you get the message and the subject line. Given what you're sending the subject line is probably as good a place to send and receive as any other.

So you'd send llEmail(#your destination#, llGetTexture(), "";);

use llGetNextEmail in a timer event and then
CODE
email(string time, string address, string subj, string message, integer num_left)
{
llSetTexture((key)subj, ALL_SIDES);
}


or equivalent.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 15:56
From: Eloise Pasteur
You need to use the email event. That will, amongst other things, let you get the message and the subject line. Given what you're sending the subject line is probably as good a place to send and receive as any other.

So you'd send llEmail(#your destination#, llGetTexture(), "";);

use llGetNextEmail in a timer event and then
CODE
email(string time, string address, string subj, string message, integer num_left)
{
llSetTexture((key)subj, ALL_SIDES);
}


or equivalent.



Thank you but I don't understand this. I already have the email events, but I don't know how to get the information out of the email and make it the texture. I don't know how to use what you gave. I wouldn't know what to put for string time, string address, string subj, string message, or integer num_left. I'd appreciate further explanation. Below I put what I have in the recipient prim so far.

CODE


default
{
state_entry()
{
llSetTimerEvent(1.0);
}
timer()
{
llGetNextEmail("80065c76-a1ac-6525-9459-9e75c91b2787@lsl.secondlife.com", "Texture");

llSetTexture(DON'T KNOW WHAT TO PUT HERE, ALL_SIDES);
}

}


Also, do I really want the texture as the subject when sending the email? That's how you set it up. If that's the case, I don't know what to put as the expected subject of incoming emails.
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-15-2006 16:19
Okay, I used the code exactly has you had it and made some changes so that the info was the subject. All the code compiled correctly, but it's not working.

EDIT: I need to be able to put the llsettexture in a timer, but I can't because it is already in "email"...whatever that is called. It's already in brackets for the email thing and therefore can't be for timer. I have the send and receive in timers and need to do this for set texture now.
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
10-16-2006 05:29
You need some global variables at the start of the script.

I usually use m_ and others use g_ to keep them from being confused from regular variables.
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-16-2006 06:15
Can you explain what you mean please? Global variables for what? How do I declare them and how do I use them? I wish I knew the names for parts so I could properly explain them, but I need the things like "timer ()" and "email()" (whatever these are called) so I can't put that information inside something else. How do I use variables?
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-16-2006 07:47
With the greatest respect can I suggest you start at the sticky labelled "new scripters start here" and try some of the tutorials etc. Scripting tips is almost certainly not the best place to try and learn how to script from the ground up, which is what you're gradually asking for.

To answer your questions... timer(), touch_start() etc. are called events. You can read more about them on the wiki under events.

Global and local variables are defined basically in the same way (globals can't be called with a function immediately allocated to give them a value) the difference being that globals are declared before the start of the default state (aka "at the top of the script";), locals are defined within an event scope, or sub-scope of that and are only available within that scope or any sub-scopes described within it. Variables (e.g. touch_start(integer total_number)) define variables which are local to the event, but which are passed to the event as part of it's trigger, hence their specialised position. You can find more about this, and variable types under the variables heading, and most of the specific functions (library calls) that manipulate them under their individual listings.

Things like llSetTexture() are called functions, library functions, library calls etc. They should probably not be called functions, because you can define functions within a script which then gets confusion, but that's what they're called on the wiki, but as you can see I call them functions anyway, ah well.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Tad McConachie
Registered User
Join date: 6 Oct 2006
Posts: 76
10-16-2006 08:04
I second what Eloise said. I'm a noob scripter myself. I've started with much simpler ideas and am slowly working my way up to being able to do more cool stuff. I'd suggest starting with REALLY simple stuff extrapolated from the existing scripts in the wiki.

For instance, I've created a panel that spins when you click it and tells you your name when you get close to it. I created another panel that looks at you and turns around based on your position when you click on it. I've also experimented with extremely simple vending applications.

All along I've had to learn about variables, about the different events and about the library functions. Everything that I needed to know I found in the wiki, or by just browsing this forum.

It sounds like you're almost there, but if you rely on everyone here in the forum giving you hints you'll end up with a cool script and not understand how it works. That won't help you in the future.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-16-2006 09:28
and thirdly(is that a word?) from another new scripter. When things aren't working right in a script then simplify, simplifly, simplifly. For example if you can't seem to get the emails to go to the right places yet etc. Make your script where it will llOwnerSay("email rcvd";) for example. Don't worry about trying to get the email to actually start doing something with the textures yet. Take it step by step and as each step works then add in the next step. Use debugs like llOwnerSay everywhere to see where you are at in the script and what isn't activating. Even if you have a background programming in other languages, start small here and build up your knowledge and scripts.
_____________________
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
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-16-2006 15:36
So is that it? Is no one going to give anymore help? Has anyone considered that I have spent hours and hours reading the wiki and testing scripts? I keep giving up on my goal and choosing a simplier one, but now I can't even get there.

How am I supposed to know if it's getting the email if I don't know how to make it do what I want. Scripting it to tell me the email was received is going to be as difficult as (and require the same knowledge as) changing the texture.

I need one more step and no one will help me with that? I just need to put one event inside another. Email event inside a timer. That's all I need.

Also, a wiki that actually made since to a beginner might be worth looking into.
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-16-2006 15:51
Thank you for the suggestions, unfortunately I've gone as far as I can with the wiki. I have spent hours pouring over it and working with example scripts. It is not oriented for a beginner scripter, but I did my best with it. I figured out how to send and receive emails from it. I learned that I had to use a timer. Now all I need to know is how to get the prim use the information it receives in the email. I need to use the email event for this, but that event doesn't do what I ask it to if it is not initiated regularly. I just need to know how to put it in some sort of time. I have the script for it already. In fact, I have the whole script except for this crucial part. With out it the script is worthless. I just don't see how playing with "baby scripts" is going to give me this info. I have read the timer section over and over. I have read the email section over and over. I just don't know what to do. One step away and everyone has given up on me. Please help me.

P.S. I guess my most recent question was "How will global variables help?" I was instructed to use them, but I didn't understand what I was using them for. I knew that he meant declare them at the top, but what exactly am I declaring?
Boq Beauchamp
Registered User
Join date: 3 Oct 2006
Posts: 59
10-16-2006 17:56
I did it. After further digging in the wiki I realized that what I had for displaying the texture was exactly right. So I realized that the email wasn't getting received. I added a script for the prim to say it's key and turns out I had the wrong key. I fixed it and it instantly worked. Now I need to figure out how to seet a textures perameters (number of repeats per horizontal and vertical) but I should be able to find that. Thanks all. Now only if this were even a small fraction of the final script lol.