Difference between revisions of "LlGiveMoney"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{LSL_Function|func_id=99|func_sleep=0.0|func_energy=10.0
{{LSL_Function/permission|PERMISSION_DEBIT|grant=the owner}}{{LSL_Function|func_id=99|func_sleep=0.0|func_energy=10.0
|func=llGiveMoney|sort=GiveMoney
|func=llGiveMoney|sort=GiveMoney
|return_type=integer|return_text=that is always {{HoverText|zero|0}}.
|return_type=integer|return_text=that is always {{HoverText|zero|0}}.
Line 6: Line 6:
|func_desc=Transfer '''amount''' of L$ money from script owner to '''destination''' avatar.
|func_desc=Transfer '''amount''' of L$ money from script owner to '''destination''' avatar.
|spec
|spec
|permission=PERMISSION_DEBIT
|caveats=*An object cannot pay another object.
|caveats=*An object cannot pay another object.
*Once a script has the PERMISSION_DEBIT permission it can empty an account of L$.
*Once a script has the PERMISSION_DEBIT permission it can empty an account of L$.

Revision as of 19:42, 16 April 2007

Summary

Function: integer llGiveMoney( key destination, integer 0)" style="border-bottom:1px dotted; cursor:help;">amount );
0.0 Forced Delay
10.0 Energy

Transfer amount of L$ money from script owner to destination avatar.
Returns an integer that is always zero.

• key destination avatar key.
• integer amount number of L$, must be greater than zero, (amount > 0)

To run this function the script must request the PERMISSION_DEBIT permission with llRequestPermissions and it must be granted by the owner.

Caveats

Permissions
  • Do not depend upon the auto-grant status of permissions. Always use the run_time_permissions event.
  • If the script lacks the permission PERMISSION_DEBIT, the script will shout an error on DEBUG_CHANNEL and the operation fails (but the script continues to run).
  • If PERMISSION_DEBIT is granted by anyone other than the owner, then when the function is called an error will be shouted on DEBUG_CHANNEL.
  • Once the PERMISSION_DEBIT permission is granted there is no way to revoke it except from inside the script (for example, with a new llRequestPermissions call) or the script is reset or deleted.
  • An object cannot pay another object.
  • Once a script has the PERMISSION_DEBIT permission it can empty an account of L$.
    • Fraud & theft are both Linden Lab violations and crimes.

Examples

integer AMOUNT = 10;
integer STASH = 50;

update()
{
    if(STASH >= AMOUNT)
        llSetText("I have L$"+(string)STASH + " to give away!");
    else
        llSetText("I have no L$ to give away :(");
}

default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT );  
    }

    run_time_permissions (integer perm)
    {
        if(perm & PERMISSION_DEBIT)
        {
            state ready;     
        }
    }
}

state ready
{
    state_entry()
    {
        update();
    }
    touch_start(integer num)
    {
        if(STASH >= AMOUNT)
        {
            llGiveMoney(llDetectedKey(0), AMOUNT);
            STASH -= AMOUNT;
            update();
        }
        else
        {
            llWhisper(0, "No more money to give away :(");
        }
    }
    money(integer m)
    {
        STASH += m;
        update();
    }
}

See Also

Events

•  run_time_permissions Permission receiving event
•  money

Functions

•  llGetPermissions Get the permissions granted
•  llGetPermissionsKey Get the agent who granted permissions
•  llRequestPermissions Request permissions

Articles

•  Script permissions

Deep Notes

Signature

function integer llGiveMoney( key destination, integer amount );