|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
12-09-2008 12:19
I want to wear something and, when I say "/9 on", for it to play an anim for 10 seconds and then stop. What happens with this is that, the first time I say "/9 on," it starts the anim and, even though it's started to animate me, it asks me for permission to animate me twice. Then, even though I've twice given it permission, it doesn't seem to want to play the anim the next time I say /9 on. What obvious mistake am I making this time, I wonder.... key user; integer mychannel = 9; default { state_entry() { llListen(mychannel, "", llGetOwner(), ""); } attach(key id) { user = id; } listen(integer channel, string name, key id, string message) { if (message == "on") if (llGetPermissionsKey()!=id) llRequestPermissions(user,PERMISSION_TRIGGER_ANIMATION); }
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { string animation; animation = llGetInventoryName(INVENTORY_ANIMATION,0); if (animation != "") { llStartAnimation(animation); llSleep(10); llStopAnimation(animation); } } } }
|
|
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
|
12-09-2008 12:40
From: Innula Zenovka I want to wear something and, when I say "/9 on", for it to play an anim for 10 seconds and then stop. What happens with this is that, the first time I say "/9 on," it starts the anim and, even though it's started to animate me, it asks me for permission to animate me twice. Then, even though I've twice given it permission, it doesn't seem to want to play the anim the next time I say /9 on. What obvious mistake am I making this time, I wonder.... key user; integer mychannel = 9; default { state_entry() { llListen(mychannel, "", llGetOwner(), ""); } attach(key id) { user = id; } listen(integer channel, string name, key id, string message) { if (message == "on") if (llGetPermissionsKey()!=id) llRequestPermissions(user,PERMISSION_TRIGGER_ANIMATION); }
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { string animation; animation = llGetInventoryName(INVENTORY_ANIMATION,0); if (animation != "") { llStartAnimation(animation); llSleep(10); llStopAnimation(animation); } } } }
try this maybe... integer mychannel = 9; default { state_entry() { llListen(mychannel, "", llGetOwner(), ""); }
attach(key id) { llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION); }
listen(integer channel, string name, key id, string message) { if ((message == "on") && (llGetPermissionsKey()!=id) && (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { string animation; animation = llGetInventoryName(INVENTORY_ANIMATION,0); if (animation != "") { llStartAnimation(animation); llSleep(10); llStopAnimation(animation); } } } }
The llRequestPermissions() could likely be in state_entry as well. Basically you just want to ask for permissions the one time when it's attached. The run_time_permissions event isn't really necessary in this case. Just check for perms with llGetPermissions in the listen() and play the animation if you have it.
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
12-09-2008 13:38
Ah.. the obvious mistake i was making (one of them) was that one of the requests was coming from a previous version of my gadget that I'd left laying round the building platform. I feel such a fool. With a bit of tinkering, this seems to do the trick: key user; integer mychannel = 9; default { state_entry() { llListen(mychannel, "", llGetOwner(), ""); } attach(key id) { user = id; } listen(integer channel, string name, key id, string message) { if (message == "on") if (llGetPermissionsKey()!=id) llRequestPermissions(user,PERMISSION_TRIGGER_ANIMATION); }
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { string animation; animation = llGetInventoryName(INVENTORY_ANIMATION,0); if (animation != "") { llStartAnimation(animation); llSleep(10); llStopAnimation(animation); } } } }
|