Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need a Vendor Script that supports multiple authors

Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
06-23-2004 17:11
Me and my gf have a small clothing store, and we need an easy way to split the profits at the end of the day, and im looking for a multiple author vending machine. i saw one in the Script Library, but it uses object models to show what its selling, and i need just a picture based vendor. Ive asked around, and i found 2 people that would make one, but they are asking 400-500 for the vendor, and..well. money is a little tight. If anyone could help, that would be greatly appreciated. :)

--------------------------------------
Gattz Gilman, Co-Owner of SG Lair
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
06-23-2004 17:59
Hiya Gattz. I dont think we have a way to know from inside a script who created the objects in the vendor's inventory. You would have to spend a lot of time filling out a notecard that maps the association between the various creators and the various objects for this to work.
The best way to keep your monies separated is to just use a different vendor for each person.
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
06-23-2004 18:02
all the objects in it are jountly made, so its just splittimg the prifit from each object sold.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
06-23-2004 18:09
That's pretty easy to do then. Do you have modify rights on your vendor script?
If not, there's bound to be someone out there with a modifiable vendor.
Siggy Romulus
DILLIGAF
Join date: 22 Sep 2003
Posts: 5,711
06-23-2004 18:17
Theres also one in the script library I think -- a pretty good example of what-to-do and how-it-works.

Siggy.
_____________________
The Second Life forums are living proof as to why it's illegal for people to have sex with farm animals.

From: Jesse Linden
I, for one, am highly un-helped by this thread
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
06-23-2004 18:28
i saw that multi author vendor in the library, but its uses objects instead of pictures to show what its selling. And the other basic vendors only support one price for all the objects in that vendor. And on top of that, im not that good at scripting :/.
Siggy Romulus
DILLIGAF
Join date: 22 Sep 2003
Posts: 5,711
06-23-2004 19:59
I have a free vendor that I could give you a copy of - it doesn't split the profits, but it would be easy to make it do so - and would be a good starter project for you (which would make you a better scripter).

The one in the script library should give you a good idea of how the money is paid, and also how to split it.

IM me in world and I'll drop that vendor to you, and would also be happy to help if you get stuck.

Siggy.
_____________________
The Second Life forums are living proof as to why it's illegal for people to have sex with farm animals.

From: Jesse Linden
I, for one, am highly un-helped by this thread
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
06-23-2004 21:24
Thanx Siggy :D
LeSeul Ferdinand
Don't read this, Too late
Join date: 7 Oct 2004
Posts: 78
04-26-2006 17:29
I was looking for the same very recently, so I hope im not going to annoy anyone by reviving this old thread.

I edited Apotheus' Script to change textures instead of objects, I hope he doesnt mind me posting this.

Put the main vendor script in the main display prim of the vendor and the button scripts into your button prims, then link making sure that the main vendor is linked last.

Main Vendor Script:
CODE
// Multi Author Multi Item Holovendor original script by Apotheus Silverman
// Modified (slightly) by LeSeul Ferdinand to display on a prim instead of rezzing objects

// This is the name of the notecard to read items from
string itemDataNotecard = "Item Data";

// Type of thingy this vendor sells (inventory constant)
integer inventoryType = INVENTORY_OBJECT;

// Keeps track of the currently-displayed item (1-indexed)
integer currentItem = 0;

// Floating text color
vector textColor = <1,1,1>;

// How many seconds between automatic item changes
float changeTimer = 300.0;

// These lists are synchronized to simulate a structure for each item's data
list items = [];
list image = [];
list prices = [];
list authors = [];

// Required to read the notecard properly
integer notecardLine;
key currentDataRequest;


// Reads the data from the notecard. Each line in the notecard should be
// formatted as follows:
// Item Name, Model Name, Price, Authors
// string (no commas), string (no commas), integer, pipe-delimited list of keys
// Example:
// Abbotts Float Plane v1.0.1, Abbotts Float Plane Model, 500, key|key
InitializationStep1() {
llSay(0, "Reading item data...");
notecardLine = 0;
currentDataRequest = llGetNotecardLine(itemDataNotecard, notecardLine);
}

// Requests debit permission
InitializationStep2() {
// Request debit permission
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

// Change currently-displayed item
SetCurrentItem(integer item) {
// determine which item to display
integer itemCount = llGetListLength(items) - 1;
currentItem = item;
if (currentItem == -1) {
currentItem = itemCount;
} else if (currentItem > itemCount) {
currentItem = 0;
}

// Build and set hover text
string hoverText = "Item " + (string)(currentItem + 1) + " of " + (string)(itemCount + 1) + "\n" + llList2String(items, currentItem) + "\n$" + (string)llList2String(prices, currentItem);
llSetText(hoverText, textColor, 1.0);

// Say what item is now being displayed
llSay(0, "Now Showing: " + llList2String(items, currentItem));

// rez the new model
llSetTexture (llList2String(image, currentItem), 1);
}

default {
state_entry() {
llSay(0, "Starting up...");

// Clear text
llSetText("", textColor, 1.0);

// Read notecard, populate lists
InitializationStep1();
}

run_time_permissions(integer perm) {
if (perm & PERMISSION_DEBIT) {
state vend;
} else {
llSay(0, "You must grant debit permission for me to work properly.");
}
}

dataserver(key query, string data) {
if (query == currentDataRequest) {
currentDataRequest = ""; // Prevent a bug that occurs with dataserver events.
if (data != EOF) {
// Read the current item
list currentList = llCSV2List(data);
string myItemName = llList2String(currentList, 0);
string myModelName = llList2String(currentList, 1);
integer myPrice = llList2Integer(currentList, 2);
string myAuthorsAsString = llList2String(currentList, 3);

items += [myItemName];
image += [myModelName];
prices += [myPrice];
authors += [myAuthorsAsString];

notecardLine++;
// Get the next line
currentDataRequest = llGetNotecardLine(itemDataNotecard, notecardLine);
} else {
// Signal that we are done getting items
InitializationStep2();
}
}
}
}




state vend {
state_entry() {
//llSay(0, "items = " + llDumpList2String(items, ","));
//llSay(0, "models = " + llDumpList2String(models, ","));
//llSay(0, "prices = " + llDumpList2String(prices, ","));
//llSay(0, "authors = " + llDumpList2String(authors, ","));

// Rez initial model
SetCurrentItem(currentItem);

// Start the timer for item autorotation
llSetTimerEvent(changeTimer);

llSay(0, "Multiauthor Multivendor online.");
}

timer() {
// Choose a random item to display. Make sure it's not the current item.
integer newItem = currentItem;
if (llGetListLength(items) > 1) {
while (newItem == currentItem) {
newItem = (integer)(llFrand(llGetListLength(items)) + 1.0);
}
SetCurrentItem(newItem);
}
}

touch(integer total) {
llSay(0, "Use the left or right arrows to cycle through the items I am selling, then right-click and \"Pay\" me the displayed amount to purchase an item.");
}

// Someone has given me money
money(key agentkey, integer amount) {
string name = llKey2Name(agentkey);
integer currentPrice = llList2Integer(prices, currentItem);
integer sale;
integer i;

if(amount < currentPrice) {
// Not enough money was given. Cancel sale.
llSay(0, name + " you Paid $" + (string)amount + " - thats not enough money for the current item! Refunding $" + (string)amount + "...");
llGiveMoney(agentkey, amount);
sale = FALSE;
}
else if(amount > currentPrice) {
// Too much money was given. Refund the differnce.
integer change = amount - currentPrice;
llSay(0, name + " you Paid $" + (string)amount + " - your change is $" + (string)change + ".");
llGiveMoney(agentkey, change);
sale = TRUE;
} else {
// The proper amount was given.
sale = TRUE;
}

if (sale) {
// Make sure I have the item in inventory before trying to give it.
integer found = FALSE;
//llSay(0, "searching for " + llList2String(items, currentItem));
for (i = 0; i < llGetInventoryNumber(inventoryType); i++) {
if (llGetInventoryName(inventoryType, i) == llList2String(items, currentItem)) {
found = TRUE;
}
}

if (!found) {
// Display error and refund money
llSay(0, "Erm, I am sorry " + name + ", but it seems that I do not have that item to give to you, so I am refunding the purchase price. Please contact my owner about this issue.");
llGiveMoney(agentkey, currentPrice);
} else {
// Complete the sale
llSay(0, "Thank you for your purchase, " + name + "!");
llGiveInventory(agentkey, llList2String(items, currentItem));

llWhisper(0, "Please wait while I perform accounting activities...");

// Distribute money to the object authors
list myAuthors = llParseString2List(llList2String(authors, currentItem), ["|"], []);

if (llGetListLength(myAuthors) > 0) {
integer shareAmount = (integer)llList2Integer(prices, currentItem) / llGetListLength(myAuthors);
// Eliminate my owner from the authors list
for (i = 0; i < llGetListLength(myAuthors); i++) {
llInstantMessage(llList2Key(myAuthors, i), name + " purchased " + llList2String(items, currentItem) + ". Your share is L$" + (string)shareAmount + ".");
if (llList2Key(myAuthors, i) == llGetOwner()) {
myAuthors = llDeleteSubList(myAuthors, i, i);
}
}
// Pay any remaining authors accordingly
if (shareAmount > 0 && llGetListLength(myAuthors) > 0) {
for (i = 0; i < llGetListLength(myAuthors); i++) {
llGiveMoney(llList2Key(myAuthors, i), shareAmount);
}
}
}
llWhisper(0, "Accounting completed. Thanks again, " + name + "!");
}
}
}

link_message(integer sender, integer num, string message, key id) {
if (message == "next") {
llSetTimerEvent(changeTimer);
SetCurrentItem(currentItem + 1);
} else if (message == "prev") {
llSetTimerEvent(changeTimer);
SetCurrentItem(currentItem - 1);
}
}

on_rez(integer startParam) {
llResetScript();
}
}


Next Button:
CODE
default { 
state_entry() {
}

touch_start(integer total_number) {
llMessageLinked(LINK_ROOT, 0, "next", NULL_KEY);
}
}


Back Button:
CODE
default { 
state_entry() {
}

touch_start(integer total_number) {
llMessageLinked(LINK_ROOT, 0, "prev", NULL_KEY);
}
}


Item Data notecard is the same as Apotheus'

Object Name, Texture Name, Price, Your Key|Shared Avatars Key
Object2 Name, Texture2 Name, Price2, Your Key|Shared Avatars Key
etc.

Happy selling, may this script make you much money!

LeSeul Ferdinand
_____________________
"I think it's time to step up to red alert!"
"Sir that does mean changing the bulb..."

Jacob Lassard
Registered User
Join date: 22 Mar 2006
Posts: 2
Split Proceeds
06-01-2006 13:53
Gattz; - there is a split proceeds script in SLexchange 0L, .. seems to work quite nicely, as well...just another option for you
Draco18s Majestic
Registered User
Join date: 19 Sep 2005
Posts: 2,744
06-01-2006 14:23
Basically, if you have a vendor with scripts you can modify...
CODE

money(key id, integer amount)
{
//do stuff, such as give the item
llGiveMoney(partners_id, amount / 2);
}


If you don't have mod scripts, just create one that has that event inside the default state and add it to the vendor, though there would be problems if the person over-pays. Best to have a mod vendor script (if you go to the FurNation Skymall (FurNation Alpha), floating around somewhere is a "Free Low Lag Vendor" that has mod permissions).
Buzzsaw Barbecue
Registered User
Join date: 28 Apr 2006
Posts: 5
06-09-2006 09:07
From: Gattz Gilman
Ive asked around, and i found 2 people that would make one, but they are asking 400-500 for the vendor, and..well. money is a little tight. If anyone could help, that would be greatly appreciated. :)

L$400-500 = "money is tight"?? That's about $1.50. It's cheaper than a cup of coffee and probably would have saved you time.

BB
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
06-09-2006 14:53
I have several varieties of multi split vendors on slexchange ( search under my name )
All of them are free if memory serves me correctly

If you need it mod let me know in world and I will send you one on the condition you do not resell it as a stand alone script.
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
06-09-2006 15:32
Uhh, the original poster made that request on 06-24-2004... i think in nearly two years it passed since then, they got what they're looking for ^^;;
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
07-11-2006 05:40
From: Joannah Cramer
Uhh, the original poster made that request on 06-24-2004... i think in nearly two years it passed since then, they got what they're looking for ^^;;


ya lol. at this point in my SL i just make my own vendors :)
_____________________
Nathan Babcock
Registered User
Join date: 5 May 2006
Posts: 47
Help with this.
10-26-2006 20:06
How would I modify this script to allow for share percent? I would love to add a string in the notecard data to specify share:

Example: Item Name, Display Name, Price, Agent|Agent, 50/25

Could someone please help me? I use this same exact script, so please show how I can mod this particular one to allow for the addition of that last data field of shares.

I can totally pay some compensation for your help and time.

Nate