Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Holovendor Question

Laurie Partridge
Retro Goddess
Join date: 1 Jun 2004
Posts: 73
09-23-2009 18:36
Hello!

I've been scouring the forums for an answer to my question, and while I did find a thread that addressed it, /54/aa/42576/1.html, it was a really old thread and I didn't want to "necropost." So, here I am. :)

Here's my question/problem, as it was asked in the old thread (not by me).

From: Blackbird Clawtooth
"...when I go to pay (myself), it list fastpay amounts and the user has to manually punch in a $ amount. How do I get it to make a pay button with the exact cost of each item?"


The response given was simply a line of code, namely,
From: Void Singer
"llSetPayPrice( PAY_HIDE, [ItemCost, PAY_HIDE, PAY_HIDE, PAY_HIDE] );."


Not being a scripter, my first thought was, "Ok, but where does it go in the script?" But I thought I'd play with it and see what happened.

Well, I got error after error, most were either "name not defined within scope" or "syntax error." After trying slightly modified versions of the line, I FINALLY got the script to save/recompile with no errors. I reset the script and set it to running and tried it out. Nothing had changed.

I don't know if anyone would need to see the entire script to help. If so, please visit the URL above (this post is already too long. :)

Here is the snippet that contains the code in question, taken from my current version of the script.

}



}
money( key giver, integer amount )
// Thanks Kaleb Underthor for your shared money function
{
llSetPayPrice( PAY_HIDE, [currentpricelist, PAY_HIDE, PAY_HIDE, PAY_HIDE] );
integer price = (integer)llList2String(currentpricelist,(selected - 1));
string object = llList2String(currentitemlist,(selected - 1));
if ( amount < price )
{
llSay( 0, "This item costs L$" + (string) price );
llSay( 0, "You only paid "+(string)amount);
llGiveMoney( giver, amount );
}
else
{
llSay( 0, "Enjoy your " + object );
llGiveInventory( giver, object );
if(llGetListLength(recentsales)>=30)
llDeleteSubList(recentsales,0,0);
if(recordsales==1)
recentsales = recentsales + (llGetDate()+":"+object+":"+(string)price);
//fixing the error here

if (amount > price)
{
llGiveMoney(giver, amount - price);
}

if(percentshare > 0)
{
owed += ((price * percentshare)/100);
}

//
}
} // end money routine
}


Anyway, that is my problem. I'm sorry for the length of this post. Any help, advice or guidance would be reaaaally appreciated.

Thanks so much!
_____________________
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-23-2009 19:24
I suspect that the llSetPayPrice function should go into the state_entry event so that it is executed when the script starts. By the time the money event is triggered, the user has already done the paying via the Fast Pay box.
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
09-24-2009 07:18
Btw... where you have...

integer price = (integer)llList2String(currentpricelist,(selected - 1));

It's possible to just express as....

integer price = llList2Integer(currentpricelist,(selected - 1));
Laurie Partridge
Retro Goddess
Join date: 1 Jun 2004
Posts: 73
09-24-2009 15:59
Thank you both for your suggestions. :)

EF, I moved the line to the following location:

default
{

state_entry()
{
llSetPayPrice( PAY_HIDE, [currentpricelist, PAY_HIDE, PAY_HIDE, PAY_HIDE] );
Init();
state listenmode;
}
on_rez(integer param)
{
Init();
state listenmode;


And got the following error:

[script:Hiro's Super Vendor Program - Holo-projector] Script run-time error
Turn-key Vendor Holo-projector-full: Lists may not contain lists

Did I put it in the wrong place?

Vance, I changed the wording of that other line, and it compiled correctly, but the problem remains.

Again, thanks so much to you both, but I'm still seeking an answer. :)
_____________________
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
09-24-2009 16:58
That error is because you're trying to feed llSetPayPrice() a list of all prices (currentpricelist). You need to feed just one of the prices from the list.

But, since you're using a multi-object vendor, with multiple prices, then I assume there is a method in your script that advances to the previous or next item. That's where you should llSetPayPrice(). You have a list of items, and a "current" integer that picks the item from that list. Do the same with your prices; use the "current" integer to pick the matching price from your list of prices, then put it into llSetPayPrice().


Also, just my personal preference, but if I use llSetPayPrice() to force a single price... I always remove the PERMISSION_DEBIT permission flag from the script. In theory, it shouldn't be possible for a customer to pay the wrong amount. Therefore, there's no reason to build a refund system and require the owner to allow debit permission/llGiveMoney(). However, I do still check for the correct amount within the money() event. But in the improbable case that a person pays the wrong amount (they've somehow hacked a viewer to pay a different price or SL screws up), I chat them a message about the problem and ask them to contact the vendor's owner.
Laurie Partridge
Retro Goddess
Join date: 1 Jun 2004
Posts: 73
09-28-2009 16:33
Thanks for responding, DoteDote. I tried your suggestion, and it does eliminate the other price options. But the price remaining is either 1L 0r 2L. Since there are two items in my testing vendor, I'm assuming it's using the item number for a price. I've tried using several different terms in the "SetPayPrice" line, but I'm just not getting the correct result. I guess I'm even more hopeless with scripts than I thought! :)

Anyway, thanks to everyone who suggested fixes. I finally ran out of patience and purchased another vendor.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-28-2009 16:43
If you're using Hiro's vendor, you should be able to just change the price options with a chat line command. You just need to type VENDORNAME:setprice:x:y, where x is the number of the tiem in the vendor's list and y is the price you want to set on it. VENDORNAME is whatever you decided to name that vendor. It should work. I've used Hiro's vendors successfully for two years and never had a problem.

If you need a new free copy of the system, his shop is at http://slurl.com/secondlife/Varney/198/200/24
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
ab Vanmoer
Registered User
Join date: 28 Nov 2006
Posts: 131
09-28-2009 22:00
From: Laurie Partridge

Anyway, thanks to everyone who suggested fixes. I finally ran out of patience and purchased another vendor.
To save you the frustration, I sent you one of my holovendors about a week back. I never heard back, so I assume that it wasn't what you wanted.