Jump to content

Object Give Inventory in One At a Time


Aeryn Brooks
 Share

You are about to reply to a thread that has been inactive for 4315 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi everyone. I'm relatively new to scripting and need to find a way for an object to give one of it's copy inventory objects at a time.

 

I'm making a dispenser of ribbons for a game I plan to sell. The ribbons are set to copy/trans so the holders can give their one away, but not make infinite copies and cheat. To ensure that the purchaser/overseer of the game doesn't just buy the system and give it away, I need to make the ribbons copy/trans and include several in the box with names like "Ribbon", "Ribbon 1", "Ribbon 2", etc. How can I script the box to just give one ribbon to whomever clicks it, and not all of them at once? I know there's a way because the RPS roleplay system has a vendor script that does exactly that.

 

I appreciate any help anyone can give me. :matte-motes-bashful-cute-2:

Link to comment
Share on other sites

Are you sure? I would think that would give away "Ribbon", but once that one's gone it'll break the script and won't give away "Ribbon 1", "Ribbon 2", etc. Remember, whomever buys the game will receive several copy/transfer ribbons in the dispenser that he or she will give away to others.

Link to comment
Share on other sites

You don't need a list. The inventory is already a list. Here is a very short script for an object to give its inventory one item at a time until it's empty. (I suppose your ribbons are objects.)

default{    touch_end(integer num)    {        key av = llDetectedKey(0); // First toucher        string item = llGetInventoryName(INVENTORY_OBJECT, 0); // First object        if (item != "") // Still one item left at least...        {            llGiveInventory(av, item); // Give it.        }        else // ...otherwise, complain.        {            llRegionSayTo(av, 0, "Sorry, the box is empty.");        }    }}

 Simple, isn't it?

(Although I typed it directly into the popup window to paste scripts, I'm confident it will compile.)

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4315 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...