Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llRequestPermissions

Venusvelvet Cazalet
Registered User
Join date: 22 Feb 2007
Posts: 16
03-03-2007 07:07
I would like to write a script that ask for control permission ONLY IF the owner is seated. Here is the code:


default
{
touch_start(integer total_number)
{
key owner = llGetOwner();
llRequestPermissions(owner, PERMISSION_TAKE_CONTROLS); // ask for permission

if (llGetAgentInfo(owner) & AGENT_SITTING)
{
// if-yes condition
llSay(0,"touched and seated";);
}
else
{
llSay(0,"the owner is not sitting.";);
}
}
}


1) Obviously, the // ask for permission line should put in the // if-yes condition place. That's basically what i want. However, when i put it there, only "touched and seated" showed up when the owner is seated on the prim, but it hasn't got a screen pop up to ask for permission.

Then i tried to put the // as for permission line on the place where it shown above, the permission pop up screen shows up. Why does the permission screen is not showing up but while the "touched and seated" showed up?


2) Also when the owner is seated on the prim, no matter where the two places i put the // ask for permission line, the permission screen just NOT shows up at all. Is this // as for permission line requires some condition to take effect? Is it not like the llSay(); function that has effect whenever the script flows to?

Appreicate for any help. :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-03-2007 13:24
Try using llAvatarOnSitTarget();
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
03-03-2007 14:04
When an agent is seated on an object it will automatically grant control (and camera, IIRC) permissions to any scripts in that object.

Also, if it's a the object the avatar's sitting on that takes the controls, it might be worth using the changed() event rather than a touch for usability.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-03-2007 15:38
From: AJ DaSilva
When an agent is seated on an object it will automatically grant control (and camera, IIRC) permissions to any scripts in that object.

Also, if it's a the object the avatar's sitting on that takes the controls, it might be worth using the changed() event rather than a touch for usability.



although it grants them, you still need to request them or nothing will work.
Venusvelvet Cazalet
Registered User
Join date: 22 Feb 2007
Posts: 16
03-04-2007 03:31
Thanks guys, i'll give it a try, wish me luck :)