One item, two prices
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-16-2008 23:46
I have a vendor box (currently an empty box) that I'd like to set up as an easy vendor. See the picture, right-click "Pay" to purcahse it. Presented with two price options. One gives you Item A, the other gives you Item B. I had the script before but I can't find it anywhere now =x I do, however, have this script: .. I've managed to add in a second FastPay price, but can't quite figure out what to do next.. Still trying. integer price = 10; //enter your price here string text = "testing"; //write a text between the quote marks that will be displayed as float text (optional). If you want multiple lines, write \n like this: "Object for sale\n10L$", this will display "Object for sale" in one line, "10L$" in the other. integer priceb = 15; string item = "Candy - MT"; string itemb = "Twilight - MT"; default { state_entry() { llSetPayPrice(PAY_HIDE, [price, priceb, PAY_HIDE, PAY_HIDE]); llSetText(text, <1, 1, 1>, 1); } touch_start(integer total_number) { if (llGetInventoryNumber(INVENTORY_ANIMATION) > 0) llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_ANIMATION, 0)); } money(key id, integer amount) { if (amount == price) { integer i; integer len = llGetInventoryNumber(INVENTORY_OBJECT); for(i=0; i<len; i++) llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT, i)); } else llInstantMessage(id, "Sorry, that is not the right amount"  ; } }
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
08-17-2008 00:41
Rewrite the money event handler so that if amount == price, give one item, else if price == priceb, give the other item.
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-17-2008 01:03
Yes.. I know that  I've tried but it gives me Syntax errors, which really tells me nothing since I've no idea what I'm doing lol. Giving up for the night.. too tired to fuss with it.
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
08-17-2008 01:07
Have you considered just using 2 different boxes? one for each item?
I'm not trying to be mean, but if this is above your head, there ARE more straightforward ways to approach the problem. I guess it depends on whether your goal in doing this is to try and learn LSL, or if you just want to be able to sell the items.
Think about your customers.. and how complicated it might be for them to use, if they don't read English. Often, keeping things simple, is the best way to go.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-17-2008 09:50
Yes, obviously I'm aware of that and have chosen to make one box, two prices =) Nor do I see how it can be challenging. They know numbers in their native language, and odds are they are familiar with simple English terms else they would not be on a mostly English game. No? The image will obviously have what the different prices are for, in clear terms. So, again, back to my question please  If ya'll don't want to help, it's fine, but you don't have to tell me to change what I want to do because of it. Edit: Blah. Ok, that all sounds harsh.. Only reason I wrote it is because I'd like to keep this thread 'clean', for only help and not suggestions on how to use a one box, one price 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-17-2008 11:31
The script you posted gives out ALL objects in its prim's inventory. You will either have to keep track of a list of objects for the one product and a list of objects for the other, or make it one object per product (purchase). Assuming the latter (and that item and itemb are the exact names of the objects in inventory): money(key id, integer amount) { if (amount == price) { llGiveInventory(id, item); } else if (amount == priceb) { { llGiveInventory(id, itemb); } else { llInstantMessage(id, "Sorry, that is not the right amount"); } }
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
08-17-2008 11:58
Part of the problem, is that your thread title states that you want to sell one item, for two different prices.
I have such a script already written, which I was going to offer to you. One price for group members, one price for non group members. Your script, also suggests that you want to sell "all the items in the box" for either of two prices.
Yet you say that that's not what you're looking for.
I can't understand a single use inworld, that justifies "one prim for 2 items at 2 different prices". If you want that, what you want is probably a "panel vendor" that allows people to scroll through the avaiilable items by clicking arrows, and then pay for the item displayed.
As I say, I've had a lot of experience with vendors inworld, I've written a number of my own, and I've seen precisely how people act inworld. If you give them a choice of 2 prices, they are GOING to try and pay the lesser price, thinking they might be able to "get a bargain"... you create a system like this, and you set yourself up for "I paid your vendor and it took my money, but I didn't get the item I wanted".
If your vendor art is divided in half, people assume it's 2 vendors, and they will click and "pay" the "side" of the image that shows what they want.. when they're presented with 2 prices.. they will try the cheaper price, even if the vendor art says that the price of the item is higher... the moment they do, you have a customer support problem. With my "2 prices, one item" vendor, if you paid the low price and weren't in the group.. you got your money back.
You're going to have to spend MORE TIME laying out vendor art, MORE TIME trying to explain your vendor, and MORE TIME giving people thier money back for mistaken purchases, dealing with angry customers, people who can't figure out how to "give the item back", trying to arrange times when you're online and THEY are online, playing IM tag, etc etc.
You'll HAVE to sell the item as no-copy/yes transfer.. so that people can return the item in the event of a mistaken buy.. and then you'll have to spend MORE time dealing with complaints from people that your item isn't copyable, that SL lost the item from their inventory and could you please replace it (happens less frequently sith copyable items).. plus now that it's transfer, you'll have to keep one eye out for people trying to "scam you" into giving them an extra copy, so that their friends don't have to pay.
This is the voice of 2 years of customer service experience in Second Life.
What is your time worth? Splurge on an extra prim.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-17-2008 22:14
Oooo.. Think I understand that one  Will try in a soon! --- Why does it even bother saying 'Syntax error'? Blah. Fussing with it =x -- All I can get from it is Syntax error 28, 2 which is the blank space between } else I've deleted it, deleted the }, etc etc.. It just gives me more errors. "Syntax error" tells me nothing useful so I'm back to waiting =x
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
08-17-2008 23:27
When the wrong amount of money was paid, always, always, always make sure to refund it. Otherwise you may end up with angry people!
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-18-2008 09:08
When two buttons are provided, I'm pretty sure the rest is left hidden. I don't think it'd be possible to pay the wrong amount 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-18-2008 10:23
From: Squirrel Wood When the wrong amount of money was paid, always, always, always make sure to refund it. Otherwise you may end up with angry people! People don't always want to give debit permissions to vendors. In the case of very simple ones (and possibly owners who don't mind checking up on log messages via IM or e-mail or something), you might be able to get away without it. Note that in this particular case it is unlikely (though not IMPOSSIBLE) that the wrong amount is paid in any case because of the way llSetPayPrice() is used. So this MIGHT be a valid case not to try to refund. **shrug**
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
08-18-2008 11:53
From: Malina Chuwen When two buttons are provided, I'm pretty sure the rest is left hidden. I don't think it'd be possible to pay the wrong amount  You'd be surprised.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-18-2008 19:54
Well, if they ignore the prices than it's simply their own fault. Any who calmly IM/Notecard me would be refunded. I'm still looking for help so let's get back to the question at hand. Thanks! From: Malina Chuwen Oooo.. Think I understand that one  Will try in a soon! --- Why does it even bother saying 'Syntax error'? Blah. Fussing with it =x -- All I can get from it is Syntax error 28, 2 which is the blank space between } else I've deleted it, deleted the }, etc etc.. It just gives me more errors. "Syntax error" tells me nothing useful so I'm back to waiting =x
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-19-2008 01:36
From: Malina Chuwen All I can get from it is Syntax error 28, 2 which is the blank space between } else
I've deleted it, deleted the }, etc etc.. It just gives me more errors. "Syntax error" tells me nothing useful so I'm back to waiting =x This should do it. There was an extra open curly brace ({). money(key id, integer amount) { if (amount == price) { llGiveInventory(id, item); } else if (amount == priceb) { llGiveInventory(id, itemb); } else { llInstantMessage(id, "Sorry, that is not the right amount"); } }
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-20-2008 09:26
Really? I tried deleting different braces =x Lemme try again! lol
==
Now there's an error with the last } bracket. And I don't see any extra ones. I've deleted both end ones seperately and they just error each other?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-20-2008 11:57
Hmm. Well, in the second case I actually made a little test script and tested that it compiles in-world, so there shouldn't be any (compile-time) problem with it as long as you place it a state within an otherwise well-formed script and make sure all the variables (price, priceb, item, itemb) are defined.
|
|
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
|
08-20-2008 17:31
It looks fine to me.. I have everything in the object that's called for.. Both items and the script. This is the complete script: integer price = 10; //enter your price here string text = "testing"; //write a text between the quote marks that will be displayed as float text (optional). If you want multiple lines, write \n like this: "Object for sale\n10L$", this will display "Object for sale" in one line, "10L$" in the other. integer priceb = 15; string item = "Candy - MT"; string itemb = "Twilight - MT"; default { state_entry() { llSetPayPrice(PAY_HIDE, [price, priceb, PAY_HIDE, PAY_HIDE]); llSetText(text, <1, 1, 1>, 1); } touch_start(integer total_number) { if (llGetInventoryNumber(INVENTORY_ANIMATION) > 0) llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_ANIMATION, 0)); } money(key id, integer amount) { if (amount == price) { llGiveInventory(id, item); } else if (amount == priceb) { llGiveInventory(id, itemb); } else { llInstantMessage(id, "Sorry, that is not the right amount"  ; } } -- It compiles fine in my OP so I really don't get it. It's such a simple script that just isn't cutting it.
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
08-20-2008 18:05
Add one more closing curly brace at the end.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|