Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to do a notecard collector when...

et0021 Jupiter
Registered User
Join date: 28 Sep 2009
Posts: 11
11-20-2009 00:29
Hi,

how to do a note card collector when the avatar put a note card into the collector.. the collector will give the avatar a confirmation note card to indicate that the avatar have successfully submitted the notecard?
Fox Marchant
be alert...SL needs lerts
Join date: 10 Sep 2009
Posts: 200
11-20-2009 00:43
/me gets some popcorn........thank goodness it's friday
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
11-20-2009 02:13
First, you can ABSOLUTELY not detect who drops something. For SL, dropping items into an object is the same than giving items to another AV. Once you detect something is dropped, you are already the owner.

The common way around is to have the AV touch the object before to allow the drop... but it doesn't prevent any passing-by AV to drop all his inventory after the first has triggered the "opening of the box". Allowing drop on an object means: "This object is now like a trashcan in a public parc"...

And: "All your trash are belong to us". No filtering whatsoever is possible.

Next, unless you explicitely state that ppl must drop only freshly created notecards --so that you can detect the creator-- there is no direct way to retrieve the previous owner. If somebody recycle an old notecard and doesn't write his name in it, you will know nothing about this notecard except the creator.

Last, one thing must be clear: There is ABSOLUTELY no way to give a personalised notecard. Neither the name, nor the date, nor the contents. Nothing. Period.

The rest is quite easy... but not 100% bulletproof

This untested script assumes your drop box has at least 2 prims and will move the received notecards in the child prim.

(Quote me to retrieve the layout.)

string Confirmation = "Confirmation Notecard";
key Storage;
key Toucher;
integer Dropped;

default
{
state_entry()
{
llAllowInventoryDrop(FALSE);
Storage = llGetLinkKey(2); // We put the received notecards in a safe place
}

touch_end(integer num)
{
Toucher = llDetectedKey(0);
state openbox;
}
}

state openbox
{
on_rez(integer param) { state default; }

state_entry()
{
Dropped = FALSE;
llAllowInventoryDrop(TRUE);
llInstantMessage(Toucher, "You have 30 secs to drop your notecard.";);
llSetTimerEvent(30.0);
}

timer()
{
llSetTimerEvent(0.0);
if (! Dropped)
{
llInstantMessage(Toucher, "No valid drop was detected. Try again.";);
}
state default;
}

changed(integer change)
{
if (change & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY))
{
key owner = llGetOwner();
integer i = llGetInventoryNumber(INVENTORY_ALL);
for (--i; i >= 0; --i)
{
string item = llGetInventoryName(INVENTORY_ALL, i);
key creator = llGetInventoryCreator(item);
if (creator != owner)
{
if (creator == Toucher)
{
if (llGetInventoryType(item) == INVENTORY_NOTECARD)
{
Dropped = TRUE;
llGiveInventory(Storage, item);
}
}
if (llGetInventoryType(item) != INVENTORY_NONE)
// Better be over-cautious than sorry
{
llRemoveInventory(item);
}
}
}
if (Dropped)
{
llGiveInventory(Toucher, Confirmation);
llInstantMessage(Toucher, "Thanks.";);
}
state default;
}
}
}
// End of script

Have fun!
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
11-20-2009 02:48
Two more possibly goofy ideas: If you expect them to create their own notecards, you could check the item creator after the drop. If you are giving them a form to fill out or something, you could ask them to fill in their name so that the script could read that. You can check the result against a list of nearby avatars.
_____________________