Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGiveMoney() - does it?

Dire Lobo
Registered User
Join date: 20 Dec 2005
Posts: 47
04-20-2006 17:13
I have a script which sells something - I am trying to handle under and overpayment using the Pay button.

My script looks very much like the one in the LSL wiki where we test the amount paid against the required amount (cost) and if different refund the amount.

Calling llGiveMoney() appears to have no affect at all. Here is the money handler:

CODE

money(key id, integer amount)
{
if (amount != TSHIRT_PRICE)
{
llSay(0, "I'm sorry but you have tendered an incorrect amount. We are refunding your payment.");
llGiveMoney(id, amount);
}
}


When this code runs (when an avatar pays the object an incorrect amount) I can see the L$ debited from the account after the Pay but the llGiveMoney() seems to have no effect.

Am I making some dumb amateur error here?
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
04-20-2006 17:13
You are requesting PERMISSION_DEBIT from the object owner first, right?
Dire Lobo
Registered User
Join date: 20 Dec 2005
Posts: 47
04-20-2006 22:38
From: Yumi Murakami
You are requesting PERMISSION_DEBIT from the object owner first, right?


Errr, no! I never thought it would be required since I am not debiting money from an agent but giving it to an agent! I will of course add the permission request. Thanks.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-20-2006 23:02
Yumi's right and you are debiting it from an agent - objects don't hold money, the money you pay goes directly to the owner. When the object apparently gives a refund, it is (naturally) the object's owner that actually pays out.
Dire Lobo
Registered User
Join date: 20 Dec 2005
Posts: 47
Ahaaaa
04-20-2006 23:09
I see now. For some reason I had assumed that objects owned by me had the ability to take funds from my account and give them away without additional requirements Thanks for clarifying.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
04-21-2006 03:36
From: Dire Lobo
I see now. For some reason I had assumed that objects owned by me had the ability to take funds from my account and give them away without additional requirements Thanks for clarifying.


The permission is so that someone doesn't give you an object that then empties you account.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey