Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Permission_debit Q

Mika Koltai
Registered User
Join date: 4 Feb 2007
Posts: 18
04-16-2007 14:16
I´m trying to an tip jar, of course as everybody else, have to start somewhere.... But when someone rezzez it I want to have my cut, NP prob done that. but if they say NO to permission pay I want the script to start over.... or something else, what ever but not to work. any good solutions out there? Snippets here of what i trying to do..
<PHP>
{
state_entry()
{
splitPercentage /= 100.0;
if ( splitPercentage > 0 )
llRequestPermissions( llGetOwner(), PERMISSION_DEBIT );
else
state soliciting;
}


touch_start(integer total_number)
{
llRequestPermissions( llGetOwner(), PERMISSION_DEBIT );
}




run_time_permissions(integer perm)
{
if (PERMISSION_DEBIT) {
state soliciting;
} else {
llResetScript(); //reset script until said yees?
}
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
04-16-2007 15:17
You don't only want to prevent it from working if they click "No", you want it to only work if they click Yes. Otherwise, theoretically, someone could set it out, never respond to the question, and it would take tips and never pay out the cut (though it would complain about the missing permissions each time it tried). The easiest way would probably be to set up an "operational" state, which it only enters when debit permission is granted. [Edit to add: And now that I look closer at your code snippet, this is probably exactly what state soliciting; does ]

Oh, and the filter syntax you want to use inside run_time_permissions is
CODE

if( perm & PERMISSION_DEBIT )
{
// Debit permission has been granted.
}
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
04-16-2007 15:22
You probably already know this part, but I didn't see it in the code... You will also want to call llResetScript on owner change. Make sure that is either in all of the states, or whatever state it's likely to be in when you take it into inventory. Better to be safe and put it in all of the states :)
_____________________
Mika Koltai
Registered User
Join date: 4 Feb 2007
Posts: 18
Thx,
04-16-2007 20:01
did wonder to the script. just love to se things work out!