Difference between revisions of "Money"

From Second Life Wiki
Jump to navigation Jump to search
(That caveat has little to do with the money event, SVC-1099 has nothing to do with money, SVC-2373 was closed by reporter. I really don't think links to feature suggestions belong in the documentation)
m
Line 11: Line 11:
Don't forget to turn on the pay-behavior of the prims/objects involved.<br/>
Don't forget to turn on the pay-behavior of the prims/objects involved.<br/>
The pay buttons should be configured in most applications where money is being transfered ([[llSetPayPrice]]), it makes paying money to the object easier.
The pay buttons should be configured in most applications where money is being transfered ([[llSetPayPrice]]), it makes paying money to the object easier.
|caveats=* This event cannot be triggered by a call to [[llGiveMoney]] because it cannot be used by one object to pay another object.
|caveats=* This event cannot be triggered by a call to [[llGiveMoney]] because [[llGiveMoney]] cannot be used by one object to pay another object.
|examples=<lsl>integer price = 10;
|examples=<lsl>integer price = 10;



Revision as of 03:36, 20 June 2008

Emblem-important-red.png Security Warning!

Always (ALWAYS!) check the amount paid.

Description

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

Triggered when money is paid to the prim in the amount by id.

• key id who paid
• integer amount the amount paid

Specification

When money is paid to the prim, the money is given to the object's owner.
If the object is owned by or deeded to a group it is divvied up amongst the group members immediately (which is why groups can't grant PERMISSION_DEBIT).<br.> Don't forget to turn on the pay-behavior of the prims/objects involved.
The pay buttons should be configured in most applications where money is being transfered (llSetPayPrice), it makes paying money to the object easier.

Caveats

  • This event cannot be triggered by a call to llGiveMoney because llGiveMoney cannot be used by one object to pay another object.


Examples

<lsl>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 paid "+(string)amount+", which is the wrong price, the price is: "+(string)price);
       }
       else
       {
           llInstantMessage(id, "You paid the right price");
       }
   }

}</lsl>

See Also

Functions

•  llGiveMoney Give money to another avatar
•  llSetPayPrice Configure the pay buttons

Deep Notes

Signature

event void money( key id, integer amount );