Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A Real Vendor Script

Jade Bard
Registered User
Join date: 7 Jul 2004
Posts: 106
07-18-2004 20:48
Now i know there are vendor scripts out there, but I don't think one is posted with next, and back buttons. I just made one, and this is such a small thing. Why shouldn't the code be released? Sorry I didn't comment the code much. I forgot to.


Main picture
CODE
list pics = ["pic1 name", "pic2 name", "pic3 name" ]; 
list discrip = ["name of item1" , "name of item2" , "name of item3" ];
list cost = [10 , 20 , 15]; //the cost of the item
list notecard = ["notecard1" , "notecard2" , "notecard3"];


integer cur_item = 0;



list pics = ["Slot Machine", "Jade Machine5", "Black Jack" ];
list discrip = ["Jade Machine v1.2" , "Jade Machine v1.2 (5 prims)" , "Black Jack v1" ];
list cost = [200 , 200, 100];
list notecard = ["JadeMachine" , "JadeMachine" , "BlackJack info"];

integer cur_item = 0;
string ownername;
integer not_registered;

nextItem(integer nextInt)
{
integer length = llGetListLength(pics);
--length;
if(nextInt > length)
cur_item = 0;
else if(nextInt < 0)
cur_item = length;


llSetTexture(llList2String(pics,cur_item), ALL_SIDES);
llSetText("Click on picture to display more info \n" + llList2String(discrip,cur_item), <1,0,0>, 1.0);
}

default
{
state_entry()
{
llSetText("Click on picture to display more info \n" + llList2String(discrip,cur_item), <1,0,0>, 1.0);
llSetTexture("Slot Machine",ALL_SIDES);
//llSay(0,"You must have at least one item");
//llSay(0, llGetTexture(ALL_SIDES));
}

touch_start(integer total_number)
{
if (((llDetectedKey(0) == llGetOwner()) && (llDetectedName(0) != ownername)) || ((llDetectedKey(0) == llGetOwner()) && (not_registered == TRUE)))
{
ownername = llKey2Name(llGetOwner());
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
//llWhisper(0, "Requesting debit permission from owner: " + ownername);
}

llGiveInventory(llDectedKey(0), llList2String(notecard, cur_item));
}

money(key giver, integer amount)
{
if (amount >= llList2Integer(cost,cur_item))
{
// customer has given us at least enough money
amount -= llList2Integer(cost,cur_item);
llGiveInventory(giver, llList2String(discrip,cur_item));
}
if (amount > 0) // give back change
{
llGiveMoney(giver, amount);
}
}

link_message(integer sender_num, integer num, string str, key id)
{
list message = llParseString2List(str, [" "], []);
if (llList2String(message, 0) == "next")
{
nextItem(++cur_item);
}
else
{
nextItem(--cur_item);
}
}
}


Next button code
CODE
default
{
state_entry()
{

}

touch_start(integer total_number)
{
llMessageLinked(0,0,"next","");
}
}


Back button code
CODE
default
{
state_entry()
{

}

touch_start(integer total_number)
{
llMessageLinked(0,0,"back","");
}
}


I did take some code from a different vending script. I hope you like this :).
What do you guys think?
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
07-19-2004 21:45
Okay, I'm really biased, but:

/invalid_link.html

A. There are plenty of people who can't do even the most basic scripting, and need a vendor that doesn't involve modifying script.
B. You shouldn't have to change the code and restart the script just to add one item, or change the price of something, or change a texture.
C. I like the click for more info - it's nice to see that it isn't spammed into floating text.
D. What happens if you have an item but no price? For argument's sake, let's say:
- There's an item for sale and no price
- A player gives an amount of money, let's say 10L.
- if (amount >= llList2Integer(cost,cur_item)) -- in this case amount is 10, and the llList2Integer(cost,cur_item) has no valus - making it either 0 or perhaps a default garbage value, which could be a large negative number.
- 10 > 0 is true, so is 10 > (some negative number)
- The vendor now returns money to the person AND gives them the item.
This means that the user will have to double-check to make sure they have everything set perfectly... and the mistake could be a major loss of money. Typical vendors have 10+ items... let's say someone has 20 items... misses 1... easy situation that could happen... etc.

So, I think this design does not have the security and error-trapping required, that could be devastating to a seller.

I hope you take my feedback as just that - I'm not saying this to put you down, but to help you improve your code. I always appreciate the same vice versa. :)

-Hiro Pendragon
benji Czukor
Junior Member
Join date: 28 Jun 2004
Posts: 1
07-21-2004 03:28
Hello, i like your vendor script alot, there are just a few things i have noted. Number one is that when clicked on (vendor) the notecard gets sent to me and i am not sure if it goes to the person who clicked on it. When you have email notification, this can be very annoying.
Your back button script should look like this:

default
{
state_entry()
{

}

touch_start(integer total_number)
{
llMessageLinked(0,0,"back","";);
}
}

And the list functions are copyed twice at the top of the script.

None the less i think its a great script, i just cant figure how to stop sending notecards to me when someone else clicks it. Keep up the good work.

benji
Jade Bard
Registered User
Join date: 7 Jul 2004
Posts: 106
07-21-2004 22:24
Yeah i fixed some stuff. That I had wrong.

Also this is meant for people who know something about scripting. This is meant as a base. I use this script my self, and it's fine. Also the code is online compared to yours, you have to pay for? (idk I couldn't figure out if it was free or not)

Anyways I didn't find any next, and back button vending scripts on this forum, so I posted mine.

I don't understand what your beaf is with my money back, and item. If someone forgets to put a dollar amount in it, and they miss that.Well they deserve to lose their money. You should double check it after everytime you change something.

Anyways as i said before I'm just puting out a very simple script, that can be easily moddable. It's meant for the new people learning LSL or people who are too lazy to code it themselves. Compared to where yours is meant more for the noobs who don't know, nothing about anything. I think the people who go through this forum looking for coding is wants to learn, or knows LSL already.

(sorry if i have bad grammer, or spelling. I'm too lazy to actually check, at this monent :p)
Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
07-22-2004 07:57
Full Free Vendor:
http://www.badgeometry.com/wiki/LibraryVendor

Yes it has back and forward buttons, uses a prim to display the price and takes all inputs from a notecard. It also has better sales tracking. It does take some building skills to build the vendor though.

In all honesty I recommend one of those vendors that diverts a fraction of the sale to someone and has a fancy website to track your sales and stuff.
_____________________
--
010000010110110101100001001000000100111101101101011001010110011101100001
--
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
11-03-2004 11:43
From: Ama Omega
In all honesty I recommend one of those vendors that diverts a fraction of the sale to someone and has a fancy website to track your sales and stuff.
A cold shiver suddenly ran up and down my spine when I read that line.

The phrases "divert a fraction of the sale" and "track your sales" and "honesty" sit very very very uncomfortably with closed-source scripts that manipulate someone else's money or business transactions.

It is probably only a matter of time before some major scam is perpetrated by closed-source vendors in SL. I would strongly recommend to all providers of vending systems that they investigate open-source methods of achieving their goals.
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
11-04-2004 00:45
From: Morgaine Dinova
A cold shiver suddenly ran up and down my spine when I read that line.

The phrases "divert a fraction of the sale" and "track your sales" and "honesty" sit very very very uncomfortably with closed-source scripts that manipulate someone else's money or business transactions.

It is probably only a matter of time before some major scam is perpetrated by closed-source vendors in SL. I would strongly recommend to all providers of vending systems that they investigate open-source methods of achieving their goals.

This is an issue I seriously consider(ed), Morgaine, with mine. My main thought was that people would be using my script, modding it like crazy, and I would be getting all sorts of IMs of people using a modified script that doesn't work or is scamming them.

Hence, I made mine free, distributable, and am happy to provide references on request.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
11-10-2004 16:17
What I had in mind Hiro was some sort of separation of function, ie. where only the individual monetary transactions would be handled (and logged for auditing) in an open-source script, while all the complex functionality could continue to be handled in the closed scripts that make up the bulk of the vendor product.
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements
Trent Hedges
TrentCycle & GRAPHICA
Join date: 4 Sep 2003
Posts: 198
11-14-2004 22:14
From: Morgaine Dinova
What I had in mind Hiro was some sort of separation of function, ie. where only the individual monetary transactions would be handled (and logged for auditing) in an open-source script, while all the complex functionality could continue to be handled in the closed scripts that make up the bulk of the vendor product.


Just to pipe up - I make a vending system which utilized an inworld (all LSL based) server and vendor system. It automates updates to your items and prices, it tracks sales, and you OWN it - you are not reliant on any outside source for completion of your transactions.

I sell the kit as a full copy and mod(minus scripts) so that non-scripty folk can build a vendor they like the look of and retain the functionality it provides.

I'd hate people to think that because it's not OPEN source - it's going to rip them off - because there are a lot of folks like myself who simply want to 'build a better mousetrap' and put it on sale. I was a guy who didnt like what was available and tried to make it better. I have many happy clients and support them to the best of my ability any time they have questions. I truly hope a scam is not perpetrated on unsuspecting folks, and it certainly wont be by me.

again - just my 2 cents, and if you're interested i have a rolling demo at my shop in callisto - TrentCycle (callisto 234,62)

Cheers,
Trent
Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
11-20-2004 14:22
tacos.
Dax Mars
Registered User
Join date: 8 Feb 2004
Posts: 34
12-18-2004 10:59
From: Hiro Pendragon
Okay, I'm really biased, but:

/invalid_link.html


-Hiro Pendragon


I tried that link, but get an error message...
Cheri Skye
Does "guest" ever go away
Join date: 3 Dec 2004
Posts: 6
02-08-2005 13:38
From: Trent Hedges
Just to pipe up - I make a vending system which utilized an inworld (all LSL based) server and vendor system. It automates updates to your items and prices, it tracks sales, and you OWN it - you are not reliant on any outside source for completion of your transactions.

I sell the kit as a full copy and mod(minus scripts) so that non-scripty folk can build a vendor they like the look of and retain the functionality it provides.

I'd hate people to think that because it's not OPEN source - it's going to rip them off - because there are a lot of folks like myself who simply want to 'build a better mousetrap' and put it on sale. I was a guy who didnt like what was available and tried to make it better. I have many happy clients and support them to the best of my ability any time they have questions. I truly hope a scam is not perpetrated on unsuspecting folks, and it certainly wont be by me.

again - just my 2 cents, and if you're interested i have a rolling demo at my shop in callisto - TrentCycle (callisto 234,62)

Cheers,
Trent


It's a nice vendor, but definitely not in the price range of someone new or even relatively new. Sorry, but I just don't have 9k to my name, and if I did, I can think of much I'd rather do with it than spend it on a vendor. (Motorcycles are kinda cool - ;) lol) For now, guess I just wait til a certain someone I know finishes his versions of the same type of thing and sells 'em for a fraction of that price.
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
02-11-2005 00:34
From: Cheri Skye
It's a nice vendor, but definitely not in the price range of someone new or even relatively new. Sorry, but I just don't have 9k to my name, and if I did, I can think of much I'd rather do with it than spend it on a vendor. (Motorcycles are kinda cool - ;) lol) For now, guess I just wait til a certain someone I know finishes his versions of the same type of thing and sells 'em for a fraction of that price.

Cheri, check out my vendor kit. It does all this, more, sales recording of the last 30 sales, and includes a hologram-rezzing vendor. FREE.

There's no reason to pay for vendors.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Ameretto Fredericks
Registered User
Join date: 11 Apr 2004
Posts: 48
Vendor
06-18-2005 20:06
Id like a vendor that allows members of a group to recieve a discount on items purchased if they are wearing their group tag at the time of purchase. is this possible?
_____________________
Second Life....My First Home.

Ameretto's Designs @ SL Exchange

Ameretto's Designs @ SL Boutique

My Main Store In Game
Selby 217,35

Lexi Morgan
★Stellar★
Join date: 22 Apr 2004
Posts: 585
06-21-2005 13:57
Hiro,
I use your 3 prim vendors.. and LOVE them. Very simple to learn and maintain..and last but not least.. FREE! ty for putting them out there for us :)
Fiona Fielding
Registered User
Join date: 21 Jun 2005
Posts: 24
06-23-2005 12:04
From: Ameretto Fredericks
Id like a vendor that allows members of a group to recieve a discount on items purchased if they are wearing their group tag at the time of purchase. is this possible?

You can probably use llSameGroup and just do a division on the price.
Rob Figtree
Registered User
Join date: 13 Jun 2006
Posts: 14
compile error at 10/10/06
10-10-2006 12:03
Just for info. - the script as posted will not compile as of 10/10/06. The following corrections will allow the script to compile. PLEASE NOTE - I am saving the script for future analysis/modification, therefore I have not tested these changes in terms of functionality. These simply let the script compile.

1) - Comment out the first 5 lines of code as they are repeated immediately below.

2) - There is a typo midway through the script. Find the error by attempting to save the script in-world. It will stop at the error. Change "llDectedKey" to "llDetectedKey".

Again, the script will compile with these changes, I have no idea if it actually works as intended.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
10-11-2006 18:42
You probably should check the operation of your closed source vendor by very carefully perusing your transaction on the sl web site and checking for simultaneous incomes and outgoings. There might be a randomize function and it might only steal from 1% of your transactions or whatever!