User:Trinity Coulter/Dropbox script

From Second Life Wiki
< User:Trinity Coulter
Revision as of 20:48, 27 November 2009 by Trinity Coulter (talk | contribs) (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 ...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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";

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())
               {
                   llGiveInventory(sendto_key, llGetInventoryName(INVENTORY_ALL, x));
                   llInstantMessage(sendto_key, "Sent \'" + llGetInventoryName(INVENTORY_ALL, x) + "\' from " + llKey2Name(llGetOwner()) + "'s dropbox.");
               }
           }
           
           x = 0;
           while (llGetInventoryNumber(INVENTORY_ALL) > 1)
           {
               
               if (llGetInventoryName(INVENTORY_ALL, x) == llGetScriptName())
               {
                   x++;
                   llRemoveInventory(llGetInventoryName(INVENTORY_ALL, x));
               }
               else
               {
                   llRemoveInventory(llGetInventoryName(INVENTORY_ALL, x));
               }
           }
       }
       
   }

}

</lsl>