Join us in Phaze Demesnes

LSL Script Library Home   Add a script Show All
Category: Contributor: Description
Animation Franics Sunbathing Script.lsl
Sunbathing Script.lsl
Sunbathing Script.lsl

Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.

1 // CATEGORY:Animation
2 // DESCRIPTION:Sunbathing Script.lsl
3 // ARCHIVED BY:Ferd Frederix
4
5 // Francis wuz here
6 integer broadcast = 20;
7
8 // A More Neutral Sleeping Position
9 //vector target = <-1.06585, 0.71774, 0.18293>;
10 //rotation targetRot = <0.50028, -0.49972, -0.50028, 0.49972>;
11
12 // A More relaxed sleeping position
13 //vector target = <-1.15419, 0.56328, -0.25744>;
14 //rotation targetRot = <0.52105, -0.49829, -0.46875, 0.51038>;
15 vector target = <0,0,0.1>;
16 rotation targetRot = <0,0,0,1>;
17
18 integer debugRotation = FALSE;
19 key sitAgent = NULL_KEY;
20 integer gotPermission = FALSE;
21
22 integer time = 0;
23 default
24 {
26 {
27 llSetSitText( "Sunbathe" );
28 llSitTarget( target, targetRot );
29 if ( debugRotation ) {
30 llListen( 1977, "Rotation Broadcaster", NULL_KEY, "" );
31 llListen( 1978, "Rotation Broadcaster", NULL_KEY, "" );
32 }
33 }
34 listen(integer channel, string name, key id, string message ) {
35 if ( channel == 1977 )
36 targetRot = (rotation) message;
37 else
38 target = (vector) message;
39
40 llSitTarget( target, targetRot );
41 if ( time == 0 )
42 llSay(0, (string) targetRot + ", " + (string)target );
43 time = (time +1) % 50;
44 }
45 changed(integer change) {
46 if (change & CHANGED_LINK)
47 {
49 if ( sitAgent == NULL_KEY && agent != NULL_KEY ) {
50 // Someone new sitting down
51 sitAgent = agent;
53 }
54 else if ( sitAgent != NULL_KEY && agent == NULL_KEY) {
55 // sitting down person got up - wake up :)
56 if ( gotPermission ) {
57 llStopAnimation("hover");
58 llStopAnimation("sit_to_stand");
59 }
60 // Reset the script because we don't have a way of releasing permissions :)
62 }
63 }
64 }
67 gotPermission = TRUE;
68 llStopAnimation("sit");
69 llStartAnimation("hover");
70 llStartAnimation("sit_to_stand");
71 }
72 }
73
74 }
75 // END //