I'm working on something for an RP sim that is becoming much more complex than I want it to be, and I'm hoping someone with more scripting experience can tell me a better way to get the effect I want.
The basic idea is a candy store, where the avatar can pick from several choices of candy, or a random assortment. The candy has various RP effects, represented by animation changes, sounds, particles, and text. I want the candy to disappear when eaten. I would like candy to be able to be shared. I don't want to flood the customer with 50 pieces of candy going into their inventory. Candy must be wearable, since the avatar might not be able to rez it.
The easiest way I can think of to allow multiple effects, control inventory, and make eating the candy relatively easy is to store the candy in a bag, and have the bag wearable, and possess most of the scripting power. The candy could be objects, but since they're never actually rezzed, I was thinking of making them just notecards, that contain the information needed to generate their effects. So when a piece of candy is eaten, the bag script reads the notecard, figures out what text and animations to play, then removes the notecard to represent the candy being eaten. A menu system would make it easy to pick the type of candy (and have controls to shut off candy effects if they're bothering the avatar).
So far, this is all more complex than I want it to be, but doable. The problem is getting the candy in the bag.
The candy vendor will allow the avatar to pick between 1 and 5 kinds of candy (depending on bag size), or a random selection. So what is going in any one bag of candy can vary widely. I can't just make up 15 different bags of candy, and let them pick one to buy. (Well I could, but that takes away the "picking your candy" candy shop feel I'm going for.) Instead, I have to build the contents of each bag individually at the time of purchase.
You can only give items to objects that are rezzed. So I will have to have the candy counter give an already rezzed bag of candy the candy notecards that represent their candy selection. Then the avatar buys the bag (and gets a copy of its contents). But apparently you can't give identical items to an object??? If I give the CoolCandy notecard 5 times, only one copy will appear? So if I want the candy store to put up to 25 pieces of CoolCandy in the bag, I would have to have 25 CoolCandy notecards in the candy vendor, and if I also want to sell NiftyCandy, then that's 25 more notecards? All so that I can ensure that I am always able to give up to 25 unique copies of the notecard. If I want to have 15 different kinds of candy, that's a lot of notecards, and will slow down script processing. I'd really like to avoid this. Am I being dumb? Am I misreading how giving inventory works?
All the other ways I could think of to keep track of inventory wouldn't work because of this or that SL limitation, but maybe I'm missing something really obvious. If you were trying to make this kind of vendor, what would you do to give objects, keep track of inventory, and keep it simple to use?
