|
Own Westland
Second.Life@msn.com
Join date: 24 Dec 2007
Posts: 49
|
05-04-2008 02:20
1. How to know if the owner's L$ balance is enough to pay or not? 2. Or how to know how much the owner paid by llGiveMoney(owner,amount) if the L$ balance isn't enough to the amount?
_____________________
Helpful MSN Group: Second.Life@msn.com
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
05-04-2008 04:38
Basically, you can't do either as far as I'm aware, so if you have any sort of money-giving script you should always make sure that it is owned by an avatar with enough money. If you are concerned about running out, you could always hardcode a money limit which you _know_ the av will be able to pay, and when it runs out of money, shut down the script. So, say, something like: integer gFunds = 5000; // how much that av wants to pay out, at most integer AMOUNT = 100; // the amount to be paid each time
// returns TRUE if the funds will allow another payment after that integer pay(key id) { llGiveMoney(id, AMOUNT); gFunds -= AMOUNT; return (gFunds >= AMOUNT); }
default { state_entry() { llSetText("Touch for money", <1.0, 1.0, 0.0>, 1.0); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); }
touch_start(integer n) { if (!pay(llDetectedKey(0)) state out_of_money; } }
state out_of_money { state_entry() { llSetText("Sorry - out of money!", <1.0, 0.0, 0.0>, 1.0); } }
If there are multiple payout amounts, you'll have to set the threshold to be the maximum amount that you might have to pay (or assume that there will be a _little_ more money available to cover the excess over the funds limit).
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal
http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
05-04-2008 17:25
you could also know the initial balance of the giver, and track it inside the script, storing the current balance in the object description.
|
|
Own Westland
Second.Life@msn.com
Join date: 24 Dec 2007
Posts: 49
|
05-04-2008 18:24
But how could I know the initial balance of the owner if the owner isn't me ?
_____________________
Helpful MSN Group: Second.Life@msn.com
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-04-2008 23:48
From: Own Westland But how could I know the initial balance of the owner if the owner isn't me ? You can't. You shouldn't. We wouldn't want you to be able to. Basically, design your system differently.
|