Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PERMISSION_TRIGGER_ANIMATION & PERMISSION_DEBIT

Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
12-03-2009 12:41
hi all,

if have a weird problem and hope some of you can help.
i have a script with 2 states
state 1 reads a notecard and ask llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
state 2 has a change event with llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);

the problem is if i save/reset the script and someone other then the owner sit on the object the animation don't start (run_time_permissions is not started)

if i save/reset the script and first the owner sit on it then the script works (also if someone else sit on it after the owner)

Below part of the script thats give problems (the llWhisper are for testing only).
if the first person that sits on it is not the owner the requestPermission starts but run_time_permissions don't trigger. (i have tried to move PERMISSION_DEBIT to state 2 but that didn't help)

default // Notecard reader
{
state_entry() { // Set some variables}

dataserver(key query_id, string data)
{
// Read Notecard and validate the lines
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

run_time_permissions(integer permOwner)
{
if(permOwner & PERMISSION_DEBIT) { state Vendor;}
else { llOwnerSay("You have to grant access else the vendor don't work!";); llResetScript();}
}
}

state Vendor // Vendor
{
state_entry() { // Set some variables & llSitTarget}

money(key PayingPerson, integer Amount) { //Handles money event }

on_rez(integer num) { llResetScript(); }

changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
llWhisper(0, "Welcome " + llKey2Name(llAvatarOnSitTarget()));
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}
else
{
integer perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION))
{
llStopAnimation("sit";);
llStopAnimation("stand";);
llStopAnimation(sAnim);
}
}
}
}

run_time_permissions(integer permAnim)
{
llWhisper(0, "Perm asked";);
if (permAnim & PERMISSION_TRIGGER_ANIMATION)
{
llWhisper(0, "Perm granted";);
// Set animation
}
}
}
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
12-03-2009 12:56
You've hit two of the limitations of script permissions.

1. Each script can only remember permissions for one avatar at a time.

2. Each llRequestPermissions call clobbers any permissions that were granted before, you have to ask for all the ones you want or you will lose some.

For a situation like this, where you want the owner to grant debit permissions, and also want someone else to get animated, you will want to use separate scripts.
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
12-03-2009 13:11
ok didn't know that.

But its weird then that the script works if the owner sit first and another afterwards.
did check if after the owner another people sit on it and it works and debit still works to (the owner gets the money).

But thanks for your answer :)
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
12-03-2009 13:24
PERMISSION_DEBIT is about the script being able to pay someone else money from the owner's account. The money event is triggered when someone else pays money into the object's owner's account through the object; this would be called a CREDIT, and is quite rightly welcomed with open arms :). You will still need to use PERMISSION_DEBIT if you want to be able to refund someone if they pay too little or too much.

At least, I thinks that's what's happening.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
12-03-2009 13:38
Right, PERMISSION_DEBIT is needed for llGiveMoney to work. An object can still accept payments and trigger the money event without it. Once that animation permission is requested, PERMISSION_DEBIT is disabled in that script.
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
12-06-2009 10:02
All thanks for you answer,

Somehow i always thought that you can use llRequestPermissions each subtype (debit, takecontrol, annimation, etc) ones in a script without interfering with each other and with different keys (avatars).

but looks like llRequestpermission works only with one key (avatar).

Other question if llrequestpermission(debit) is only used for paying back in case it something goes wrong. You can do without it if you use fastpay with only 1 value and if something goes wrong sent an IM to the buyer to contact the owner. am i right?

or is there another reason to use llrequestpermission(debit)?
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
12-06-2009 10:07
Right, if you aren't actually planning to use the llGiveMoney function, you can skip the debit permission. Most scripts that take money either give refunds or do some kind of splitting, that's why they always seem to go together.
jeaniesing Trilling
Loves to animate & script
Join date: 21 Oct 2006
Posts: 61
12-06-2009 20:26
I had a similar problem while scripting my system for delivering custom animations.... i wanted the named customer to be able to try every animation before commiting to purchase on the perms versions, and to be able to select properties on the prims contents to check next owner permissions

I solved it by splitting into two scripts... one script handles the animations permissions and the other handles the money (refunds when someone other than the named customer pays the prim) and distribution of appropriate prim contents...

each script keeps the proper permissions
_____________________
Pinastri/113/171/30