Vendor that sells to Only One Person

Expired

//Title: Vendor to Sell to Only One Person //Date: 01-28-2004 04:38 PM //Version: 1.0.0 //Scripter: Ama Omega // string name = "Nameofpersonbuying"; integer price = 10; // adjust accordingly string item = "nameofitem"; default { state_entry() { llRequestPermissions( llGetOwner(), PERMISSION_DEBIT ); } run_time_permissions(integer perms) { if (perms & PERMISSION_DEBIT) state run; } } state run { money(key id, integer amount) { if (llKey2Name(id) == name) { if (amount != price) { llWhisper(0,"Sorry! The price is $" + (string)price); llGiveMoney(id,amount); } else { llGiveInventory(id,item); llInstantMessage(llGetOwner(),name + " bought their item."); state sold; } } else { llWhisper(0,"Sorry I'm only selling this to " + name); llGiveMoney(id,amount); } } } state sold { state_entry() { } }

Gumball Machine

Expired

// example gummy gumball machine
// version 0.3
// Public Domain January 2015 irihapeti
//
// will give out all the gummys in the machine contents
// in some "random" order and then refill itself
// so that a player wont get 2 gummmys the same in a row
// and if they keep playing will get all the common gummys in
// best case: not less than gbM-1 turns [exactly 1 of each common
//  gummmy] and worst case: not greater than 2*gbM-3 turns
//
// for rares
//   if gbC = 3 and gbM = 5 (which incl. the rare) then rare is
//   guarantee to be given 1 in each set of 13. 3 * 4 + 1
//   altho from a players pov they more likely to play bc can get at
//   least 1 of each common in max 7 turns. 3 + 4 
//   if gbC = 4 and gbM = 5 then is still 7 for the commons. and now
//    4 * 4 + 1 = 17 for rare
//   the shortest period for rare is: 2
//   the longest period is: 1 + (gbM-1) * gbC * gbC
//   e.g: if gbM = 4 and gbC = 2 then 3 * 2 * 2 + 1 = 13 
//         | x123 123 | 123 123x |  where x = rare
//   gbM = 3. gbC = 2. 2 * 2 * 2 + 1 = 9
//         | x12 12 | 12 12x |
         
// usage: reset script after loading the gummys in machine
//        give permission for refunds
//        then just pay to play
 
// change these to whichever
integer gbP = 1;      // L$ price to play gummy gumball
integer gbC = 3;      // number of rounds in which 1 only rare will be given
string  gbN = "rare"; // name of the rare gummy
 
// internals
list    gbL;  // index list of gummys currently in play
list    gbW;  // listcopy of gummys in machine excluding rare
integer gbG;  // this gummy to give
integer gbI;  // indice of this gummy to give
integer gbJ;  // indice of this round
integer gbK;  // indice of rare round
integer gbM;  // total number of gummys in machine
integer gbQ;  // number of gummys for this round
integer gbR;  // indice of the rare gummy
key     gbY;  // key of last player

gbS() // shuffle n pick
{
    if ((++gbI) == gbQ)  // then shuffle
    { 
        if ((++gbJ) == gbC) // rounds exhausted so pick new rare round
        {
            gbK = (integer)llFrand(gbC);
            gbJ = 0;    
        }             

        integer n = llList2Integer(gbL, gbQ-1); // save last item of old list
        
	gbL = gbW;                              // get copy of commons
        if (gbJ == gbK) gbL += [gbR];           // add in rare if rare round  
        gbL = llListRandomize(gbL, 1);          // shuffle
        
	gbQ = llGetListLength(gbL);             // save length of new list
        integer m = llList2Integer(gbL, 0);     // get 1st item of new list    

        if (n == m)  // 1st of new list is same as last of old list so swap it to a later place
        {
            n = 1 + (integer)llFrand(gbQ - 1);
            gbL = [llList2Integer(gbL, n)] + llDeleteSubList(llListReplaceList(gbL, [m], n, n), 0, 0);
        }
        
	gbI = 0;  // reset the list index
    }
    
    // next gummy in list
    gbG = llList2Integer(gbL, gbI);
}

gbA()  // reset machine
{
   gbL = gbW;
   gbQ = gbM;
   gbI = gbQ-1;
   gbJ = gbC-1;    
   gbS();
}    

default
{
   state_entry()
   {
      // set machine

      gbM = llGetInventoryNumber(INVENTORY_OBJECT);
      if (gbM == 0)
      {
         llOwnerSay("is no gummys in machine");
         return;
      }

      // get gummys into list. mark the rare
      gbR = -1;
      gbW = [];
      integer i;
      for (i = 0; i  0)
        { 
	   llGiveMoney(id, amount);
           llWhisper(0, "eep! you paid the wrong amount. "
              + "so we refund your L$" + (string)amount + " ok");
	}
        // if amount <0 then is a serious SL serverside error like totally

        return;
      }

      // clocker defend. reset everytime is a new player
      if (id != gbY)
      {
         gbY = id;
         gbA();
      }
          
      // all good. so give gummy     
      llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT, gbG));
                
      if (gbG == gbR)  // then rare given. add bling here as you like
      {
         llWhisper(0, "woohoo! you got a rare gummy \\o/");
      }
      else // common given
      {
         llWhisper(0, "enjoy your gummy ok (:");
      }

      gbS();  // prep for next play
   }
}  

 

Simple Profit Share Vendor ( V1 )

Expired

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • THIS SCRIPT WILL ASK FOR DEBIT PERMISSIONS. THEY MUST BE GRANTED FOR THE SCRIPT TO FUNCTION. L$ WILL BE TAKEN FROM THE OBJECT OWNERS ACCOUNT.

Sell the contents of an object (if in a link_set (multiple prim object) place in the root) for another creator. They get paid their cut and you get yours. You may provide a collection of inventory including LM's and/or NC's along with the main product. The script will pay the percentage to the creator named; The inventory may be created by multiple agents. If the creator named did not create anything in the inventory the script will ask that you start again.

 

// V1 //
 
integer price = 5; // Price of inventory. Must be greater than zero.
 
integer percentage = 50; // Percentage to pay creator of inventory.
 
string creator_to_pay = "Fred Gandt"; // Name of creator to pay percentage. Case Sensitive.
 
string folder_name = "Folder of Stuffs"; // The name of the folder as it appears in the buyers inventory.
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////// DON'T EDIT BELOW THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING //////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
 
key creator_to_pay_key = NULL_KEY;
 
key name_iq = NULL_KEY;
 
key owner = NULL_KEY;
 
list inventory = [];
 
integer search = 0;
 
list creators = [];
 
default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if(change & (CHANGED_OWNER | CHANGED_INVENTORY))
        llResetScript();
    }
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_TOUCH);
        owner = llGetOwner();
        if(percentage > 100)
        percentage = 100;
        llOwnerSay("\nClick this object when you have fully loaded the inventory." +
                   "\nYou will be asked to grant permissions." +
                   "\nYou MUST grant them for this script to function.");
    }
    touch_start(integer nd)
    {
        while(nd)
        {
            if(llDetectedKey(--nd) == owner)
            llRequestPermissions(owner, PERMISSION_DEBIT);
        }
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
        {
            llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
            llSetClickAction(CLICK_ACTION_PAY);
            integer in = llGetInventoryNumber(INVENTORY_ALL);
            key creator_key = NULL_KEY;
            integer count = 0;
            string name = "";
            do
            {
                if((name = llGetInventoryName(INVENTORY_ALL, count)) != llGetScriptName())
                {
                    inventory += [name];
                    if(llListFindList(creators, [(creator_key = llGetInventoryCreator(name))]) == -1)
                    creators += [creator_key];
                }
            }
            while((++count)  search)
            name_iq = llRequestAgentData(llList2Key(creators, (++search)), DATA_NAME);
            else
            llOwnerSay("\nThe creator to pay does not match any of the creators of the inventory." +
                       "\nPlease adjust the script appropriately.");
        }
    }
}
state shop
{
    on_rez(integer param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if(change & (CHANGED_OWNER | CHANGED_INVENTORY))
        llResetScript();
    }
    money(key id, integer amount)
    {
        if(amount >= price)
        {
            if(amount > price)
            llGiveMoney(id, (amount - price));
            integer cut = llFloor((((float)amount) / 100.0) * ((float)percentage));
            if(percentage && cut)
            llGiveMoney(creator_to_pay_key, cut);
            llGiveInventoryList(id, folder_name, inventory); // Last operation because of its 3 second script delay.
        }
        else
        {
            llGiveMoney(id, amount);
            llInstantMessage(id, ("\nYou paid too little.\nThe cost of this item is " + ((string)price) + "L$"));
        }
    }
}

 

Script Delivery Script

Expired

// V4 //
 
default
{
    state_entry()
    {
        integer count;
        integer links = llGetNumberOfPrims();
        do
        {
            string name = llGetLinkName(count);
            if(llGetSubString(name, 0, 5) == "drawer")
            {
                key link_key = llGetLinkKey(count);
                llGiveInventory(link_key, "Linkypooz"); // This is why the other script needs to be called "Linkypooz"
            }                                           // You can change it if you like.
        }
        while((++count) <(links + 1));
        llOwnerSay("\n\nNow take the object to inventory and re-rez.
        \n\nOpen an edit on the object.
        \n\nGo to the tools menu and, at the bottom of the menu click \"Set Scripts Running in Selection\".
        \n\nEdit all the prims of the drawers from the closed position/rotation to the open position/rotation.
        \n\nWhen all the prims of the drawers are set open (you can do one prim at a time or all together, which ever you prefer), touch each prim.
        \n\nWhen the prim is touched it will automatically close.
        \n\nWhen all the prims of all the drawers are in the closed position/rotation the scripts are fully set up.
        \n\nThey will chat that they are active when ready.
        \n\nNow touch the root and the script in it will self delete.
        \n\nThat's all!!");
        llRemoveInventory(llGetScriptName());
    }
}
[edit]