1 //Multi Vendor by Adelle Fitzgerald
2 //Based on the Ama Omega Vendor Script v0.3.1 06/2004
5 //Licenced under Creative Commons Attribution-Share Alike 3.0 Unported - http://creativecommons.org/licenses/by-sa/3.0/
10 // * to Share — to copy, distribute and transmit the work
11 // * to Remix — to adapt the work
13 //Under the following conditions:
15 // * Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
17 // * Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.
19 //With the understanding that:
21 // * Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
22 // * Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
23 // * Other Rights — In no way are any of the following rights affected by the license:
24 // o Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
25 // o The author's moral rights;
26 // o Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
27 // * Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
31 //The Commons Deed is not a license. It is simply a handy reference for understanding the Legal Code (the full license) — it is a human-readable expression of some of its key terms. Think of it as the user-friendly interface to the Legal Code beneath. This Deed itself has no legal value, and its contents do not appear in the actual license.
33 //Creative Commons is not a law firm and does not provide legal services. Distributing of, displaying of, or linking to this Commons Deed does not create an attorney-client relationship.
38 string name = "Vendor ";
58 sold = llListInsertList(llDeleteSubList(sold,i,i),[(integer)(llList2Integer(sold,i) + 1)],i);
63 //llSay(0,(string)gChannel + " : " + (string)gUser); //say gChannel
65 llDialog(gUser, "Settings:", ["Cancel", "Report", "Get Item", "Reset"], gChannel);
70 llListenControl(handle, FALSE);
77 if (display >= llGetListLength(items)) display = 0;
78 llSetText("Item: " + (string)(display + 1) + " of " + (string)totItems + "\n" + llList2String(items,display) + "\n" + llList2String(desc,display),<1,1,1>,1);
79 llMessageLinked(LINK_SET,1,"PIC",llGetInventoryKey((key)llList2String(pics,display)));
80 llMessageLinked(LINK_SET,1,"LOADNEXT",llGetInventoryKey((key)llList2String(pics,display + 1)));
81 llMessageLinked(LINK_SET,1,"LOADPREV",llGetInventoryKey((key)llList2String(pics,display - 1)));
87 if (display < 0) display = llGetListLength(items) - 1;
88 llSetText("Item: " + (string)(display + 1) + " of " + (string)totItems + "\n" + llList2String(items,display) + "\n" + llList2String(desc,display),<1,1,1>,1);
89 llMessageLinked(LINK_SET,1,"PIC",llGetInventoryKey((key)llList2String(pics,display)));
90 llMessageLinked(LINK_SET,1,"LOADNEXT",llGetInventoryKey((key)llList2String(pics,display + 1)));
91 llMessageLinked(LINK_SET,1,"LOADPREV",llGetInventoryKey((key)llList2String(pics,display - 1)));
97 if (display < 0) display = llGetListLength(items) - 1;
98 llSetText("Item: " + (string)(display + 1) + " of " + (string)totItems + "\n" + llList2String(items,display) + "\n" + llList2String(desc,display),<1,1,1>,1);
99 llMessageLinked(LINK_SET,1,"PIC",llGetInventoryKey((key)llList2String(pics,display)));
100 llMessageLinked(LINK_SET,1,"LOADNEXT",llGetInventoryKey((key)llList2String(pics,display + 1)));
101 llMessageLinked(LINK_SET,1,"LOADPREV",llGetInventoryKey((key)llList2String(pics,display - 1)));
106 state_entry() { if (llSubStringIndex(llGetObjectName(), "huffotronic") < 0) state real_default; }
107 on_rez(integer parm) { state rerun; }
109 state rerun { state_entry() { state default; } }
123 gChannel = (integer)llFrand(2147423647) + 10000;
124 handle = llListen(gChannel, "", llGetOwner(), "");
125 llListenControl(handle, FALSE);
129 on_rez(integer param)
134 listen(integer chan, string name, key id, string mes)
136 if (id != llGetOwner()) {
137 llWhisper(0, "Sorry, this vendor is restricted for use by its owner.");
145 else if (mes == "Report")
148 for(i=0;i<llGetListLength(sold);i++)
150 if (llList2Integer(sold,i) != 0) llWhisper(0,"* Sold " + (string)llList2Integer(sold,i) + " " + llList2String(items,i));
154 else if (mes == "Get Item")
156 llGiveInventory(gUser, llList2String(items,display));
157 llWhisper(0,"Thank you, please enjoy your " + llList2String(items,display));
160 else if (mes == "Cancel")
166 touch_start(integer num_detected)
168 button = llGetLinkName(llDetectedLinkNumber(0));
169 gUser = llDetectedKey(0);
171 if (button == "Next")
175 else if (button == "Prev")
179 else if (button == "Info")
181 llGiveInventory(gUser, llList2String(info,display));
185 if (gUser != llGetOwner()) {
186 llWhisper(0, "Sorry, this vendor is restricted for use by its owner.");
189 if (gUser == llGetOwner())
191 llListenControl(handle, TRUE);
197 llGiveInventory(gUser, llList2String(items,display));
198 llWhisper(0,"Thank you, please enjoy your " + llList2String(items,display));
205 llInstantMessage(gUser,"Menu timed out");
213 llSay(0,"Initializing...");
215 k = llGetNotecardLine("VendorConfig",line++);
221 dataserver(key q, string data)
227 k = llGetNotecardLine("VendorConfig",line++);
230 temp = llCSV2List(data);
231 if (llParseString2List(data,[" "],[]) == []);
232 else if (data == EOF)
235 totItems = llGetListLength(items);
236 llMessageLinked(LINK_SET,1,"PIC",llGetInventoryKey(llList2String(pics,0)));
237 llWhisper(0," * Vendor setup complete : " + (string)totItems + " items loaded.");
240 else if (llGetListLength(temp) != 4)
242 llWhisper(0,"Error, improperly formatted line #" + (string)(line - 1));
247 items += llList2String(temp,0);
248 pics += llList2String(temp,1);
249 desc += llList2String(temp,2);
250 info += llList2String(temp,3);
251 sold += [(integer)0];
252 if ( llGetInventoryKey((key)llList2String(temp,0)) == NULL_KEY || llGetInventoryKey((key)llList2String(temp,1)) == NULL_KEY)
254 llWhisper(0,"Error, missing inventory or picture from line : " + data);
257 k = llGetNotecardLine("VendorConfig",line++);