Difference between revisions of "User:Trinity Coulter/Dropbox script"
Jump to navigation
Jump to search
(Created page with 'Drop items onto the script and it will send to the specified key. Must change the name too, or it will read the wrong name to the person in the touch help text. <lsl> //change ...') |
|||
Line 6: | Line 6: | ||
key sendto_key = "00000000-0000-0000-0000-000000000000"; | key sendto_key = "00000000-0000-0000-0000-000000000000"; | ||
string sendto_email = ""; //if left blank, box will IM only | |||
string name_of_notecard_to_keep = "Just a note"; //must match case of letters | |||
default | default | ||
{ | { | ||
Line 12: | Line 16: | ||
llAllowInventoryDrop(TRUE); | llAllowInventoryDrop(TRUE); | ||
} | } | ||
touch_start(integer total_number) | touch_start(integer total_number) | ||
{ | { | ||
llSay(0, "Drop stuff on me to send to " + sendto_name + "."); | llSay(0, "Drop stuff on me to send to " + sendto_name + "."); | ||
} | } | ||
changed(integer change) | changed(integer change) | ||
{ | { | ||
Line 25: | Line 29: | ||
for (x = 0; x < llGetInventoryNumber(INVENTORY_ALL); x++) | for (x = 0; x < llGetInventoryNumber(INVENTORY_ALL); x++) | ||
{ | { | ||
if (llGetInventoryName(INVENTORY_ALL, x) != llGetScriptName()) | if (llGetInventoryName(INVENTORY_ALL, x) != llGetScriptName() && llGetInventoryName(INVENTORY_ALL, x) != name_of_notecard_to_keep) | ||
{ | { | ||
llGiveInventory(sendto_key, llGetInventoryName(INVENTORY_ALL, x)); | llGiveInventory(sendto_key, llGetInventoryName(INVENTORY_ALL, x)); | ||
llInstantMessage(sendto_key, "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox."); | |||
if (sendto_email == "") | |||
{ | |||
llInstantMessage(sendto_key, "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox."); | |||
} | |||
else | |||
{ | |||
llInstantMessage(sendto_key, "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox. (email also sent)"); | |||
llEmail(sendto_email, "SL Dropbox Notification", "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox."); | |||
} | |||
} | } | ||
} | } | ||
x = 0; | x = 0; | ||
while (llGetInventoryNumber(INVENTORY_ALL) > 1) | float add_one = llStringLength(name_of_notecard_to_keep); | ||
if (add_one > 0) { add_one = 1;} | |||
while (llGetInventoryNumber(INVENTORY_ALL) > 1 + add_one) | |||
{ | { | ||
if (llGetInventoryName(INVENTORY_ALL, x) == llGetScriptName()) | if (llGetInventoryName(INVENTORY_ALL, x) == llGetScriptName() || llGetInventoryName(INVENTORY_ALL, x) == name_of_notecard_to_keep) | ||
{ | { | ||
x++; | x++; | ||
} | } | ||
else | else | ||
Line 46: | Line 61: | ||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
</lsl> | </lsl> |
Latest revision as of 13:46, 28 November 2009
Drop items onto the script and it will send to the specified key. Must change the name too, or it will read the wrong name to the person in the touch help text.
<lsl> //change these 2 lines, sendto_name and sendto_key string sendto_name = "Newbie Avatar"; key sendto_key = "00000000-0000-0000-0000-000000000000";
string sendto_email = ""; //if left blank, box will IM only
string name_of_notecard_to_keep = "Just a note"; //must match case of letters
default {
state_entry() { llAllowInventoryDrop(TRUE); } touch_start(integer total_number) { llSay(0, "Drop stuff on me to send to " + sendto_name + "."); } changed(integer change) { if (change & CHANGED_INVENTORY) { integer x; for (x = 0; x < llGetInventoryNumber(INVENTORY_ALL); x++) { if (llGetInventoryName(INVENTORY_ALL, x) != llGetScriptName() && llGetInventoryName(INVENTORY_ALL, x) != name_of_notecard_to_keep) { llGiveInventory(sendto_key, llGetInventoryName(INVENTORY_ALL, x)); if (sendto_email == "") { llInstantMessage(sendto_key, "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox."); } else { llInstantMessage(sendto_key, "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox. (email also sent)"); llEmail(sendto_email, "SL Dropbox Notification", "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox."); } } } x = 0; float add_one = llStringLength(name_of_notecard_to_keep); if (add_one > 0) { add_one = 1;} while (llGetInventoryNumber(INVENTORY_ALL) > 1 + add_one) { if (llGetInventoryName(INVENTORY_ALL, x) == llGetScriptName() || llGetInventoryName(INVENTORY_ALL, x) == name_of_notecard_to_keep) { x++; } else { llRemoveInventory(llGetInventoryName(INVENTORY_ALL, x)); } } } }
}
</lsl>