Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Setting textures with keys

Zaplok Riggles
Registered User
Join date: 25 Feb 2008
Posts: 119
03-31-2008 09:05
If I create an object and set it to no modify/copy and send it to someone.... If I have code in that object to let the new owner specify a key to use for a texture, if I use llSetTexture in my script using their key, will that work? Or does the key need to reference a texture within the object? In other words, if the new owner has that texture key in their inventory, will that work or does the texture actually need to be in the inventory of the object I want to change the texture of?

And, if the above DOES work (allowing the texture to be in the new owner's inventory), is there a way to test if a texture key exists so that I can check before attempting to set the new texture?
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
03-31-2008 09:59
It will work. As with all these things the great proof is to try it :) I have an alt that I use specifically to test things like this.
_____________________
http://slurl.com/secondlife/Together
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-31-2008 10:43
Wow.. kinda rambling there, had to read your post 3 times...

You cannot test a key to see if it's a texture, you'll just have to assume that the key given is a texture. The best way to implement it is to have a notecard in the object that the end user can edit and place the key into, then have your object read the key from there. Set the texture as you would if the texture were in the object, except put the key in place of the name.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
03-31-2008 10:49
From: Zaplok Riggles
if the new owner has that texture key in their inventory, will that work or does the texture actually need to be in the inventory of the object I want to change the texture of?

If you refer to the texture by hardcoded key, it will work regardless of who has what in their inventory; the owner doesn't need to have it all. The same with sounds.

In fact, even if you delete it from your inventory and you had the only copy, if there is a script referring to the key somewhere, that asset will not be deleted and the script will keep on working (as long as you have the full UUID of the texture or sound in the script, not something odd like key TEXTURE = "0000-blahblah" + "blahblahblah"; )
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-31-2008 23:08
From: Ordinal Malaprop
If you refer to the texture by hardcoded key, it will work regardless of who has what in their inventory; the owner doesn't need to have it all. The same with sounds.

In fact, even if you delete it from your inventory and you had the only copy, if there is a script referring to the key somewhere, that asset will not be deleted and the script will keep on working (as long as you have the full UUID of the texture or sound in the script, not something odd like key TEXTURE = "0000-blahblah" + "blahblahblah"; )


That's really quite interesting. One would think it would have to reside in someone's inventory somewhere, but apparently not.
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
03-31-2008 23:30
That is true, the client has access to your inventory and can determine whether you own a texture before applying it (assuming your inventory has fully loaded, no comment) but a script cannot search your inventory before applying a texture key.

BTW, while you can't test for a key being a *texture*, you can test if they gave you a properly formed *key* by checking

if ((key)keystring != NULL_KEY)

This will evaluate to TRUE for a proper (but not necessarily valid) key.

Also, when using llSetTexture, string or key does not matter, it will be typecast appropriately but if you must always pass a *string* (and not a key) to llSetPrimitiveParams(). list parameters can be any type so you have to make sure you are putting the correct type in the list when you build it.

You might also want to include a "texture = original" sort of command (whatever fits your syntax) to allow them to revert it (storing the original texture key in the script) in case they give it something heinous.

~Boss