pay a specific person?
|
Gabrielle Assia
Mostly Ignorant
Join date: 22 Jun 2005
Posts: 262
|
09-09-2005 13:42
Is there a way for a script to pay a specific person by name? Something like: llPay("Joe Avatar", 10); I'm wanting to use something like this in a vendor... where the owner isn't the one (or only one) getting paid. llGiveMoney gives money from the script owner, but the money will be coming from the buyer, or person paying the object. thanks
|
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
|
09-09-2005 13:44
If not there definatly is by using their key. Someone who knows how to script their way out of a paper bag will be along to help you shortly 
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.--------------- Zapoteth Designs, Temotu (100,50)--------------- 
|
Padraig Stygian
The thin mick
Join date: 15 Aug 2004
Posts: 111
|
09-09-2005 14:07
There's some odd dancing around you have to do to get it to work. (I know 'cause I just did it...) Basically, when the vendor is paid, it pays you. Then you have to tell it to debit that amount from you and pay it to the other person. Give me a few minutes to find it in-world, and I'll paste what I'm talking about (if somebody doesn't beat me to it!) The "money" event is called when someone pays the object. This checks to make sure it's a valid amount and returns the money to the buyer if it's not. If it is valid, the item purchased is given to the buyer, and the full amount paid is then transferred to the person whose key is inserted. money(key id, integer amount) { if (amount == (integer)llList2String(prices,display)) { incSold(display); llGiveInventory(id, llList2String(items,display)); llWhisper(0,"Thank you for your purchase!"); llGiveMoney("76f10335-8583-4b67-b3f0-09241eedd522", amount); //edit the key here to be the key of the person you want the money to go to. llInstantMessage("76f10335-8583-4b67-b3f0-09241eedd522", "You have recieved " + (string)amount + "L$ from vendor " + llGetObjectName()); //Same with this line. } else { llWhisper(0,"Sorry that is the wrong amount for this item."); llGiveMoney(id, amount); } } Chunk of code hijacked from a modified version of Ama Omega's Vendor Script.
|
a lost user
Join date: ?
Posts: ?
|
09-09-2005 16:59
From: Gabrielle Assia Is there a way for a script to pay a specific person by name? Something like: llPay("Joe Avatar", 10); I'm wanting to use something like this in a vendor... where the owner isn't the one (or only one) getting paid. llGiveMoney gives money from the script owner, but the money will be coming from the buyer, or person paying the object. thanks Ok you can't pay to a name of a person, you can only ever pay to a key of person. What has to happen is this: Customer comes along and buys the product. The money goes into the Owner's account. The vendor then pays the correct person from the Owner's account. key pay_to = "76f10335-8583-4b67-b3f0-09241eedd522"; // example key
money(key id, integer amount) { if (amount == price_of_current_item) { llGiveInventory(id, name_of_current_item); llWhisper(0,"Thank you for your purchase!"); llGiveMoney(pay_to, amount); } else { llWhisper(0,"Sorry that is the wrong amount for this item."); llGiveMoney(id, amount); } }
Just cleaned up the code a little and made it a little easier to understand.
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
09-09-2005 17:40
You might find this doesn't work without requesting debit permissions from the owner.
|
Alex Edo
Insert Brain Here...
Join date: 27 Feb 2005
Posts: 108
|
09-10-2005 02:30
Here are a few useful maths for it.
Percent: 50 amount: 10
amount/100*Percent = Amount to the other person (AOP)
AOP = 5
|
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
|
09-10-2005 02:50
From: Eloise Pasteur You might find this doesn't work without requesting debit permissions from the owner. Oh.. OH! I know this one.. Let me see.. I wanna get this just right.. *start* You'll need to add.. llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); Into the state_entry part of your script to be able to debit L$ from the owner. Remember to accept when it asks *ends* Is that right?! Did I *actually* answer a scripting problem?! Mwahahahah.. sorry..
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.--------------- Zapoteth Designs, Temotu (100,50)--------------- 
|
Alex Edo
Insert Brain Here...
Join date: 27 Feb 2005
Posts: 108
|
09-10-2005 04:01
Yes
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
09-10-2005 09:21
From: Alex Edo Here are a few useful maths for it.
Percent: 50 amount: 10
amount/100*Percent = Amount to the other person (AOP)
AOP = 5 No offense, but if someone told me something like that, I'd be offended. And Zapoteth, yes. Don't be too inordinately pleased with that 
|
a lost user
Join date: ?
Posts: ?
|
09-11-2005 02:22
default { on_rez(integer p) { llResetScript(); }
state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); }
run_time_permissions(integer perms) { if(perms != PERMISSION_DEBIT) { llOwnerSay("To allow for refunds and money to be paid out you MUST allow this object to take money from you. Resetting the object in 5 seconds."); llSleep(5.0); llResetScript(); } } } You can't assume that the person has given permission to debit. I know that when I first ran a vendor, way back when, I was a little usnure whether I wanted to let an object take money from me. So if they don't allow permissions, you need to make sure the user knows why they are being asked, then reset the script and bascially don't let people use the script till they have allowed permission to debit. This way you can be sure that, when you are doing all the other btis in the your script, that you have permission to refund etc. As for making percentage cuts... I had to modify one of my casino games to allow it to give 5% of my takings to the owner of a mall. Unfortunately the ticket price on my machine is only 10L so 5% of 10 is 0.5. Also.. the amount of money given is an integer, not a float. Rather than just throwing some math at you, here's a little snippet of code to do it. // It's much easier for someone to change a notecard than to modify a script.. // especially if you don't want them to have modify rights to your script. // So probably better to read these kind of "configuration" values from a notecard percentage = 0.05; // 5% key pay_to = "";
default { money(key id, integer amount) { // Round the amount up, so if it's less than 1L it will be at least 1L // Also make sure you typecast the amount to a float when you do // the calculation. llGiveMoney(pay_to,llCeil(percentage * (float)amount); } }
|