-
Notifications
You must be signed in to change notification settings - Fork 0
/
Blinds.lsl
40 lines (33 loc) · 997 Bytes
/
Blinds.lsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Horizontal Blinds
* Script to simulate window blinds in LSL and Open Simulator platforms
*
* Copyright 2011-2015, Marc S. Brooks (https://mbrooks.info)
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Usage:
* Add this to a primitive containing an image that resembles blinds
* Add a corresponding sound clip to inventory named 'blinds_toggle'
*/
integer steps = 10;
float reversed = TRUE;
float min = 0.1;
float volume = 1.0;
vector offset = <0,0,1>;
default
{
state_entry()
{
offset *= ((1.0 - min) / steps) * (offset * llGetScale());
reversed -= 0.5;
}
touch_start(integer detected)
{
integer i;
do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset, PRIM_POSITION, llGetLocalPos() + ((reversed * offset) * llGetLocalRot())]);
while ((++i) < steps);
offset =- offset;
llTriggerSound("blinds_toggle", volume);
}
}