LlSetPayPrice Test

From Second Life Wiki
Jump to: navigation, search

[LLSetPayPriceTest]

[VERSION] 0.1

[LENGTH] 00:10

[TESTERS] 1

[OVERVIEW] This test has been designed to exercise the LLSetPayPrice LSL function.

[SETUP] This test requires 1 Tester and rezzable land

[*]

[0010] Right-click on the ground and select "Create" from the pie menu and Rez a cube

[0020] In edit click the "more >>" button if neccesary and insert the following script

[SCRIPT] llSetPayPricetest

[0030] Close the edit window

[0040] Right-click on the cube and choose "Pay"

[0050] Verify the buttons are the default: quick pay of 1, 5, 10, 20 and "0" (or last payed value, possibly blank) is in the Amount field.

[0060] Click cancel

[0070] Left-click on the cube

[0080] Right-click on the cube and choose "Pay"

[0090] Verify the buttons are: quick pay of 10, 20, 30, 40 and "100" is in the Amount field.

[0100] Click cancel

[0110] Left-click on the cube

[0120] Right-click on the cube and choose "Pay"

[0130] Verify the buttons are: quick pay of 1, 5, 10, 20 and "100" (or last payed value) is in the Amount field.

[0140] Click cancel

[0150] Left-click on the cube

[0160] Right-click on the cube and choose "Pay"

[0170] Verify only 1 quick pay button shows ($10) and the Amount field is hidden.

[0180] Click cancel

[0190] Left-click on the cube

[0200] Right-click on the cube and choose "Pay"

[0210] Verify only the Amount field is visible and it has a value of 100

[0220] Click cancel

[0230] Right-click and edit the cube, go into the contents and delete the previous script and replace it with the following

[SCRIPT] llSetPayPriceclear

[0240] Close the edit window

[0250] Left-click on the cube

[0260] Right-click on the cube and choose "Pay"

[0270] Verify the buttons are the default: quick pay of 1, 5, 10, 20 and Pay: "0" (or last payed value, possibly blank) is in the Amount field.

[0280] Click cancel

[0290] Clean up your prims

[END]


[llSetPayPricetest]

<lsl> // llSetPayPrice test // Each line (5 parameters) of buttons are the paremeters to 1 llSetPayPrice call list buttons = [100,10,20,30,40,

               PAY_DEFAULT,PAY_DEFAULT,PAY_DEFAULT,PAY_DEFAULT,PAY_DEFAULT,
               PAY_HIDE,10,PAY_HIDE,PAY_HIDE,PAY_HIDE,
               100,PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE];

integer i = 0;

default {

   touch_start(integer num)
   {
       llSetPayPrice(llList2Integer(buttons,i),llList2List(buttons,i+1,i+4));
       i += 5;
       if (i> llGetListLength(buttons)) i = 0;
   }
   
   money(key id, integer amount)
   {
       llSay(0,"Recieved $" + (string)amount + " from " + llKey2Name(id));
   }

} </lsl>


[llSetPayPriceclear]

<lsl> // llSetPayPrice clear default {

   touch_start(integer num)
   {
       llSetPayPrice(PAY_DEFAULT,[]);
   }
   money(key id, integer amount)
   {
       llSay(0,"Recieved $" + (string)amount + " from " + llKey2Name(id));
   }

} </lsl>