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
Drink Beer Drinking  

Beer Drinking

Drink Script - makes it seem like beer is being drunk

Category: Drink
By : Ferd Frederix
Created: 2015-05-29 Edited: 2015-05-29
Worlds: Second Life

the Zip file

Download all files for Beer Drinking
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Beer Drink Script.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 //: LICENSE: CC-0 (Open Source)
2 //: DESCRIPTION:
3 // 1) Make a cylinder and a glass, lets say, of beer. Texture the cylinder to look like the beer liquid - mostly brown, with white foam at one end, and put white on the top of the cylinder. Put this cylinder inside the beer glass. Or make a tapered cylinder and and fit it into another glass.
4 // 2) Link the glass and any other prims to the beer cylinder. The cylinder need to be the last thing clicked to make it the root prim.
5 // This script currently requires there be AT LEAST 2 prims. Otherwise LINKNUM must be a 0 for a single prim, or the number of the prim that is the beer prim.
6 // 3) Add the script below to the root prim. When reset, the beer should dissappear, and appear to fill back up.
7 // 4) type this in chat:
8 // /942 Drink
9 // The beer will decrease by 10% rthwn empty, it shudl announce with a whsiper that "XX, your glass is empty."
10
11 // globals
12 float drink_left;
13 integer LINKNUM = 1; // Assumes that the cylinder that is being drunk is the root prim.
14 string DECREASE_FOOD = "Drink";
15 float X = 1.0;
16 float Y = 1.0;
17 float Z = 1.0; // the length of the cylinder
18
19 fill()
20 {
21 float i = 0 ;
22
23 //loop around cutting the length to fuill
24 while(i < Z)
25 {
26 llSetLinkPrimitiveParamsFast(LINKNUM,[PRIM_SLICE, <0, i,0>]);
27 llSleep(.1);
28 i += .020 ; // ad 1/10 of a Z each loop
29 }
30 drink_left = 1; // 100%
31 }
32
33 drink()
34 {
35 drink_left = drink_left - 0.1;
36 llSetLinkPrimitiveParamsFast(LINKNUM,[PRIM_SLICE, <0, drink_left,0>]);
37 if(drink_left <= 0)
38 {
39 drink_left = 0;
40 llWhisper(0,llKey2Name(llGetOwner()) + " your glass is empty.");
41 return;
42 }
43 }
44
45 default
46 {
48 {
49 // set to empty, then fill it
50
51 llSetLinkPrimitiveParamsFast(LINKNUM,[PRIM_SLICE, <0, 0,0>]);
52 fill();
53 llListen(942,"","","");
54 }
55
56 listen(integer channel, string name, key id, string message)
57 {
58 if(message == DECREASE_FOOD)
59 {
60 drink();
61 }
62 }
63
64 }

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