Two Object Vendor 2.0

Expired

Put in object with 2 products and info note & set price. Owner can check to see total earned. 

Put this script along with TWO OBJECTS and an optional information Notecard.

Users will get a notecard on Touch and get item when a correct amount is paid.

Owner will get IM for each sale with user's name and can Touch to see how much money earned at any time.

 

 

// Begin variables
integer price = 100; //price for single (first item)
integer copyprice = 400; //price for copyable (second item)
string single = "Full Object Name"; //must match exact item name
string copyable = "Copyable Full Object Name"; //must match exact item name
string thanks = "Thank you for your purchase. Please accept your product.";
// End variables
//--------------------------------------------

integer totalsold = 0;
integer totalsoldcopy = 0;
integer totalamount = 0;
integer totalamountcopy = 0;

string startdate;
string ts;
list now;

default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
    
    state_entry()
    {
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
        llSetPayPrice(PAY_HIDE, [price, copyprice, PAY_HIDE, PAY_HIDE]);
        
        ts = llGetDate();
        now = llParseString2List( ts, ["-"], [] ) ;
        integer nyear = (integer)llList2String( now, 0 ) ;   
        integer nmonth = (integer)llList2String( now, 1 ) ;
        integer nday = (integer)llList2String( now, 2 ) ;
        if (nmonth == 1)
        {
            string smonth = "January";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 2)
        {
            string smonth = "February";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 3)
        {
            string smonth = "March";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 4)
        {
            string smonth = "April";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 5)
        {
            string smonth = "May";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 6)
        {
            string smonth = "June";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 7)
        {
            string smonth = "July";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 8)
        {
            string smonth = "August";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 9)
        {
            string smonth = "September";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 10)
        {
            string smonth = "October";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 11)
        {
            string smonth = "November";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 12)
        {
            string smonth = "December";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
    }
     
    touch_start(integer total_number)
    {
        if ( llDetectedKey(0) != llGetOwner() )
        {
            llInstantMessage(llDetectedKey(0), "Pay this object L$" + (string)price + " for '" + single + "' or L$" + (string)copyprice + " for '" + copyable + ".'");
            if (llGetInventoryNumber(INVENTORY_NOTECARD) > 0) //notecard available
            {
                llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
            }
        }
        else if ( llDetectedKey(0) == llGetOwner() ) //object owner
        {
            llOwnerSay((string)totalsold +" Single units have been sold, L$" + (string)totalamount +" since " + startdate + ".");
            llOwnerSay((string)totalsoldcopy +" Copyable units have been sold, L$" + (string)totalamountcopy +" since " + startdate + ".");
            integer alltotal = totalamount + totalamountcopy;
            llOwnerSay("L$" + (string)alltotal +" collected total so far.");
        }
    } 
    
    money(key id, integer amount)
    {
        if (amount == price) // single amount paid
        {
            llInstantMessage(id, thanks);
            llGiveInventory(id, single); //single version
            totalsold = totalsold + 1;
            totalamount = amount * totalsold;
            llInstantMessage(llGetOwner(), (string)llKey2Name(id) + " has paid " +  (string)amount + " in "+ llGetRegionName());
        }
        
        else if (amount == copyprice) // copyable amount paid
        {
            llInstantMessage(id, thanks);
            llGiveInventory(id, copyable); //copyable version
            totalsoldcopy = totalsoldcopy + 1;
            totalamountcopy = amount * totalsoldcopy;
            llInstantMessage(llGetOwner(), (string)llKey2Name(id) + " has paid " +  (string)amount + " in "+ llGetRegionName());
        }
        
        else // Not a correct amount, Refund amount
        {
            llInstantMessage(id, "Sorry that is not the correct amount. Refunding you L$" + (string)amount + ".");
            llGiveMoney(id, amount);
        }
    }
}

 

 

 

One Object Vendor 2.0

Expired

Put in object with product and info note & set price. Owner can check to see total earned. 

Put this script along with ONE OBJECT and an optional information Notecard. If multiple items, put them into one "box" object.

Users will get a notecard on Touch and get item when correct amount is paid.

Owner will get IM for each sale with user's name and can Touch to see how much money earned at any time.

 

 

 

// Begin variables
integer gCorrectAmount = 300; //enter your price
string thanks = "Thank you for your purchase. Please accept your product.";
// End variables
//--------------------------------------------

integer totalsold = 0;
integer totalamount = 0;

string startdate;
string ts;
list now;

default
{
    on_rez( integer param )
    {
        llResetScript();
    }
    
    state_entry()
    {
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
        llSetPayPrice(PAY_HIDE, [gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
        
        ts = llGetDate();
        now = llParseString2List( ts, ["-"], [] ) ;
        integer nyear = (integer)llList2String( now, 0 ) ;   
        integer nmonth = (integer)llList2String( now, 1 ) ;
        integer nday = (integer)llList2String( now, 2 ) ;
        if (nmonth == 1)
        {
            string smonth = "January";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 2)
        {
            string smonth = "February";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 3)
        {
            string smonth = "March";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 4)
        {
            string smonth = "April";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 5)
        {
            string smonth = "May";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 6)
        {
            string smonth = "June";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 7)
        {
            string smonth = "July";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 8)
        {
            string smonth = "August";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 9)
        {
            string smonth = "September";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 10)
        {
            string smonth = "October";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 11)
        {
            string smonth = "November";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
        else if  (nmonth == 12)
        {
            string smonth = "December";
            startdate = smonth + " " + (string)nday + ", " + (string)nyear;
        }
    }
     
    touch_start(integer total_number)
    {
        if ( llDetectedKey(0) != llGetOwner() )
        {
            llInstantMessage(llDetectedKey(0), "Pay this object L$" + (string)gCorrectAmount + " to purchase.");
            if (llGetInventoryNumber(INVENTORY_NOTECARD) > 0) //notecard available
            {
                llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
            }
        }
        else if ( llDetectedKey(0) == llGetOwner() )//object owner
        {
            llOwnerSay((string)totalsold +" units have been sold, L$" + (string)totalamount +" since " + startdate + ".");
        }
    } 
    
    money(key id, integer amount)
    {
        if (amount == gCorrectAmount)
        {
            // correct amount paid
            llInstantMessage(id, thanks);
            llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT, 0));
            totalsold = totalsold + 1;
            totalamount = amount * totalsold;
            llInstantMessage(llGetOwner(), (string)llKey2Name(id) + " has paid " +  (string)amount + " in "+ llGetRegionName());
        }
        
        else if (amount 

 

 

 

Dialog Based Sounds Vendor

Expired

//Dialog Based sounds vendor by Kenny Jackson
 
//NOTES:
//1.) All sounds in the vendor will have the same price.
//2.) Set the price by changing the vendor description.
//(example. If you want the price of all the sounds in the vendor to be L$50 set the vendor description to 50.)
//3.) After adding new sounds to the vendor or changing the price or vendor name hit the RESET button to update the script. Only the owner will see the RESET button.
//4.) Just drop this script and the sounds your selling into a prim
//5.) Click the prim to get the dialog.
//6.) If your going to have more than 1 of these in a small area make sure to have a different channel number on each of them or all the vendors in the area will respond to the others dialogs.
//Kenny Jackson
 
integer price;
string wrong = "Sorry, that is not the correct price";
string over = "You have overpaid, here is your change";
string thank = "Thank you for your purchase";
integer finished = FALSE;
integer n = 0;
integer i;
list sounds;
integer CHANNEL = 123456;
string soundName;
string GNAME;
string Vname;
 
default
{
    state_entry()
    {
      while(!finished)
        {
            soundName = llGetInventoryName(INVENTORY_SOUND, n);
            if(soundName == "")
            {
                finished = TRUE;
                Vname = llGetObjectName();
                price = (integer)llGetObjectDesc();
 
                state debtperm;
            }
            else
            {
               sounds = sounds + soundName;
                n++;
            }
          }
        }
}
state debtperm
{
 state_entry()
    {
        //Do some initialization here
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
    run_time_permissions(integer permissions)
    {
        //Only wait for payment if the owner agreed to pay out money
        if (permissions)
        {
            llSetText("Initailized Successfully...", <0,1,0>,1);
            state next;
        }
    }
}
state ready
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
 
    state_entry()
    {
     GNAME = llList2String(sounds, i);
 
     llListen(CHANNEL, "",  "", "");
    }
 
    listen(integer channel, string name, key id, string message)
    {
        if(channel == CHANNEL && message == "Reset")
        {
            llSetText("Resetting...", <1 ,0,0>, 1);
            llResetScript();
 
        }
 
        if(channel == CHANNEL && message == "Next")
        {
          i++;
 
          if(i >= n)
          {
          i = 0;
          state next;
 
          }
          else
          {
          state next;
          }
 
        }
        if(channel == CHANNEL && message == "Back")
        {
          i--;
 
          if(i <0)
          {
          i = n - 1;
          state next;
 
          }
          else
          {
          state next;
          }
        }
        if(channel == CHANNEL && message == "Play")
        {
         llPlaySound(GNAME, 1);
         state next;
        }
 
    }
    touch_start(integer total_number)
    {
        if(llDetectedKey(0) == llGetOwner())
        {
        llDialog(llDetectedKey(0),"1.) Choose Next/Back to scroll through sounds.\n2.) Press Play to hear a sound.\n3.) Right Click and Pay to buy!", ["Back", "Next", "Play", "Reset"], CHANNEL);
         }
         else
         {
        llDialog(llDetectedKey(0),"1.) Choose Next/Back to scroll through sounds.\n2.) Press Play to hear a sound.\n3.) Right Click and Pay to buy!", ["Back", "Next", "Play"], CHANNEL);
         }
    }
 
    money(key id, integer amount)
    {
        if(amount < price)
        {
            llSay(0, wrong);
            llGiveMoney(id, amount);
        }
        if(amount > price)
        {
            llSay(0, over);
            llGiveMoney(id, amount - price);
            llGiveInventory(id, GNAME);
        }
        if(amount == price)
        {
            llSay(0, thank);
            llGiveInventory(id, GNAME);
        }
    }
}
state next
{
    state_entry()
    {
        GNAME = llList2String(sounds, i);
        llSetText(".:" + Vname + ":.\nClick for a dialog!\nSound Name: " + GNAME + "\nPrice: L$" + (string)price, <1 ,1,1>, 1);
        state ready;
    }
}