Difference between revisions of "Unpacker On Rez (NewAge)"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m |
m (<lsl> tag to <source>) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
Just copy and paste this script into your object that will contain your product and configure the few lines in // Configure; section | Just copy and paste this script into your object that will contain your product and configure the few lines in // Configure; section | ||
< | <source lang="lsl2"> | ||
// NewAge Auto Unpacker Script | // NewAge Auto Unpacker Script | ||
// By Asia Snowfall | // By Asia Snowfall | ||
Line 50: | Line 50: | ||
if(numberOfItems) | if(numberOfItems) | ||
{ | { | ||
llGiveInventoryList(inputKey, | llGiveInventoryList(inputKey, nameOfFolderToBeCreated, listOfItemsToSend); | ||
llInstantMessage(inputKey, | llInstantMessage(inputKey, | ||
"/me [" + thisScript + "]: Items have been sent into a folder named '" | "/me [" + thisScript + "]: Items have been sent into a folder named '" | ||
Line 77: | Line 77: | ||
} | } | ||
} | } | ||
</ | </source> |
Latest revision as of 09:15, 25 January 2015
NewAge Auto Unpacker v1.1
Just copy and paste this script into your object that will contain your product and configure the few lines in // Configure; section
// NewAge Auto Unpacker Script
// By Asia Snowfall
string nameOfFolderToBeCreated;
string messageToSendUponRez;
integer addThisScriptToFolder;
integer typeOfInventoryItemsToBeSent;
integer killAfterCompletion;
init()
{
nameOfFolderToBeCreated = llGetObjectName();// do not use an empty string
messageToSendUponRez = "";// leave empty to not send a message upon rez
typeOfInventoryItemsToBeSent = INVENTORY_ALL;// use INVENTORY_ALL to not apply a filter
addThisScriptToFolder = FALSE;
killAfterCompletion = TRUE;
}
try_to_send_items(key inputKey, integer inputType)
{
integer numberOfItems = llGetInventoryNumber(inputType);
string thisScript = llGetScriptName();
string itemName;
list listOfItemsToSend;
integer index;
do
{
itemName = llGetInventoryName(inputType, index);
if(itemName != "")
{
if(addThisScriptToFolder && itemName == thisScript)
listOfItemsToSend += [itemName];
else if(itemName != thisScript)
listOfItemsToSend += [itemName];
}
}
while(++index < numberOfItems);
// change to number of items in list now
numberOfItems = llGetListLength(listOfItemsToSend);
if(numberOfItems)
{
llGiveInventoryList(inputKey, nameOfFolderToBeCreated, listOfItemsToSend);
llInstantMessage(inputKey,
"/me [" + thisScript + "]: Items have been sent into a folder named '"
+ nameOfFolderToBeCreated + "' within your inventory.");
}
else
llInstantMessage(inputKey,
"/me [" + thisScript + "]: Could not find inventory items to send!");
}
default
{
on_rez(integer start_param)
{
init();
key owner = llGetOwner();
if (messageToSendUponRez != "")
llInstantMessage(owner, messageToSendUponRez);
try_to_send_items(owner, typeOfInventoryItemsToBeSent);
if (killAfterCompletion)
llDie();
}
}