Change font size
It is currently Sun May 19, 2013 6:17 pm

Forum rules


Image



Post a new topicPost a reply Page 1 of 1   [ 4 posts ]
Author Message
 Post subject: llRequestPermissions() for an NPC
PostPosted: Mon May 21, 2012 1:25 pm 
Furious Typer

Joined: Wed Feb 17, 2010 9:17 pm
Posts: 82
Location: Florida
I have a problem I am not sure how to solve.

I want to animate an NPC but I have not found a way to solve the problem of the dropdown request that an NPC would get from issuing an llRequestPermissions() statement that is not in the actual prim the NPC is sitting on.

To be more specific I am trying to modify a dance stand that has several scripts in it.

The stand rezzes the dance balls which are what the dancers sit on. Those balls are not linked to the dance stand prim.

The actual animations are sent to the dancers from the dance stand, not the pose balls they are sitting on.

It works fine for real avatars because they can answer the request to animate their avatar with either a yes or no answer to the dialogue menu.

I do not see any way an NPC could detect if it was sent a dialogue menu or how it could answer such a request.

My initial attempt was to find some way to auto authorize the request by moving the llRequestPermissions() to the pose ball, but that does not work since it is a totally different prim than the one issuing the animations.

Is there a way to pass the permissions parms and key from one prim to another? If so, then the dance ball can auto authorize the request to do animations since the NPC actually sat on the prim. This would emulate the action that a real avatar sees in automatic authorization without the dialogue requesting permission to animate the avatar.

Another thought would be for an NPC to always Automatically granted the request without doing the dialogue. That would allow existing scripts to work, that ask for permission expecting the permission to be granded by the avatar. This would take modification to this function for an NPC.


Top
 Profile  
 
 Post subject: Re: llRequestPermissions() for an NPC
PostPosted: Mon May 21, 2012 5:10 pm 
Furious Typer

Joined: Mon Apr 25, 2011 6:48 pm
Posts: 70
Slow,

Modify the scripts so that instead of using the llStartAnimation call, they instead use either osAvatarPlayAnimation or osNpcPlayAnimation.

NPCs do not have permissions, per se, as there is no user attached to the NPC. NPCs are owned, or not, by the creator/owner of the script that created the NPCs.

I've been animating NPCs using the osAvatarPlayAnimation call in my scripts, and there is never a permissions check.

I would recommend modifying the script in question, to check whether the Avatar using the poseball is a User or NPC, using the new osIsNpc call. Pass the key of the Avatar to osIsNpc, and base the permissions check on the return value.

Potential code would look like this:

Code:
if (osIsNpc(avatar_key))
{
     osNpcPlayAnimation(name_of_animation);
}
else
{
     llRequestPermissions(avatar_key, PERMISSION_TRIGGER_ANIMATION);
     llStartAnimation(name_of_animation);
}



Should be simple... :shock:
Hope this helps... :geek:


Top
 Profile  
 
 Post subject: Re: llRequestPermissions() for an NPC
PostPosted: Thu Jun 07, 2012 4:49 pm 

Joined: Thu Jun 07, 2012 4:44 pm
Posts: 6
There were recent changes for NPCs to auto grant permissions to any object owned by the NPC, eg attachments and, if the NPC was created as "owned", any script belonging to the owner of the NPC. This is in addition to the normally auto granted permissions when sitting on/wearing a scripted object.
The changes went into git master 0b72f773 June 26th
the changes went into llRequestPermissions so nothing special to do in the script, just request in the normal way.


Top
 Profile  
 
 Post subject: Re: llRequestPermissions() for an NPC
PostPosted: Thu Jun 07, 2012 7:10 pm 
Furious Typer
User avatar

Joined: Fri Aug 19, 2011 7:10 pm
Posts: 144
Location: Oldham, UK
Shad's solution is likely to be more universal, especially on sims where more than one person can build/rezz. The downside is that each script would have to be modified, but as NPCs gain popularity I would expect more NPC aware scripts to evolve.

_________________
50's sim based at Rumbled on OSGrid
happily running on Arch Linux for 1 year +


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 4 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net