|
Elizabeth Tinsley
Registered User
Join date: 2 Jun 2006
Posts: 15
|
11-10-2006 18:02
I am trying to create an mailbox that will accept objects and then deliver them to the mailbox owner. I have created a script and it seems to compile alright but it doesn't send the object to the mailbox owner after accepting it. If anyone can tell me what Im missing I would appreciate it. Thanks  default { state_entry() { llAllowInventoryDrop(TRUE); } changed(integer mask) { if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)) llWhisper(0, "My inventory has changed"  ; } state_entry() { llGiveInventory(llGetOwner(),llGetInventoryName(INVENTORY_OBJECT, 0)); llGiveInventory(llGetOwner(),llGetInventoryName(INVENTORY_NOTECARD, 0)); llGiveInventory(llGetOwner(),llGetInventoryName(INVENTORY_TEXTURE, 0)); } }
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
11-10-2006 19:08
Well, you can't have 2 state_entry functions in the same state. The compiler apparently doesn't complain, but it won't work.
Try taking the 3 lines in your state_entry function, and putting them in the change() function, inside the check for the change inventory. This might work for no-copy items... if someone drops copiable items into your inventory, then (INVENTORY_ITEM, 0) will give you the first inventory item in alphabetical order (I think)... same for texture, notecard, etc. So you're not guaranteed that you'll get the new item, you might get the same item over and over again if it comes first in the list.
But, try that, that should get you started, hopefully.
|
|
Raeyan Aldrich
Registered User
Join date: 14 Oct 2006
Posts: 44
|
11-11-2006 18:45
all you needed to do was move the functions out of the second 'state_entry' and into the changed event... this script should hand over any objects, notecards, or textures to the owner when it receives them... note this tho, when an object receives an item of any sort that it has copy permissions for, llGiveInventory() will hand that agent a copy of the item. therefore you need to add some sort of cleanup to the changed event so that once it gives a copy away it will delete the original. default { state_entry() { llAllowInventoryDrop(TRUE); } changed(integer mask) { if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)) llWhisper(0, "My inventory has changed"); llGiveInventory(llGetOwner(),llGetInventoryName(INVENTORY_OBJECT, 0)); llGiveInventory(llGetOwner(),llGetInventoryName(INVENTORY_NOTECARD, 0)); llGiveInventory(llGetOwner(),llGetInventoryName(INVENTORY_TEXTURE, 0)); } }
|
|
Elizabeth Tinsley
Registered User
Join date: 2 Jun 2006
Posts: 15
|
11-12-2006 08:09
Thanks to both of you for your help. I really appreciate it.  Elizabeth
|