Difference between revisions of "Money"

From Second Life Wiki
Jump to navigation Jump to search
m (LSL money moved to Money: removing prefix)
Line 1: Line 1:
{{LSL_Event|event_id=20|event_delay|event=money|p1_type=key|p1_name=id|p1_desc|p2_type=integer|p2_name=amount|p2_desc|event_desc=Triggered when money is given to task|constants|spec|caveats|examples|helpers|also_header|also_events|also_functions|also_articles|also_footer|notes|mode|deprecated}}[[Category:LSL_Stub]]
{{LSL_Event
|event_id=20
|event_delay
|event=money
|p1_type=key|p1_name=id|p1_desc=who payed
|p2_type=integer|p2_name=amount|p2_desc=the amount payed
|event_desc=Triggered when money is payed to the prim/object in the '''amount''' by '''id'''.
|event_footnote=When money is payed to the object, the money is given to the objects owner.<br/>If the object is owned by a group it is divvied up amongst the group members.
|constants
|spec=
|caveats
|examples=<pre>integer price = 10;
 
default
{
    state_entry()
    {
        llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
            state cash;
    }
}
 
state cash
{
    state_entry()
    {
        llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
    }
    money(key id, integer amount)
    {
        if(amount != price)
        {
            llGiveMoney(id, amount);
            llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price);
        }
        else
        {
            llInstantMessage(id, "You payed the right price");
        }
    }
}
</pre>
|helpers
|also_header
|also_events
|also_functions={{LSL DefineRow||[[llGiveMoney]]|}}
{{LSL DefineRow||[[llSetPayPrice]]|}}
|also_articles
|also_footer
|notes
|mode
|deprecated
|cat1=Money
|cat2
|cat3
|cat4
}}

Revision as of 12:22, 27 February 2007

Description

Event: money( key id, integer amount ){ ; }

Triggered when money is payed to the prim/object in the amount by id.

• key id who payed
• integer amount the amount payed

When money is payed to the object, the money is given to the objects owner.
If the object is owned by a group it is divvied up amongst the group members.

Examples

integer price = 10;

default
{
    state_entry()
    {
        llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
            state cash;
    }
}

state cash
{
    state_entry()
    {
        llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
    }
    money(key id, integer amount)
    {
        if(amount != price)
        {
            llGiveMoney(id, amount);
            llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price);
        }
        else
        {
            llInstantMessage(id, "You payed the right price");
        }
    }
}

See Also

Functions

•  llGiveMoney
•  llSetPayPrice

Deep Notes

Signature

event void money( key id, integer amount );