Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Verify UUID of a Texture for llSetTexture()

Dytska Vieria
+/- .00004™
Join date: 13 Dec 2006
Posts: 768
12-10-2007 15:47
I need to add some error checking in a script that uses llSetTexture() to set a texture where it gets the Asset UUID of the texture from a notecard.

Is there a way to verify the UUID exists and that it is a texture before I call llSetTexture()? llSetTexture() does not return any error codes, which would solve the problem if it did!

I look here in the forums and the LSL inworld wiki for a function that would do this to no avail.
_____________________
+/- 0.00004
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
12-10-2007 23:55
There is no way to cross check that kind of thing.

Pretty much the only option is to check whether it is an avatar or not by requesting details on the key.
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
12-11-2007 00:09
From: Squirrel Wood
There is no way to cross check that kind of thing.

Pretty much the only option is to check whether it is an avatar or not by requesting details on the key.

This isn't entirely true; if you call llSetTexture and it uses an invalid key, it'll cause an error saying "Couldn't find texture <insert string here>," and the texture of the face/object will remain the same, at least as far as I've tested. So just check whether the texture has changed keys.

Edit: Argh, okay, I lied. It'll say 'Couldn't find texture' if the input is not in a key format, but otherwise it'll set that texture to the given key, and if it's invalid, it shows the missing image texture. However, there is indeed no way to tell whether that's valid.

Yet.

There will be, once the new search databases finishing indexing all the old texture keys and are then loading up new ones, to my understanding.
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-11-2007 00:38
best you can do is test whether it's a valid key, not which type

if(variableUuidOfTypeKey){ //returns false for NULL_KEY and any invalid key
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Gordon Wendt
404 - User not found
Join date: 10 May 2006
Posts: 1,024
12-11-2007 08:42
It isn't perfect by a longshot but a way to at least do a rough check for a uuid is to do a length check, that won't determine if it's a texture uuid or even in a valid uuid format but it will stop obvious mistakes from getting through.
_____________________
Twitter: http://www.twitter.com/GWendt
Plurk: http://www.plurk.com/GordonWendt

GW Designs: XStreetSL

Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
12-11-2007 08:46
Can't you cast it to a key and see if the result == NULL_KEY?
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left