Jump to content

getting group discount onto a vendor script.


You are about to reply to a thread that has been inactive for 539 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have a vendor script but i would like for it to be able to give 10% refund back to anyone who purchases wearing the tag. I have a copy of a vendor script with the group discount. HOWEVER, it has no hovertext saying whats in it, how many items etc.

 

This is the script i would like group discount added too:

// DO NOT put the API Coins (RP-HUD [G&S] script  in the vendor prim with any of the $L Only scripts!!

 

// ** Price in L$
integer PL = 30
;

 

string nom_obj;
integer active = FALSE;

display()
{
        integer cnt =  llGetInventoryNumber( INVENTORY_OBJECT );
        
        active = cnt>0;
    
        if(active){
            llSetText("Item Name Here"
            +(string)
"\n L$"+(string)PL+"\nAvailable: "+(string)cnt, <1,1,1>, 1);
            llSetObjectName("DFS Vendor: " +llGetInventoryName(INVENTORY_OBJECT,0));
        }else{
            llSetText("⬊ sᴏʟᴅ ᴏᴜᴛ ⬋", <1,1,1>, 1);   
        }
        
}

default {
    
    state_entry() {
        llSetPayPrice(-1,[PL,-1,-1,-1]);
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
    }
    
    run_time_permissions(integer perm)
    {
        if (perm&PERMISSION_DEBIT)
        {
            display();
        }
    }
    
    touch_start(integer num_detected) {
        if(active){
            
            llMessageLinked(LINK_SET, 700, llGetInventoryName(INVENTORY_OBJECT,0)+",",llDetectedKey(0));          
        }    
    }
    
    link_message(integer sender_num, integer num, string str, key id) {                

        if(num == 701){
              
            llSay( 0 ,  "Thank you for your purchase: "+llGetInventoryName(INVENTORY_OBJECT,0)+"  delivered to "+llKey2Name(id) );
            
            llGiveInventory( id, llGetInventoryName(INVENTORY_OBJECT,0) );
            
            display();
        }
        
        if(num == 702){
           
            llSay( 0 , "Vendor is being used by: "+str );
    
        }
    }
        
    changed(integer change){      
        if (change & CHANGED_INVENTORY){
               display();
        }
      }   
      
    money(key id, integer amount)
    {
        if (active && amount==PL)
        {
              
            llSay( 0 , ""+llGetInventoryName(INVENTORY_OBJECT,0)+""+llKey2Name(id) );
            
            llGiveInventory( id, llGetInventoryName(INVENTORY_OBJECT,0) );
            
            display();
        }
        else if (amount)
        {
            llInstantMessage(id,"There was something wrong with your payment. Your money will be refunded.");
            llTransferLindenDollars(id,amount);
        }
    }
       
    transaction_result(key id, integer success, string data)
    {
        if (success) llWhisper(0,"Payment refunded");
        else llInstantMessage(llGetOwner(),"Refund failure: "+llKey2Name(llList2Key(llParseString2List(data,[","],[]),0))+" "+data);
    }      
}

 

 

 

This is the group discount script i have without hover text Any help would be appreciated :

// Cost L$
integer everyone_price = 50;
// Group cost L$
integer group_price = 10;
// Name of new object inside for sale
string item = "NAME OF THE ITEM";


default
{
state_entry()
{
// Start up.
key owner = llGetOwner();
llSetPayPrice(PAY_HIDE,[everyone_price,PAY_HIDE,PAY_HIDE,PAY_HIDE]);
llRequestPermissions(owner, PERMISSION_DEBIT);
}

money(key id, integer tendered)
{
// The vendor received money.
integer sameGroup = llSameGroup(id);
integer price = everyone_price;
if(sameGroup)
{
// Customer has correct group active.
price = group_price;
}

if(tendered < price)
{
// Customer paid too little. Refund.
llGiveMoney(id, tendered);
llInstantMessage(id, "The purchase price is L$ " + (string)price + ". Your payment of L$ " + (string)tendered + " was refunded to you. Please try again.");
}
else
{
// The customer has made the purchase.
string thanks = "Thank you for your purchase!";
if(tendered > price)
{
// Customer overpaid. Give change.
integer change = tendered - price;
llGiveMoney(id, change);
thanks += " Your change is L$ " + (string)change;
if(sameGroup)
{
thanks += " due to group discount ^^";
}
}
// Fulfill vendor's end of the contract.
llInstantMessage(id, thanks);
llGiveInventory(id, item);
}
}
}

 

Link to post
Share on other sites

If you would like someone to script it for you, you should post your question in the "Inworld Employment" forum. This forum is for scripters who have questions that they encounter during their projects. This job should take an experienced scripter 5 to 10 minutes (testing included), so don't pay to much for it...

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 539 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...