|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
06-16-2008 22:35
Sorry I cant think of a clearer way to say this. Is it possible for one child prim, to animate an avatar on another child prim's sit target? The animating prim *says* that it has permissions for the correct avatar (thank heavens for debugging!!) and knows what animation it should be playing. But the avatar just stands there. ...gee maybe it would help if I put in the script - DOH! sorry!
link_message(integer sender_num, integer num, string message, key id) {
//this just handles the choice of animation and works dandy
if(message == "User is") { list options = []; integer y; string anim = llGetInventoryName(INVENTORY_ANIMATION, current); string text = "Choose animation:"; if(anim == nullstr) { anim = "sit"; } if(anim != nullstr) { text += "\n \n Current animation: \n" + anim; } llDialog(id, text, POSES, randchan); }
//here's where I guess I'm having my issues? else if(message == "Avatar Sitting") { if(id != nullkey) { list wiggles = llGetAnimationList(id); integer x = llGetListLength(wiggles); integer y = 1; if (x > 0) { while(y <= x) { llStopAnimation((string)llList2List(wiggles, y, y)); y++; } }
llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION); } else { llSetTimerEvent(0); StopAnimation(llGetAnimation(id)); } } }
//Obviously the llSay is just a debugging thing - seems to give me the answers I think I should have
run_time_permissions(integer value) { llSay(0, "I have permissions for " + (string)llKey2Name(llGetPermissionsKey())); if (value & PERMISSION_TRIGGER_ANIMATION) { string name = llGetInventoryName(INVENTORY_ANIMATION, current); StartAnimation(name); llSay(0, "I think I still have permissions for " + (string)llKey2Name(llGetPermissionsKey())); } }
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
06-17-2008 00:31
Quite possible, I believe. The avatar doesn't actually sit on a prim, but on an object. Where the sit targets are, and particularly the sit target of the prim that the avatar clicked on to sit, just chooses a place for the avatar to sit. The sit target or the avatar can be moved independently after that, and all that will change is whether or not llAvatarOnSitTarget() returns the avatar's key or not. I don't believe there is anything tying the avatar to the prim for which the sit target was set. Maybe we should confirm that with testing, but it makes sense logically the way linking is set up.
|
|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
06-17-2008 07:10
This may sound like a strange question, but are you requesting any other permissions in that script?
I ask this because my pose vendors recently broke because I was mixing my debit permission in the same script with the sitting avatar's animation permission. It used to work, but it was never supposed to.
The sitting avatars would just sit (or stand) there.
I removed the debit permissions and everything went back to working.
|
|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
06-17-2008 08:15
Nope - just asking for permission to animate.
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-17-2008 08:32
Check that id is really getting populated with the correct avatar UUID. What's being sent in that link message is kind of a mystery from the snippet posted here. (I see it's printing something but we don't get to see the whole thing here.) Oh, and a separate bit, you want to do that animation stopping loop after you get the permissions, you need them for both start and stop. From: Moon Corrigible Nope - just asking for permission to animate. Any other permissions requests in the same object, even different scripts? they can interact in surprising ways.
|
|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
06-17-2008 10:03
Permissions seem to be granted for the correct avatar.. I used llSay(0, "I think I still have permissions for " + (string)llKey2Name(llGetPermissionsKey()));
to find out who it had permissions for and it kept spitting out my name.
If the user touches the other child prim it sends a link message with "User is" as the string, the key of the user who touched it and a dummy integer to just that other child prim in order to kick off a dialog message allowing the user to determine which sit pose they want - that works great. If the person sits on the other prim afterwards they go into the correct position no worries.
My problem is that these two child prims are sort of wrapped around each other and I dont want the user to have differentitate exactly where they click to sit.
If a person sits on that secondary sending child prim, it sends "Avatar Sitting" as the message along with the key of the person sitting and, again, a dummy integer. I cant see why that doesnt work but, though it puts the person in the correct spot - the avatar just stands there.
OH! and thanks for the bit about stopping the animations later and no, no other permissions are being requested at all.
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-17-2008 17:54
Ok, I played with this, the changed events can get in your way and ruin your day if you aren't careful. I built a 3-prim object with a do-nothing root prim and two scripted children. The first child contains the animation in its inventory, the second child I am calling the "remote", asks the first child what to do. In this example I rigged things so that only one of the two children can be sat on at any time, and that's because a script can only handle permissions for one agent at a time. This could use a little cleaning (inventory check for one), but it does basically work. // Script for the first child prim, the one that has the animation in it
key sitting_av = NULL_KEY; key remote_av = NULL_KEY; string anim_to_play;
setup() { sitting_av = NULL_KEY; llSitTarget(<0., 0., 1.5>, ZERO_ROTATION); anim_to_play = llGetInventoryName(INVENTORY_ANIMATION, 0); llOwnerSay("animation is " + anim_to_play); }
do_unsit_stuff() { if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { if (llGetPermissionsKey() == sitting_av) { if (llGetAgentSize(sitting_av)) { llStopAnimation(anim_to_play); } } // perm key } // permission sitting_av = NULL_KEY; }
default { state_entry() { setup(); } on_rez(integer rezparam) { setup(); } link_message(integer sender, integer num, string str, key id) { if (str == "av on") { if (sitting_av != NULL_KEY) { // we seem to have someone already if (sitting_av != remote_av) { // and it's not you llMessageLinked(LINK_SET, 0, "remote kick", ""); remote_av = NULL_KEY; } } else { remote_av = id; sitting_av = remote_av; llOwnerSay("remote av on " + (string) id + " - " + llKey2Name(id)); llRequestPermissions(sitting_av, PERMISSION_TRIGGER_ANIMATION); } } // av on else if (str == "av off") { llOwnerSay("remote av off"); remote_av = NULL_KEY; do_unsit_stuff(); } // av off } changed (integer change) { if (change & CHANGED_LINK) { key new_av = llAvatarOnSitTarget(); if (new_av) { if (remote_av) { // only do this if there is someone on the other prim llOwnerSay ("kicking, already someone on remote"); llUnSit(new_av); } else { // ok we are local if (sitting_av != new_av) { // really someone new? sitting_av = new_av; llRequestPermissions(sitting_av, PERMISSION_TRIGGER_ANIMATION); } } // remote_av } else { if (remote_av == NULL_KEY) { // only do this if there is no one on the other prim do_unsit_stuff(); } } // new_av } // CHANGED_LINK } // changed
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llOwnerSay("got permission for " + llKey2Name(sitting_av)); llSleep(0.5); // give AO a chance to do its thing if (llGetAgentSize(sitting_av)) { // still here? llOwnerSay(llKey2Name(sitting_av) + " is still here"); list old_anims = llGetAnimationList(sitting_av); integer i; for (i = llGetListLength(old_anims) - 1; i >= 0; i--) { llStopAnimation(llList2String(old_anims, i)); } llStartAnimation(anim_to_play); } // llGetAgentSize } // permission }
}
// script for the second child prim, the one I am calling the "remote" key sitting_av;
setup() { sitting_av = NULL_KEY; llSitTarget(<0., 0., 1.5>, ZERO_ROTATION); }
default { state_entry() { setup(); } on_rez(integer rezparam) { setup(); } link_message(integer sender, integer num, string str, key id) { if (str == "remote kick") { llOwnerSay("kicking remote"); sitting_av = llAvatarOnSitTarget(); if (sitting_av) { llUnSit(sitting_av); sitting_av = NULL_KEY; } } } changed (integer change) { if (change & CHANGED_LINK) { key new_av = llAvatarOnSitTarget(); if (new_av) { if (sitting_av != new_av) { // really someone new? sitting_av = new_av; llMessageLinked(LINK_SET, 0, "av on", sitting_av); } } // new_av else { // only send a message is someone was sitting on our target if (sitting_av != NULL_KEY) { llMessageLinked(LINK_SET, 0, "av off", NULL_KEY); sitting_av = NULL_KEY; } } // else } // CHANGED_LINK } // changed
}
|
|
Moon Corrigible
Registered User
Join date: 19 Jan 2007
Posts: 75
|
06-18-2008 20:57
You are AMAZING!!! THANK YOU!!!!
|