Difference between revisions of "LlSetPayPrice"

From Second Life Wiki
Jump to navigation Jump to search
m (duplication)
m
Line 9: Line 9:
|func_desc=Sets the default amount for the pay text field and pay buttons of the appearing dialog when someone chooses to pay this prim.
|func_desc=Sets the default amount for the pay text field and pay buttons of the appearing dialog when someone chooses to pay this prim.
|caveats=*This function should not be trusted to limit the values of money payable to the object; ''always'' verify the amount paid is the amount expected.
|caveats=*This function should not be trusted to limit the values of money payable to the object; ''always'' verify the amount paid is the amount expected.
*This function has no effect if called from a state that does not implement the [[money]] event.
*This function has no effect if called from a [[state]] that does not implement the [[money]] event.
|examples=This will give the user a dialog box without the '''price''' field and only one button with a value of 150.
|examples=This will give the user a dialog box without the '''price''' field and only one button with a value of 150.
<lsl>llSetPayPrice(PAY_HIDE, [150,PAY_HIDE,PAY_HIDE,PAY_HIDE])</lsl>
<lsl>llSetPayPrice(PAY_HIDE, [150,PAY_HIDE,PAY_HIDE,PAY_HIDE])</lsl>

Revision as of 14:11, 11 May 2010

Emblem-important-red.png Security Warning!

Always (ALWAYS!) check the amount paid in your money() event. This UI element isn't modal, and has had bugs exploited in the past. Do not use this function as the only limiting method for payment. Never trust the client software to be secure. Always validate the value paid is a value expected.

Summary

Function: llSetPayPrice( integer price, list quick_pay_buttons );

Sets the default amount for the pay text field and pay buttons of the appearing dialog when someone chooses to pay this prim.

• integer price PAY_* constant or positive value
• list quick_pay_buttons Four PAY_* constants and/or positive integer values

Constant Alt Description
PAY_HIDE -1
0
Hides this quick pay button.
PAY_DEFAULT -2 Use the default value for this quick pay button.
Button Order
1
2
3
4
Defaults
$1 $5
$10 $20

Caveats

  • This function should not be trusted to limit the values of money payable to the object; always verify the amount paid is the amount expected.
  • This function has no effect if called from a state that does not implement the money event.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llSetPayPrice doesn't work on Child Prims, default box used instead.

Examples

This will give the user a dialog box without the price field and only one button with a value of 150. <lsl>llSetPayPrice(PAY_HIDE, [150,PAY_HIDE,PAY_HIDE,PAY_HIDE])</lsl>

<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
       {
           //insert your give code here.
           llInstantMessage(id, "You paid the right price");
       }
   }
}</lsl>

See Also

Events

•  money

Functions

•  llGiveMoney

Deep Notes

All Issues

~ Search JIRA for related Issues
   llSetPayPrice doesn't work on Child Prims, default box used instead.
   llSetPayPrice causes "When Left Clicked: Pay Object" to break

Tests

•  llSetPayPrice Test

Signature

function void llSetPayPrice( integer price, list quick_pay_buttons );