Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Vendor Vendor  

Vendor

Vendor

Category: Vendor
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Vendor
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Vendor_1.lsl
Get file # 2. Vendor_2.lsl
1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // ISBN: 160439000
6 X// Copyright 2007 by Heaton Research, Inc.
7 //
8 // This script may be freely copied and modified so long as this header
9 // remains unmodified.
10 //
11 // For more information about this book visit the following web site:
12 //
13 // http://www.heatonresearch.com/articles/series/22/
14
15 integer index;
16
17 // for loading notecard
18 string notecardName;
19 key notecardQuery;
20 integer notecardIndex;
21 list notecardList;
22 integer price;
23 string itemName;
24
25 displayItem()
26 {
27 string textureName = llList2String(notecardList,index*3);
28 itemName = llList2String(notecardList,(index*3)+1);
29 string p = llList2String(notecardList,(index*3)+2);
30 price = (integer)p;
31 string display = itemName + "\nL$" + p;
32 llMessageLinked(LINK_ALL_OTHERS , 0, ":"+display, NULL_KEY);
33 llSetLinkPrimitiveParams(5,[PRIM_TEXTURE, 1, textureName, <1,1,1>, <0,0,0>, 0 ]);
35 }
36
37 default
38 {
40 {
41 if( llGetListLength(notecardList)==0 )
42 {
43 notecardName = "Config";
44 state loading;
45 }
46 else
47 {
48 index = 0;
49 displayItem();
50 }
51 }
52
53 link_message(integer sender_num, integer num, string str, key id)
54 {
55 if( str=="back" )
56 {
57 index--;
58 }
59
60 if( str=="forward" )
61 {
62 index++;
63 }
64
65
66 if(index>=(llGetListLength(notecardList)/3) )
67 index = 0;
68
69 if(index<0 )
70 {
71 index = (llGetListLength(notecardList)/3);
72 index--;
73 }
74
75 displayItem();
76 }
77
78 money(key id, integer amount)
79 {
80 if( amount>=price )
81 {
82 llGiveInventory(id,itemName);
83 llSay(0,"Thanks for your purchase!");
84 }
85 }
86
87 }
88
89 state loading
90 {
92 {
93 llSay(0,"Loading product data...");
94 notecardIndex = 0;
95 notecardQuery = llGetNotecardLine(notecardName,notecardIndex++);
96 }
97
98 dataserver(key query_id, string data)
99 {
100 if( notecardQuery == query_id)
101 {
102 // this is a line of our notecard
103 if(data == EOF)
104 {
105 llSay(0,"Products loaded...");
106 state default;
107
108 } else
109 {
110 notecardList += [data];
111 notecardQuery = llGetNotecardLine(notecardName,notecardIndex++);
112 }
113 }
114 }
115 }

Vendor

Vendor Notecard

Category: Vendor
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 buyredcar
2 Encog's Red Car
3 25
4 buyyellowcar
5 Super Car
6 30
7 buyboat
8 Encog's Boat
9 35

Back to the Best Free Tools in Second Life and OpenSim.