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 Sleep_Script  

Sleep_Script

Sleep Script.lsl

Category: Animation
By : Francis
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Sleep_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Sleep_Script_1.lsl
1
2 // Francis wuz here
3 integer broadcast = 20;
4
5 // A More Neutral Sleeping Position
6 //vector target = <-1.06585, 0.71774, 0.18293>;
7 //rotation targetRot = <0.50028, -0.49972, -0.50028, 0.49972>;
8
9 // A More relaxed sleeping position
10 vector target = <-1.15419, 0.56328, -0.25744>;
11 rotation targetRot = <0.52105, -0.49829, -0.46875, 0.51038>;
12
13 integer debugRotation = FALSE;
14 key sitAgent = NULL_KEY;
15 integer gotPermission = FALSE;
16
17 integer time = 0;
18 default
19 {
21 {
22 llSetSitText( "Sleep" );
23 llSitTarget( target, targetRot );
24 if( debugRotation ) {
25 llListen( 1977, "Rotation Broadcaster", NULL_KEY, "" );
26 llListen( 1978, "Rotation Broadcaster", NULL_KEY, "" );
27 }
28 }
29 listen(integer channel, string name, key id, string message ) {
30 if( channel == 1977 )
31 targetRot = (rotation) message;
32 else
33 target = (vector) message;
34
35 llSitTarget( target, targetRot );
36 if( time == 0 )
37 llSay(0, (string) targetRot + ", " + (string)target );
38 time = (time +1) % 50;
39 }
40 changed(integer change) {
41 if(change & CHANGED_LINK)
42 {
43 key agent = llAvatarOnSitTarget();
44 if( sitAgent == NULL_KEY && agent != NULL_KEY ) {
45 // Someone new sitting down
46 sitAgent = agent;
48 }
49 else if( sitAgent != NULL_KEY && agent == NULL_KEY) {
50 // sitting down person got up - wake up :)
51 if( gotPermission )
52 llStopAnimation("sleep");
53 // Reset the script because we don't have a way of releasing permissions :)
55 }
56 }
57 }
60 gotPermission = TRUE;
61 llStartAnimation("sleep");
62 }
63 }
64
65 }
66 // END //

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