Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llgivemoney won't work for me....

Clintok Meyer
Registered User
Join date: 28 Apr 2006
Posts: 17
05-21-2007 19:28
I am making something jointly and cannot figure out why I can't pay a person based on their ID. I had them do the dialog to generate it and I cut and pasted it but no luck.

The flow is like this. Can anyone see why I shouldn't be able to give some 3rd party money with this?

CODE

// ExampleMoney
// Pay the object money, this script refunds incorrect payments
// This code is public domain.

integer gCorrectAmount = 150; // this defines the correct price -- we only accept L$10
string item_name = "Toy"; // the name of the item we're going to look for.
key Friend = "a822ff2b-ff02-461d-b45d-dcd10a2de0c2"; //example key I do have the good one

default
{
state_entry()
{
llSetText("Right Click this box to pay $150 for Toy.", <0,1,0>, 1.0);
llAllowInventoryDrop(TRUE);
// get permission from the owner to pay out money using the llGiveMoney function.
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
}

money(key id, integer amount)
{
// has the user paid the correct amount?
if (amount == gCorrectAmount)
{
// if so, thank the payer by name.
llSay(0,"Thank you, " + llKey2Name(id) + ".");
llGiveInventory(id,"Toy");

//here is the offending code that won't work.....

llGiveMoney(Friend, AMOUNT/2);
}

// is the amount paid less than it needs to be?
else if (amount < gCorrectAmount)
{
// if so, tell them they're getting a refund, then refund their money.
llSay(0,"You didn't pay enough, " + llKey2Name(id) + ". Refunding your payment of L$" + (string)amount + ".");
llGiveMoney(id, amount); // refund amount paid.
}

// if it's not exactly the amount required, and it's not less than the amount required,
// the payer has paid too much.
else
{
// tell them they've overpaid.
integer refund = amount - gCorrectAmount; // determine how much extra they've paid.
llSay(0,"You paid too much, " + llKey2Name(id) + ". Your change is L$" + (string)refund + ".");
llGiveMoney(id, refund); // refund their change.
}
}
}


Thanks for any help you can offer.
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
05-21-2007 19:37
llGiveMoney(Friend, AMOUNT/2);

should be:

llGiveMoney(Friend, amount/2);

remember, variable names are case sensitive. :)
Hg Beeks
llGetElement(80);
Join date: 13 Apr 2006
Posts: 134
05-21-2007 22:55
Just thought I'd mention; Your code seems to pay them the change if they've overpaid, but doesn't give them the item.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
05-22-2007 04:55
Should there not be a llSetPayPrice( integer price, list quick_pay_buttons ) in there somewhere?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-22-2007 06:02
From: ed44 Gupte
Should there not be a llSetPayPrice( integer price, list quick_pay_buttons ) in there somewhere?


It would make sense but isn't essential.
_____________________
I'm back......
Clintok Meyer
Registered User
Join date: 28 Apr 2006
Posts: 17
05-22-2007 12:40
From: Clintok Meyer
I am making something jointly and cannot figure out why I can't pay a person based on their ID. I had them do the dialog to generate it and I cut and pasted it but no luck.

The flow is like this. Can anyone see why I shouldn't be able to give some 3rd party money with this?

CODE

// ExampleMoney

}


Thanks for any help you can offer.


Thanks for the help. I do set a buy only price.

Must remember that case matters....thanks again for your assistance and comments. :)