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
Animation Vendor A_animation_Vendor  

A_animation_Vendor

ANimation Vendor

Category: Animation Vendor
By : Ariane Brodie
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for A_animation_Vendor
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. A_animation_Vendor_1.lsl
1 // TWO-BUTTON ANIMATION VENDOR
2 // Origional script by Thili Playfair
3 // Heavily Modified by Karandas Banjo
4 // Radically modified by Ariane Brodie who converted the texture vendor into an animation vendor script
5 // Please include these names if you modify or
6 // re-distribute this code ^_^
7
8 // To set up your vendor, you will need at least 3 prims,
9 // the main prim, and two buttons.
10
11 // The two buttons must both be linked to the main prim,
12 // one must be called "next", the other called "prev".
13 // The Buttons do NOT need any script if you name them as shown above.
14
15 // Next, enter the price of the animations in this vendor,
16 // and if you want, time to wait for auto-scrolling.
17
18 // After that, just drop your animations into the main prim,
19 // and press one of the scroll buttons, and you're ready
20 // to go!
21
22 integer price = 10; // The price of any animation in this
23 // vendor.
24 // Added touch-giving for when price is set to L$0
25
26
27 float time = 0; // Enter a value if you want time based
28 // scrolling otherwise set to zero.
29
30 // NO TOUCHY BELOW HERE
31
32 string vendorname;
33 integer total;
34 integer counter;
35 integer change;
36 integer anim_on = FALSE;
37 string curranim;
38 string lastanim;
39 vector offset=<0,0,1.0>;
40 key avatar;
41
42 next()
43 {
45 vendorname = llGetObjectName();
46 counter++;
47 if(counter>=total)
48 {
49 counter=0;
50 }
51 lastanim = curranim;
52 curranim = llGetInventoryName(INVENTORY_ANIMATION, counter);
53 if(price > 0)
54 {
55 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_ANIMATION, counter) + "\nPay base L$" + (string)price + " to buy", <1,1,1>, 1);
56 }
57 else
58 {
59 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_ANIMATION, counter) + "\n Touch to recieve", <1,1,1>, 1);
60 }
61
62 if(anim_on) {
63 llStopAnimation(lastanim);
64 llStartAnimation(curranim);
65 }
66 }
67 prev()
68 {
70 vendorname = llGetObjectName();
71 if(counter > 0)
72 {
73 counter--;
74 }
75 else
76 {
77 counter=total - 1;
78 }
79 lastanim = curranim;
80 curranim = llGetInventoryName(INVENTORY_ANIMATION, counter);
81 if(price > 0)
82 {
83 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_ANIMATION, counter) + "\nPay base L$" + (string)price + " to buy", <1,1,1>, 1);
84 }
85 else
86 {
87 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_ANIMATION, counter) + "\n Touch to recieve \n", <1,1,1>, 1);
88 }
89
90 if(anim_on) {
91 llStopAnimation(lastanim);
92 llStartAnimation(curranim);
93 }
94 }
95
96 default
97 {
99 {
100 rotation rot = llEuler2Rot(<0,0,PI>);
101 llSetSitText("Animate");
102 llSitTarget(offset,rot);
103 llSetCameraAtOffset(<0.0,0.0,1.0>);
104 llSetCameraEyeOffset(<-4.0,0.0,1.0>);
106 next();
107 llSetTimerEvent(time);
108 }
109
110 touch_start(integer total_number)
111 {
113 {
114 next();
115 }
117 {
118 prev();
119 }
120 else
121 {
122 if(price > 0)
123 {
124 llWhisper(0, "Right click and Animate to try, Pay L$" + (string)price + " to buy");
125 }
126 else
127 {
129 }
130 }
131 }
132
133 timer()
134 {
135 next();
136 }
137
138 money(key giver, integer amount)
139 {
140 if(amount < price)
141 {
142 llSay(0, "Too little payed, refunding");
143 llGiveMoney(giver, amount);
144 }
145 else if(amount > price)
146 {
147 change = amount - price;
148 llSay(0, "Overpaid. vending item and giving L$" + (string)change + " change");
149 llGiveMoney(giver, change);
151 llInstantMessage(llGetOwner(), llKey2Name(giver) + " bought " + llGetInventoryName(INVENTORY_ANIMATION, counter) + " for L$" + (string)price);
152 }
153 else if(amount == price)
154 {
156 llInstantMessage(llGetOwner(), llKey2Name(giver) + " bought " + llGetInventoryName(INVENTORY_ANIMATION, counter) + " for L$" + (string)price);
157 }
158 }
159
160 on_rez(integer start_param)
161 {
163 }
164
165 changed(integer change)
166 {
167 if(change == CHANGED_LINK)
168 {
169 avatar = llAvatarOnSitTarget();
170 if(avatar != NULL_KEY)
171 {
173 }
174 else
175 {
177 llStopAnimation(curranim);
178 anim_on = FALSE;
179 }
180 }
181 }
182 }
183
185 {
187 {
188 llStopAnimation("sit");
189 llStartAnimation(curranim);
190 anim_on = TRUE;
191 }
192 }
193 }

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