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
Parachute ParachuteHUD  

ParachuteHUD

ParachuteHUD

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

the Zip file

Download all files for ParachuteHUD
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. ParachuteHUD_1.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 CHANNEL = 155;
16
17 displayChute(float alpha)
18 {
19 llSetLinkPrimitiveParams(2,[PRIM_COLOR, ALL_SIDES,<1,1,1>, alpha ]);
20 llSetLinkPrimitiveParams(3,[PRIM_COLOR, ALL_SIDES,<1,1,1>, alpha ]);
21 llSetLinkPrimitiveParams(4,[PRIM_COLOR, ALL_SIDES,<1,1,1>, alpha ]);
22 llSetLinkPrimitiveParams(5,[PRIM_COLOR, ALL_SIDES,<1,1,1>, alpha ]);
23 llSetLinkPrimitiveParams(6,[PRIM_COLOR, ALL_SIDES,<1,1,1>, alpha ]);
24 }
25
26 integer calculateGroundDistance()
27 {
28 vector pos = llGetPos();
29 float ground = llGround(pos);
30 float distance = llRound(pos.z-ground);
31 return (integer)distance;
32 }
33
34 displayGroundDistance()
35 {
36 llSetText("Distance to Ground: " + (string)calculateGroundDistance(),<0,1,0>,1);
37 }
38
39
40 default
41 {
42 attach(key id)
43 {
44 if(id)
45 {
46 state attached;
47 }
48 }
49 }
50
51
52 state attached
53 {
55 {
56 displayChute(0);
59 llPreloadSound( "parachute" );
60 llListen( CHANNEL, "", NULL_KEY, "" );
61
62 }
63
64 attach(key id)
65 {
66 if(id==NULL_KEY)
67 {
68 state default;
69 }
70 }
71
72 listen(integer channel, string name, key id, string message)
73 {
74 llSay(0,message);
75 if( message=="open" )
76 state deployed;
77 }
78
79 timer()
80 {
81 displayGroundDistance();
82 }
83 }
84
85 state falling
86 {
88 {
90 llListen( CHANNEL, "", NULL_KEY, "" );
91 }
92
93
94
95 timer()
96 {
97 integer dist = calculateGroundDistance();
98 displayGroundDistance();
99 }
100
101 attach(key id)
102 {
103 if(id==NULL_KEY)
104 {
105 state default;
106 }
107 }
108 }
109
110 state deployed
111 {
113 {
114 llTriggerSound("parachute",1);
115 displayChute(1);
116 llSetTimerEvent(0.1);
117 llStopAnimation("falldown");
118 llStartAnimation("hover");
119 llListen( CHANNEL, "", NULL_KEY, "" );
120 }
121
122 listen(integer channel, string name, key id, string message)
123 {
124 if( message=="close" )
125 state attached;
126 }
127
128 timer()
129 {
130 vector v = llGetVel();
131 if( v.z < -7 )
132 {
134 }
135
136 displayGroundDistance();
137 }
138
139
140
141 attach(key id)
142 {
143 if(id==NULL_KEY)
144 {
145 llStopAnimation("hover");
146 state default;
147 }
148 }
149 }

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