llGetInventoryKey( "string" ); broken?
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-28-2004 04:39
HI I recently had an odd experienced key val = llGetInventoryKey( "string" ); I was retrieving a key of an animation in an primitive inventory, but llGetInventoryKey( "string" ); would only return NULL_KEY. I know the script was in the right inventory, the same inventory as the animation. And I know the animation name was and is valid. The animation was created by a different player. And the only right I had was Resell/Give Away.
Has any one herd of this happening? And if so what conclusions did you come to? It's late... I'm going to look into this further tomorrow.
|
Ardith Mifflin
Mecha Fiend
Join date: 5 Jun 2004
Posts: 1,416
|
11-28-2004 05:01
Well, you can't manually copy the UIUD of an animation in your inventory for which you don't have permissions, so it does not surprise me that you would not be able to do so using llGetInventoryKey(). Now, if it were the other way around, I'd be surprised.
|
Ace Cassidy
Resident Bohemian
Join date: 5 Apr 2004
Posts: 1,228
|
11-28-2004 05:48
Ardith is correct. If you don't have copy permissions for the item in inventory, then llGetInventoryKey() returns NULL_KEY. This is to prevent a script from being able to grab the key so that the item might be referenced elsewhere, thus defeating the copy protection mechanism.
- Ace
_____________________
"Free your mind, and your ass will follow" - George Clinton
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-28-2004 13:20
ummm soon as the animation is playing. I can get the key. If having the key was all I needed to "steel an animation" every one who let's you preview animations would be in big trouble. You can't start an animation, unless it's in the same inventory as the script. Thus knowing the key is not anuff to steel it.
|
Ace Cassidy
Resident Bohemian
Join date: 5 Apr 2004
Posts: 1,228
|
11-28-2004 13:24
From: Kurt Zidane ummm soon as the animation is playing. I can get the key. Really? Pray tell, how... llStartAnimation() and llSetTexture(), while listed as taking strings as arguments, can both also accept keys. If a key is passed, the item doesn't necessarily have to be in inventory. - Ace
_____________________
"Free your mind, and your ass will follow" - George Clinton
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-28-2004 13:56
list listOfKeys = llGetAnimationList( key avatar);
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-28-2004 18:27
ok.. this isn't too cool. I rewrote my stopAnimation function to use name insteed of key. But llKey2Name dosen't seem to work. :\ It just returns "". Even though I know the key is the valid key. and the animation is in the same inventory as the script. :\
I guess i'll use a stoppAllAnimation function. But I would rather not. But I can't expect people to sell aniamtions with only certnin combinations of rights enabled. And I can't expect the people who use my scripts to under stand why some animations work right and others don't. I'm kind of serprised that no one has buged me about this bug. lol
I really think animation should be based on keys. We shouldn't even need to know the name of the animation. Name can be duplicated, Key can not. I would like to have my script work properly even if there were 10 animations all named bob.
|
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
|
11-28-2004 23:49
llKey2Name only works if the script and the asset with the key in question are in the same sim. Attachments are counted as being in the same sim as your avatar, and items in your inventory are not in any sim. If llKey2Name doesn't work, you need to use dataserver requests to get the information.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-29-2004 00:31
I'm not talking about my inventory, but the inventory of the object with the script in it. So the object is in the sim. And thus wouldn't the inventory be in the sim as well?
I've already started playing with Data server. It's quite useful. But in this case it turns a function that take about 5 second into a function taking any where from a minute to ten minutes. :\ Some times it seems as if it just locks up. :\
*muses on how to tie data server, usually done as a two state process? into a one state script. * Per loaded a list with key to name data? Rewrite the hole script into 50 or so states. manually load the key if GetInventoryKey( "string" ) returns null_key. Every thing I think up causes lock up or loss of input data. :\
I wonder if I can put the a function into a loop, and use that to wait for the data server to return results or time out.
|
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
|
11-29-2004 03:26
From: Carnildo Greenacre llKey2Name only works if the script and the asset with the key in question are in the same sim. Or in the case of an Avatar key. Kurt, i understand how you feel a bit... however, if you make an animation and name it "Bob"... and then make another animation (or anything for that matter) named "Bob" and dropped them both into the inventory of an object--what happens? You end up with a "Bob" and a "Bob 1". So in retrospect to the issue you are having, strings are still "unique" within a given object. So with that in mind... if all you are trying to accomplish is stopping an animation in that object's inventory, then this should be sufficient: stopAnimations(){ integer i; for( i = 0 ; i < llGetInventoryNumber( INVENTORY_ANIMATION ) ; i++ ){ llStopAnimation( llGetInventoryName( INVENTORY_ANIMATION, i ); } } I appologize if there is an error in that function, i'm coding it from 'air'. Let me know if you need further help. --Water
_____________________
From: Philip Linden For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-29-2004 16:20
actually that function has a flaw. It assumes that all animations in inventory are playing. UNless some thing has changed in the last couple of vertions. That function could return many error messages. One for each animation not playing. In the case of a multi animtion chair or braclet. that could be like 50 messages of " can not stop animation (key) because it is not playing." scroling across the screen. Witch is why I used: //creates a list of all animations being played, and compares that list to the passed list // if the passed key is on he list, the value is stoped. stopAnimation( key stopThisAnimation, key user ) { list currentlyPlay = llGetAnimationList( user ); integer listLagth = llGetListLength( currentlyPlay );
integer counter = 0; for (counter = 1; counter <= listLagth; counter++) { if ( stopThisAnimation == llList2Key(currentlyPlay, counter - 1) ) { llStopAnimation(stopThisAnimation); } } }
but because I can not assume the name to key thing. This code had to be modifed. if I wanted to stop all animations i'd use this code, bcause it won't result in any error messages: //stops all animations being played. //this function uses 1 as first number aposed to 0 //creates a list of playing animations, and then stops each animation in list stopAllAnimations(key id) { list animations = []; animations = llGetAnimationList(id); integer listLagth = llGetListLength(animations);
integer counter = 0; for(counter = 1; ( (counter > 0) && (counter <= listLagth) ); counter++) { llStopAnimation(llList2String(animations, counter - 1)); } } because i'd rather only stop the animation I want to stop, and not all animations being played. I've merged error protection into my stop. As a temporary sultion. Untill the inventory thing changes or untill I make a data server event. integer ugly = FALSE;
//creates a list of all animations being played, and compares that list to the passed list // if the passed key is on he list, the value is stoped. stopAnimation( key stopThisAnimation, key user ) { if ( stopThisAnimation != NULL_KEY ) { list currentlyPlay = []; currentlyPlay = llGetAnimationList( user ); integer listLagth = llGetListLength( currentlyPlay );
integer counter = 0; for (counter = 1; counter <= listLagth; counter++) { if ( stopThisAnimation == llList2Key(currentlyPlay, counter - 1) ) { llStopAnimation(stopThisAnimation); } } } // this code is an 'ugly hack.' It's here because of the flaw in llGetInventoryKey() // in the case you stop NULL_KEY, it will stop all animaitons else { if ( ugly == TRUE ) { llStopAnimation( animationName ); } else { stopAllAnimations ( user ); } } }
//stops all animations being played. //this function uses 1 as first number aposed to 0 //creates a list of playing animations, and then stops each animation in list stopAllAnimations(key id) { list animations = []; animations = llGetAnimationList(id); integer listLagth = llGetListLength(animations);
integer counter = 0; for(counter = 1; ( (counter > 0) && (counter <= listLagth) ); counter++) { llStopAnimation(llList2String(animations, counter - 1)); } }
|
Ace Cassidy
Resident Bohemian
Join date: 5 Apr 2004
Posts: 1,228
|
11-29-2004 16:36
From: Kurt Zidane list listOfKeys = llGetAnimationList( key avatar); Inteteresting. I'll have to play with this while playing some No Copy animations. If it behaves as you say, then this is definitely a copy protection hole in LSL. - Ace
_____________________
"Free your mind, and your ass will follow" - George Clinton
|
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
|
11-29-2004 19:13
stopAnimations(){ integer i; for( i = 0 ; i < llGetInventoryNumber( INVENTORY_ANIMATION ) ; i++ ){ llStopAnimation( llGetInventoryName( INVENTORY_ANIMATION, i ) ); llWhisper( 0, "Stopped " + llGetInventoryName( INVENTORY_ANIMATION, i ) ); } llWhisper( 0, "Done" ); }
default { state_entry() { llRequestPermissions( llGetOwner(), PERMISSION_TRIGGER_ANIMATION ); }
touch_start(integer total_number) { stopAnimations(); } } I'm not having any issues with this at all... I just tested it with a bunch of different animations - some with no copy/no mod and some with all permissions. I didn't receive any errors and none of them were playing. here's the output: Object whispers: Stopped Reverie-Cuddle Pose 1a Object whispers: Stopped Reverie-Cuddle Pose 1b Object whispers: Stopped Reverie-Cuddle Pose 2a Object whispers: Stopped Reverie-Cuddle Pose 2b Object whispers: Stopped Reverie-Cuddle Pose 3a Object whispers: Stopped Reverie-Cuddle Pose 3b Object whispers: Stopped Reverie-Cuddle Pose 4a Object whispers: Stopped Reverie-Cuddle Pose 4b Object whispers: Stopped Reverie-Cuddle Pose 4b-large Object whispers: Stopped Reverie-Cuddle Pose 5a-forward Object whispers: Stopped Reverie-Cuddle Pose 5a-side Object whispers: Stopped Reverie-Cuddle Pose 5b-back Object whispers: Stopped Reverie-Cuddle Pose 5b-facing Object whispers: Stopped Reverie-Slap Object whispers: Done I don't know how you are getting that error, because i have never seen it before for as long as i've been playing. Stop Animation has always either stopped whatever animation it is you're asking it to stop, or "ghost stopped" -- meaning you aren't playing the animation, but there are no errors - it'll still "stop" you. --Water
_____________________
From: Philip Linden For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
11-29-2004 20:46
> Inteteresting. I'll have to play with this while playing some No Copy animations. If it behaves as you say, then this is definitely a copy protection hole in LSL.
Well, it is and it isnt, but it is the reason why you must have an animation in the objects inventory in order to play it.
Azelda
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-29-2004 20:49
Well that because all the animations your stopping are running. I can think of a few ways your script could be fooled. Such as a non looped animation. Or If some one removed an animation from the primitive while they were sitting. What happens if some one had an animation override witch was using an animation with the same name as one of your animation in your object? Or if they used a hard kill animation script, stopping all animations being played, while they were sitting.
|
Ace Cassidy
Resident Bohemian
Join date: 5 Apr 2004
Posts: 1,228
|
11-29-2004 21:04
From: Azelda Garcia From: Ace Cassidy Inteteresting. I'll have to play with this while playing some No Copy animations. If it behaves as you say, then this is definitely a copy protection hole in LSL. Well, it is and it isnt, but it is the reason why you must have an animation in the objects inventory in order to play it. Azelda Yes... That is what I discovered when I played around with this earlier this evening. I could grab the key from a No Copy dance animation that was being driven by my dance bracelet, but when I tried to llStartAnimation() using only the key without the animation in the other object's inventory, it failed. So I guess its not a glaring hole in the copy protection mechanism afterall. - Ace
_____________________
"Free your mind, and your ass will follow" - George Clinton
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
11-29-2004 23:30
Ok I just tried some testing in land about stop start. It seems those two command have been modified. They no longer give error messages. I know they use to. In-fact that the hole reason I created a stop animation function was to prevent error messages. But sense stop no longer give error message, I guess I can remove the function.
that or the error message are being repressed, if they are I don't know how to get my client to display the messages again.
earlier today I had an encounter with an animation ball made by another person. It gave an error message, the one about permission not granted. But the message happened only the first 3 times I used the ball. After that, the message would not come up again. O.o Not to make a refrence to the matrix, but I feel like I have fallen into the rabbit hole, and have no clue what's going on.
I wish LL had documented the changes in sls. It looks as if all my work with animation scripting have become outdated. I'm thinking I might have to retest all the basic ll eliments, and find out what has changed in ll.
|
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
|
11-30-2004 04:16
Good to hear you got it working....
llStopANimation() WILL give errors if PERMISSION_TRIGGER_ANIMATION is not set to TRUE and you try stopping or starting an animation. The error you are encountering has to do with Permissions, however -- not animations.
In fact, there was an object (or several) made a while back in beta i believe... where you could start and stop any default animation. If you were to get stuck in any animation, all you would have to do is say "stop all" and it would loop through every default animation and stop them.... so there were no error messages then on stopping animations that aren't playing.
If you don't set permissions... and you try to stop an animation, you will receive an error (which is why in the script example i gave you, i had a permssion_trigger_animation request in the state entry -- even though i never started an animation).
--Water
_____________________
From: Philip Linden For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
|
Tad Jensen
Script Junkie
Join date: 29 May 2004
Posts: 24
|
11-30-2004 07:13
From: Kurt Zidane Ok I just tried some testing in land about stop start. It seems those two command have been modified. They no longer give error messages. I know they use to. In-fact that the hole reason I created a stop animation function was to prevent error messages. But sense stop no longer give error message, I guess I can remove the function.
that or the error message are being repressed, if they are I don't know how to get my client to display the messages again.
earlier today I had an encounter with an animation ball made by another person. It gave an error message, the one about permission not granted. But the message happened only the first 3 times I used the ball. After that, the message would not come up again. O.o Not to make a refrence to the matrix, but I feel like I have fallen into the rabbit hole, and have no clue what's going on.
I wish LL had documented the changes in sls. It looks as if all my work with animation scripting have become outdated. I'm thinking I might have to retest all the basic ll eliments, and find out what has changed in ll. The Wiki is your friend... "PERMISSION_* not set!" errors are now sent as popup alerts to the object owner rather than as public chat. http://secondlife.com/badgeo/wakka.php?wakka=Revisionsor... check out the release notes occassionally /32/12/26960/1.html
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
12-01-2004 04:24
lol I knew about that change. I didn't know about stop animation no longer returns error an error message when you try to stop an animation that isn't playing.
|