Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How ti make existing vendor split profits in half

Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
07-20-2004 13:59
I have a free vendor that i got off the Wiki site, but i need it to split the profits between me and another person. i know how to do it in theory, but i dont know how to put it in code.

Here is part of the code for the money:
CODE

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!");
}
else
{
llWhisper(0,"Sorry that is the wrong amount for this item.");
llGiveMoney(id, amount);
}
}

So, what i think i need to do is:
CODE

money(key id, integer amount)
{
if (amount == (integer)llList2String(prices,display))
{
incSold(display);
llGiveInventory(id, llList2String(items,display));
llGiveMoney(**other avatars key**, (integer)llList2String(prices,display)/2); //what to add
llWhisper(0,"Thank you for your purchase!");
}
else
{
llWhisper(0,"Sorry that is the wrong amount for this item.");
llGiveMoney(id, amount);
}
}

So basically, all i need is how to add the avatars key to run the script, thanx :)
Also, is there a way to be able to put the avatars name instead of the key?
Jade Bard
Registered User
Join date: 7 Jul 2004
Posts: 106
07-20-2004 14:13
First off i'll suggest you might want to use my vending script since it has forward and back buttons.
/15/52/18061/1.html

But simple
Find out the other person key
default
{
state_entry()
{ llSay(0, "My Owner's key is " + (string)llGetOwner()); }
}
}

simple copy the key. Put it into your program.

key friends_key = "xxxx-x-xx" how ever long it is.

Then when you get money
Simply do

money(key giver, integer amount)
{
integer friends_money = (integer)amount/2;

llGiveMoney(friends_key, friends_money);
}


i think that's what your looking for.
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
07-20-2004 14:16
thanx, the vendor that i have does have Next and Previous buttons, i just took a small section of the code out.
Cray Levy
Member
Join date: 7 Jul 2004
Posts: 33
07-21-2004 01:56
Note that your friend will be at a disadvantage with items being sold at odd prices if you always transfer the integer part of the sum divided by two to him.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
07-21-2004 02:37
no no transfer the half linden dollars to me ^_^
_____________________
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
Apotheus Silverman
I write code.
Join date: 17 Nov 2003
Posts: 416
07-21-2004 10:20
Note that the vendor script posted in this thread allows you to specify a single author or as many authors as you want and it will automatically split the money evenly and notify all authors at the time of each sale.
_____________________
Apotheus Silverman
Shop SL on the web - SLExchange.com

Visit Abbotts Aerodrome for gobs of flying fun.