Prim Server (Giver)

Written by Kitsune

The Server Giver needs 2 objects, with each a script inside:
1 with the Server Prim Script
2 with the Server Child Prim Script

The object with the Server Prim Script handles the requests coming from the Child Prim.
You can make as many copies of the Child Prim. They will all make their requests to the same Server Prim.

QUICK SETUP
—————–

1. Create an object and name it “Child”. Open the Content tab, click New Script and replace the Hello Avatar script with the SERVER Child Prim Script
2. Create an object and name it “Server”. Open the Content tab and add a notecards (you will use this notecard later on to test the server). In the Content tab click New Script and replace the Hello Avatar script with the Server Prim Script. Save the script and you will find the UUID (unique User IDentifier) in Local Chat. Copy this UUID to your clipboard (Ctrl C).
3. Re-edit the object “Child” and open in the Content tab the Child Prim script. Replace the UUID you find in the script with the UUID of your “Server” (Ctrl V). Save the Child Prim Script.
4. To test the Server, touch the object you named “Server”. A blue dialogue will open and will say something like “[Objectname] owned by [Ownername] has given you an item named [Itemname], followed by the SLURL address.
5. Replace the content of the “Server” with the objects you want to give away. Store the Server Prim on a safe place on land you own (or paid the rent for).
6. Design the Child prim to your needs and start your distribution.

NOTE
——-
Once the Server Prim is rezzed and obtained its UUID key you CANNOT take the server into your inventory. If you do so and rerezz the server, the server will obtain a new UUID, which means you have to update ALL the child prims.
Though, you can MOVE the server over your land, or right-click the server and select WEAR to one of your hands. After teleporting or flying you must DROP the server. Do NOT DETACH or the server will go into your inventory and its UUID will be lost.
This Server Giver is FREE, keep it that way.

Enjoy
Adalace Jewell
Server Prim Script

 

// This is not a vendor server. It only GIVES items you put inside the server prim
 
// Once the Server is rezzed and obtained its UUID key you CANNOT take the server into your inventory. If you do so and rerezz the server, the server will obtain a new UUID, which means you have to update ALL the child prims.
 
// Though, you can MOVE the server over your land, or right-click the server and select WEAR to one of your hands. After teleporting or flying you must DROP the server. Do NOT DETACH or the server will go into your inventory and its UUID will be lost.
 
// FREE DISTRIBUTION, keep it that way
 
// Author: unknown
// Script Retrieved from Free SL Scripts at http://www.gendersquare.org/sl
 
string NewsServerKey = "";
 
integer a;
integer b;
string objectname;
list invent_types = [INVENTORY_BODYPART,INVENTORY_SCRIPT,INVENTORY_LANDMARK,INVENTORY_NOTECARD,INVENTORY_CLOTHING,INVENTORY_OBJECT,INVENTORY_SOUND,INVENTORY_TEXTURE];
integer type;
integer typecount;
 
default
{
     on_rez(integer i)
     {
          llResetScript();
     }
 
     state_entry()
     {
          NewsServerKey = llGetKey();
          llSetObjectDesc(NewsServerKey);
          llSetText(" ", <0,1,0>,1.0);
          llOwnerSay(llGetObjectName() + "\n"+ NewsServerKey);
          llSetTimerEvent(2.5);
     }
 
     touch_start(integer total_number)
     {
          NewsServerKey = llGetKey();
          llSetText("put name of server here ", <1,1,1>,1.0);
          llInstantMessage(llDetectedKey(0), "My Server Key is: " + NewsServerKey);
     }
 
     email(string time, string address, string subj, string message, integer num_left)
     {
          key target = subj;
            if (target == llGetOwner())
          {
               llOwnerSay("Touch received on a client prim from you.");
               //return; // uncomment if you want to receive copies of the server content yourself
          }
 
          integer total_number = 1;
          integer i;
          for (i=0;i < total_number;i++)
          {
               integer invent_count = llGetListLength(invent_types);
               string myname = llGetScriptName();
               for (a=0; a < invent_count;a++)
               {
                    type = llList2Integer(invent_types,a);
                    typecount = llGetInventoryNumber(type);
                    if (typecount > 0)
                    {
                         for (b=0; b < typecount;b++)
                         {
                              objectname = llGetInventoryName(type,b);
                              if (objectname != myname) // don't give self out
                              {
                                   llGiveInventory(target,objectname);
                              }
                         }
                    }
               }
          }
     }
 
     timer()
     {
          llGetNextEmail("", "");
     }
}
 
Child Prim Script
 
// When this prim is touched, it sends the persons that touches the prim the content of the "Server" prim.
// Author: unknown
// Script Retrieved from http://www.gendersquare.org/sl
 
string NewsTargetKey = "8649acf8-1319-572c-634b-ec90b16c9198"; // change this with the UUID of your "Server" prim
 
default
{
    state_entry()
    {
    llSetText("Touch me for NPC News", <1,1,1>,1.0);
    }
    touch_start(integer total_number)
    {
    llEmail(NewsTargetKey + "@lsl.secondlife.com", llDetectedKey(0), "");
    }
}