LSL Portal Wiki
Register
Advertisement

Syntax[]

llSetPayPrice(integer price, list quick_pay_buttons);
llSetPayPrice(integer price, [integer button1, integer button2, integer button3, integer button4]);

When called from the root prim, it modifies the user interface of the "Pay" dialog. It can be used to show 1 to 4 quick pay buttons, to modify their amounts and to hide the manual payment box.

Parameters

integer price
a PAY_* constant or a positive integer
list quick_pay_buttons
a list of 4 integers, their values set to the PAY_* constants or a positive number

Returns void

This function doesn't return a result.

Constants

Those constants can be used together with this function

constant value description
PAY_HIDE -1 hides the payment button or textbox
PAY_DEFAULT -2 sets the default behaviour or value for the button or textbox

Example

Sets everything as in the default payment box:

default 
{
	state_entry()
	{
		llSetPayPrice(PAY_DEFAULT, [PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT]);
	}

	//required to activate the quick pay dialog
	money(key id, integer amount)
	{
		llSay(DEBUG_CHANNEL, (string)amount + " was paid by " + (string)id);
	}
}

Remarks

Screenshot quickpay dialog

The quick pay dialog

This function makes it possible, to modify the default Quick Pay dialog.

Through the first parameter it is possible to change the manual entry textbox. PAY_HIDE hides the textbox completely. Any value equal 0 or higher makes the textbox visible and shows this amount in the textbox. PAY_DEFAULT makes the textbox visible without any amount shown in it.

The next parameter, the list of 4 integers represents the 4 quick pay buttons. The image shows the order of the buttons corresponding to the 4 values in the list. Using PAY_HIDE as value, hides a button completely. PAY_DEFAULT sets the value to the default amount of the viewer. Any positive value changes the button to show that specific amount.

Calling the function with all parameters as PAY_DEFAULT restores everything to the default settings.

To make an one-button quick pay dialog, set everything to PAY_HIDE except one button, as example:

llSetPayPrice(PAY_HIDE, [500, PAY_HIDE, PAY_HIDE, PAY_HIDE]);

Notes

Red exclamation mark icon The function only defines the look of the graphical interface for the quick payment dialog, but it does not set internally any filters or checks for the payment made. That means, a viewer that doesn't implement those settings in the same way, could allow any other amounts to be paid to the object. NEVER trust the payments, unless you have checked that they are correct within the money() event, before delivering anything.

llSetPayPrice() itself does NOT activate the quick pay dialog to be used with an object. The simulator activates the payment dialog only, when the money() event was defined within the same state in the script. That way it's possible to deactivate the quick pay dialog completely, when the script changes to a state that doesn't contain a money() event.

This function is not necessary to use the quick pay dialog. It is only necessary, to modify the available user controls and amounts, when you are not satisfied with the default values.

The quick_pay_buttons parameter can be a list with more then 4 entries, the other entries will be ignored though.

If the list contains less then 4 entries, the missing buttons will be hidden.

If the values of the list are of a different type then integers, the behaviour might be unexpected, but the buttons will usually be hidden. Avoid to use any other values (like negative integers) or types, to maintain compatibility and not break code, should the specification include more features in future.

Those settings are saved as prim properties. As known, prim properties stay, even when a script is removed. To restore the default settings, call the function with all parameters set to PAY_DEFAULT.

The default values for the buttons are L$1, L$5, L$10, L$20. But keep in mind, there is nothing that would a viewer restrict to not use other amounts as default values.

Related Events

  • money - Triggered, when a payment is made from an avatar to the object

Platforms

SecondLife (agni), Secondlife (aditi), OpenSimulator

OpenSimulator: the original version does not contain currency modules, but plugins might add that functionality

See also[]


  Icon-edit-22x22 Read comments or write a new one!    

Advertisement