Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Notecard Delivery System?

Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
09-11-2007 13:04
I've searched around a bit, but haven't seen this mentioned in the way that I'm hoping to do it. I've tried an "updater system" that seems to do this, more or less, but no parts of it could be modified, and it only delivered single items.

I've also tried mailbox systems that send copies to business partners, but those seem to fail if one is not the owner of the land the box is on, which I'm not.

What I need is a simple 1-prim box that notecards can be dropped into and either collected on click by someone else, or (ideally) will deliver them when dropped into the box.

I know there's a simple solution, I'm just not seeing it. *laugh* Anyone have any suggestions or know of any scripts/functions that will get me pointed in the right direction, please? ^^
_____________________
Auron Reardon
Registered User
Join date: 30 Jun 2006
Posts: 41
09-11-2007 13:37
I can't point you to any existing scripts, but here is what I would do:

Have 2 notecards in inventory. One, call it "config", holds the key of each agent recipient (1 per line). The other is the notecard that you want to deliver to the recipients - call it "content".

On the state_entry event, use the dataserver functions and event to read all the keys from the first notecard into a global list variable. You could by-pass this whole part as well as the config notecard and just paste the keys into the script - but I like configuration files personally. It will also let you remove perms from the script if you are giving the whole thing to someone else. That way, they can manage the recipient list without getting into your script.

Then, on the changed event, watch for INVENTORY_CHANGED which will happen when you drop a new content notecard into inventory. When this event fires (because you dropped an updated content card), loop through the global list variable of recipients and use llGiveInventory to hand each one the updated notecard.

There are several more things you might want to do for security and avoiding errors, but basically that is the idea.
Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
09-11-2007 18:36
default
{
state_entry()
{
llAllowInventoryDrop(TRUE);
}
changed(integer mask)
{
if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY))
llWhisper(0, "My inventory has changed";);
}
}


If add is true, all users, even those who do not have modify permissions, can drop inventory items onto the object.

For notecard drop, there is no need to hold the control key. Just drag and drop your notecard on which the object will be highlighted with a white frame.

more: http://lslwiki.net/lslwiki/wakka.php?wakka=llAllowInventoryDrop

greetz

a8
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
09-12-2007 06:01
I sorta whanged this together yesterday from a basic "give inventory" script I had sitting around. It's not elegant, and I'm sure there are better ways to do it, but... it functions as I needed it to, so far:

CODE

default
{
state_entry()
{
llAllowInventoryDrop(TRUE);
}
changed(integer mask)
{
if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY))
llOwnerSay("changes saved");
}

touch_start(integer total_number)
{
key giver;
giver = llDetectedKey(0);
string name = llDetectedName(0);

if (giver = "//UUID OF RECIPIENT//") {
integer InvNum;
string NoteName;
integer NumCards = llGetInventoryNumber(INVENTORY_NOTECARD);
for ( InvNum = 0; InvNum < NumCards; InvNum++) {
NoteName = llGetInventoryName(INVENTORY_NOTECARD, InvNum);
llGiveInventory(giver, NoteName);
llOwnerSay("notecards sent!");
llRemoveInventory(NoteName);
}
}
}
}


Where "//UUID OF RECIPIENT//" is the UUID of the avatar that mail should go to. It's imperfect, and I'm open to suggestions, but for a quick throw-together script, it seems to work alright.
_____________________
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
09-12-2007 07:03
Hint:

When giving out inventory items using a loop of any kind and also removing them within the same loop it is a good idea to do the counting backwards.

If you count from 0 upwards you will find that your script will error after delivering and removing half the notecards.

This goes for the delivery of multiple notecards. A single notecard will work.
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
09-12-2007 07:14
From: Squirrel Wood
Hint:

When giving out inventory items using a loop of any kind and also removing them within the same loop it is a good idea to do the counting backwards.

If you count from 0 upwards you will find that your script will error after delivering and removing half the notecards.

This goes for the delivery of multiple notecards. A single notecard will work.


Good point--haven't tested it with more than one yet--will work on that next chance I get. Thanks for the heads-up! ^^
_____________________