Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

network vendor script for non copy objects

Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-06-2005 17:25
guys i am looking for a network vendor script either sample or complete system for items that are non copyable by the owner. I would place a limited amount of each item on the vendor server and the clients would sell that item till the stock runs out for an item.

Wondering if there is a script out there to do this or if anyone knows of sample script i could build this system from.

I would love to buy a premade system if there is one but if needed i will make it myself if i have something to base it off.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-06-2005 17:33
No copy, for the owner, objects can no longer be given via llGiveInventory or llGiveInventoryList. Sorry.
_____________________
Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-06-2005 17:37
Then how are you meant to sell these items? There has to be a way and putting 50 of the same item on a shelf using up prims is not it.

Is there atleast a way to transfer/ give a non copy script? I have transfer/sell rights just not copy.


Someone has to know a way around this restriction
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-06-2005 17:54
You could set up a script inside the object being bought, when it recieves money, it could notifiy an object below it. That object could then rez one of your 50 non copy objects, and that object would have the same script in it as well. An added benifit of this is that you can also use the script in it to change the name back to its orginal state as opposed to Object 1, Object 2, etc. Hope that helps.
_____________________
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-06-2005 17:55
I'm not sure about the non-giving of non-copy objects through llGiveInventory...but we'll go on that it's true (as I don't know any better...)...

...how about setting a base object and using a money event...

...when the money event is triggered and completed successfully, a ticker counts up by one...

...when the ticker reaches a certain level, the vendor self-destructs...


...if you'd like to pay for such a vendor, contact me in-game. If you know what you're doin' with scripts...it should work out.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-06-2005 18:03
Cid thats a good idea. It is a pain to maintain multiple locations that way but do able and the scripts can notify me on stock levels centerally.

Kenn i am not sure what you are getting at. You suggestion does not seem to cover ownership transfer. keeping track of the items left should no be hard but transfering objects between owners via script seems to be when you can't copy the item.

Cid can you set the sell price on a object via script or is that jsut something i need to do before i put it into the object to be rezed when needed?

Seer
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-06-2005 18:11
From: Seer Xingjian
Cid can you set the sell price on a object via script or is that jsut something i need to do before i put it into the object to be rezed when needed?

Seer

llSetPayPrice & Example Money

Also in case you want to see the new update to llGiveInventory...LINK
_____________________
Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-06-2005 18:24
Cid on the updated llGiveInventory link you included is this text

Q: When I try to give an inventory item to an agent, the item disappears from the original object's inventory. What's going on?
A: This is happening because you don't have copy permission on the item you're trying to give. Consequently, the script gives the only copy of the item in your object. To determine whether or not you have permission to give the objects specified, use llGetInventoryPermMask.


This suggests that you can give non copy objects. Are you sure that after the latest patch you can't give away non copy? If not no big issue i guess just a pain.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-06-2005 22:25
From: Seer Xingjian
Cid on the updated llGiveInventory link you included is this text

Q: When I try to give an inventory item to an agent, the item disappears from the original object's inventory. What's going on?
A: This is happening because you don't have copy permission on the item you're trying to give. Consequently, the script gives the only copy of the item in your object. To determine whether or not you have permission to give the objects specified, use llGetInventoryPermMask.


This suggests that you can give non copy objects. Are you sure that after the latest patch you can't give away non copy? If not no big issue i guess just a pain.


If the recipient is an agent, the user then follows the normal procedure of accepting or denying the offer. If the recipient is an object, the same permissions apply as if you were dragging an inventory item onto the object by hand, i.e. if llAllowInventoryDrop has been called with TRUE, any other object can pass items to its inventory. No copy objects can not be given.
_____________________
Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-06-2005 23:26
I just wanted to clarify for everyone. I have done some tests and have found you can give inventory of objects that are no copyand no mod but are transferable.
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
11-07-2005 00:43
From: Cid Jacobs
No copy objects can not be given.
Cid? Where'd you get this? I know this was considered at some point, and I think it was like this for a short time in 1.6.something...
_____________________
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-07-2005 05:00
From: Jillian Callahan
Cid? Where'd you get this? I know this was considered at some point, and I think it was like this for a short time in 1.6.something...

Well, I tested it out after the update that broke it a while back, it said it was not able to give inventory due to permissions.

*update* Apparently it is now fixed so that it *CAN* give no copy inventoy. It was apparently closed for a short time due to an exploit. *runs to update wiki*

*updated update* It still will not let no copy objects be given from attachments. :-/
_____________________
Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-07-2005 13:45
ok guys got a basic no mod/no copy object vendor working but now comes the hard part.

I need to make it have better accounting i want details of each sale etc but i only want them sent once a day.

I want to store all the objects on a vendor server and use a vendor client to make sales so i can keep all stock in one place.

I need a way to send message between server and clients without slowing down the server or stoppinghte clients from receiving sales.

Also need to stop vendors selling if there is not stock of an item. it currently does this but this would change when there are server and clients.

any suggestions?

Chris
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
11-08-2005 11:23
I believe, though I would have to test it and I don't have time right now, that:

1. You can give a no-copy object to an Agent/Avatar.
2. You can NOT give a no-copy object to another object.
3. You can NOT rez a no-copy object from an object.
4. You can NOT get the llGetInventoryKey() of a no-copy object.

Obviously it must also have Transfer permission but the last time I checked, the above 4 rules were correct.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-08-2005 11:26
From: Gaz Hornpipe
I believe, though I would have to test it and I don't have time right now, that:

1. You can give a no-copy object to an Agent/Avatar.
2. You can NOT give a no-copy object to another object.
3. You can NOT rez a no-copy object from an object.
4. You can NOT get the llGetInventoryKey() of a no-copy object.

Obviously it must also have Transfer permission but the last time I checked, the above 4 rules were correct.


*grumbles about undocumented changes*

1. TRUE
2. FALSE (was FALSE, then TRUE, now FALSE again)
3. FALSE (the object will just lose its copy of the object)
4. TRUE
_____________________
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
11-08-2005 11:36
From: Seer Xingjian
ok guys got a basic no mod/no copy object vendor working but now comes the hard part.

I need to make it have better accounting i want details of each sale etc but i only want them sent once a day.

I want to store all the objects on a vendor server and use a vendor client to make sales so i can keep all stock in one place.

I need a way to send message between server and clients without slowing down the server or stoppinghte clients from receiving sales.

Also need to stop vendors selling if there is not stock of an item. it currently does this but this would change when there are server and clients.

any suggestions?

Chris


First thing is, the items that you sell will need to have copy for yourself.. though the next owner permissions may still be no-copy, unless you feel like stocking the server everyday. It might be better to have counters running on each sale from a networked vendor and when the counter for a particular vendor and object sold on that vendor reachs the limit you have set for it, it no longer sells that item to the player.

Keeping track of sales is merely a matter of keeping a running counter of which objects sold and how much they sold and the totals of all. So when someone buys "Widget A" at L$25, you would just add 1 to the Widget A counter for that vendor, then add 25 to the sales for Widget A, then add 25 to the total sales for that vendor, then add 25 to the total sales for all vendors.

Since you will most likely be using lists, have a look at the llListReplaceList() function which you will need to use to replace list values. So you get the index of the item name in the list; then you grab the value of the current amount sold using that index; then you replace the value with the new value.

list widgets = ["Widget A","Widget B","Widget C"];
list widgets_sold = [0,0,0];

integer index = llListFindList(widgets,["Widget A"]);

That gets you your index. Then you just sold one Widget A, so you need to replace the value of the corresponding Widget A sold value.

integer temp_int = llList2Integer(widgets_sold,index);
temp_int++;
widgets_sold = llListReplaceList(widgets_sold,[temp_int],index,index);

That's the basic idea anyway.

PS. Also note that the widgets_sold list is a list of Integers, not a list of strings like almost every other list. So if you are storing it as a list of strings you won't want to use llList2Integer().. you will want to typecast the string that llList2String() returns, for example: integer temp_int = (integer)llList2String(widgets_sold,index);
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
11-08-2005 11:45
From: Cid Jacobs
*grumbles about undocumented changes*

1. TRUE
2. FALSE (was FALSE, then TRUE, now FALSE again)
3. FALSE (the object will just lose its copy of the object)
4. TRUE


Oh right.. yes.. it was:

1.6.11(2)
August 15, 2005

* llRemoteLoadScriptPin, llGiveInventory, llRezObject, and llRezAtRoot no longer work on no-copy assets in attachments.

hehe.. fun! :)
Seer Xingjian
Registered User
Join date: 29 Sep 2005
Posts: 35
11-08-2005 12:06
GAz, thanks for the info but my items are limited stock that i will have to place on the server. i do not have copy/modigy rights only transfer rights ang thats why i want a centeral server.

Now if i am to so networked vendor for limited stock objects i see it needing a very different communication system than existing network vendors. existing ones can afford a delay delivering the product and dont need to care about stock levels.

I need to be able to have multi client vendors in an area that can talk to the server in a fast manner and get a quick response. eg vleint vendor 1 and 2 ask for stock levels on 2 different items and the server responds to both in under a few second max.

the best way i can think to do this for now is a 3 part network vendor system. A main server that holds stock etc and has a group of scripts to send emails so it is not slowed by email wait time. A site server that sits near the site venders that takes requests on a channel and converts that and then sends it via a bank of email secripts again to make sure this script is not lagged by email wait time and to also reduce the number of scripts on the vendors. Finally the vendors them selves talk to the site server on a channel when they need information and the site server does all the work so the vendors are not lag effected in any way.

Anyone have a better idea?
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
11-09-2005 00:16
Still works out the same.. even if Vendor1 calls 1 nanosecond before Vendor2, Vendor2 will get the stock count after Vendor1's purchase. So..

Vendor1 buys WidgetA and there is only 1 WidgetA left to buy, so the count for WidgetA is now 0. Then, one nanosecond later, Vendor2's call comes in wanting a WidgetA.. the count is checked and there is none left.. so a refund and a message to say it's out of stock is sent to the potential buyer.

Whether it is a thousandth of a second or a few seconds or a minute between requests, one of the requests still needs to be processed before the other. And even iff both vendors email at EXACTLY the same time, which is highly unlikely but for arguement's sake we will consider it, one will still end up at the server before the other one and consquently will get processed first. Unless of course you have multithreaded scripts and the like.. but really there is just no need for that... If this was a Windows/Linux/Mac/Java program for something such as a airline booking system.. fair enough.. but it is LSL and there are limits to what you can do with LSL within the game.

EDIT: And even in the case of a multithreaded airline booking system, records still get locked while people are working on them so as to prevent data collisions and false data being provided, such as a ticket being sold that has already just been purchased at the same time... First in, first serve..

Oh and.. yes.. you can just have separate scripts within the server to handle the outbound emails. Doesn't need to be a completely separate object.