Actually add the notecard scripts

This commit is contained in:
Fred Beckhusen
2016-06-01 10:26:43 -05:00
parent 7d095b2c0c
commit d76e770f09
11 changed files with 182 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<Solution name="Give_All_NoteCards_To_Owner">
<Project name="Give_All_Notecards_To_Owner" path="Give_All_Notecards_To_Owner\Give_All_Notecards_To_Owner.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,14 @@
<Project name="Give_All_Notecards_To_Owner" guid="9cd97cd5-4deb-4db1-8196-f12f65ddb12e">
<Object name="Object" guid="3637e8e8-416f-4458-945b-1f4ef279584c" active="true">
<Script name="Give_To_Individuals.lsl" guid="59d38b2b-bef6-45d9-ae5e-6da8e9466832">
</Script>
<Script name="Give_to_Owner_Only.lsl" guid="02191536-6a39-4c6b-9ddc-05e21ae10af5">
</Script>
<Notecard name="Ferd Resident" guid="ff85c794-3078-4425-8adc-2418e1acbb6d">
</Notecard>
<Notecard name="Ferd Resident1" guid="f2b50d04-eafe-4729-a7df-b16fea800138">
</Notecard>
<Notecard name="Somebody Else" guid="d213266d-51de-45a0-9bda-4761acd341ad">
</Notecard>
</Object>
</Project>

View File

@@ -0,0 +1,15 @@
// :SHOW:
// :CATEGORY:Mailer
// :NAME:Give_All_NoteCards_To_Owner
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2016-06-01 10:23:30
// :EDITED:2016-06-01 09:23:30
// :ID:1107
// :NUM:1897
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// Sample Noatecard
// :CODE:
notecard

View File

@@ -0,0 +1,15 @@
// :SHOW:
// :CATEGORY:Mailer
// :NAME:Give_All_NoteCards_To_Owner
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2016-06-01 10:23:41
// :EDITED:2016-06-01 09:23:41
// :ID:1107
// :NUM:1898
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// Sample Notecard
// :CODE:
notecard

View File

@@ -0,0 +1,53 @@
// :SHOW:1
// :CATEGORY:Mailbox
// :NAME:Give_All_NoteCards_To_Owner
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2016-06-01 10:19:38
// :EDITED:2016-06-01 09:23:07
// :ID:1107
// :NUM:1895
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// Gives one or more notcards to whoever touches it, by name. Notecards have to be in Legacy name format such as 'Ferd Frederix', or 'Ferd Frederix1', 'Ferd Frederix2'. Not the 'Ferd.Frederix' style.
// :CODE:
// give notecard by Legacy name
// i.e. "John Doe" or if lastname Resident "John Resident"
integer debug = FALSE;
default
{
touch_start(integer N)
{
integer count = llGetInventoryNumber(INVENTORY_NOTECARD); // 1 or more?
while (count > 0)
{
// notecard indexes start at number 0, not 1, so we subtract 1
string notecardname = llGetInventoryName(INVENTORY_NOTECARD,count-1);
// name is the legacy name, i.e. "John Doe" or if lastname Resident "John Resident"
string avatarName= llDetectedName(0);
if (debug)
avatarName = "Ferd Resident";
// Returns an integer that is the index of the first instance of pattern in source.
// Function: integer llSubStringIndex( string source, string pattern );
// src (or notecard) = Ferd.Fredrix03, pattern = Ferd.Frederix, if it matches == 0
if (llSubStringIndex(notecardname, avatarName) == 0)
{
if (debug) llSay(0,"Giving " + notecardname);
llGiveInventory(llDetectedKey(0), notecardname);
if (!debug)
llRemoveInventory(notecardname);
}
count--; // count dowb to zero
}
}
}

View File

@@ -0,0 +1,63 @@
// :SHOW:1
// :CATEGORY:Maibox
// :NAME:Give_All_NoteCards_To_Owner
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2016-06-01 10:19:39
// :EDITED:2016-06-01 09:23:07
// :ID:1107
// :NUM:1896
// :REV:1
// :WORLD:Second Life, Opensim
// :DESCRIPTION:
Gives one or more notcards to the owner when they touch it in a folder with todays date. Anyone can drop a notecard or other object into the prim by holding ctrl and dragging an item onto it.
// Added scripts will not run.
// :CODE:
list names; // a list of items we wish to give to owner
default
{
state_entry()
{
llAllowInventoryDrop(TRUE);
}
touch_start(integer N)
{
// give only to owner
if (llDetectedKey(0)== llGetOwner())
{
integer count = llGetInventoryNumber(INVENTORY_ALL); // 1 or more?
while (count > 0)
{
// notecard indexes start at number 0, not 1, so we subtract 1
string notecardname = llGetInventoryName(INVENTORY_ALL,count-1);
if (notecardname != llGetScriptName())
{
names += [notecardname];
}
count --;
}
string folder = llGetDate();
llGiveInventoryList(llDetectedKey(0),folder, names);
count = llGetInventoryNumber(INVENTORY_ALL); // 1 or more?
while (count > 0)
{
// notecard indexes start at number 0, not 1, so we subtract 1
string notecardname = llGetInventoryName(INVENTORY_ALL,count-1);
if (notecardname != llGetScriptName())
{
llSay(0,"Del " + notecardname);
lRemoveInventory(notecardname);
}
count--;
}
}
}
}

View File

@@ -0,0 +1 @@
notecard

View File

@@ -0,0 +1,15 @@
// :SHOW:
// :CATEGORY:Mailer
// :NAME:Give_All_NoteCards_To_Owner
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2016-06-01 10:23:53
// :EDITED:2016-06-01 09:23:53
// :ID:1107
// :NUM:1899
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// Sample Notecard
// :CODE:
notecard