-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTV.lsl
73 lines (61 loc) · 1.91 KB
/
TV.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* TV Media Player
* Script to play remote media 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 transparent primitive used to cover the screen
*/
string video_url = "http://www.domain.com/video.mov";
string text = "TV Media Player";
integer playing;
integer lkey;
default
{
touch_start(integer num)
{
if (llDetectedKey(0) == llGetOwner())
{
lkey = llListen(8192, "", llGetOwner(), "");
llSetTimerEvent(60);
string action;
if (playing) {
action = "Turn Off";
}
else
{
action = "Turn On";
}
llDialog(llDetectedKey(0), text, [action], 8192);
}
}
listen (integer channel, string name, key id, string msg)
{
llListenRemove(lkey);
if (msg == "Turn On")
{
llSetLinkPrimitiveParams(LINK_ROOT, [ PRIM_FULLBRIGHT, ALL_SIDES, TRUE ]);
llSetPrimitiveParams([ PRIM_POINT_LIGHT, TRUE, <1.0, 1.0, 1.0>, 1.0, 2.0, 2.0 ]);
llSetLinkAlpha(LINK_ROOT, 100.0, ALL_SIDES);
llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_URL, video_url]);
playing = TRUE;
}
if (msg == "Turn Off")
{
llSetLinkPrimitiveParams(LINK_ROOT, [ PRIM_FULLBRIGHT, ALL_SIDES, FALSE ]);
llSetLinkAlpha(LINK_ROOT, 0.0, ALL_SIDES);
llSetPrimitiveParams([ PRIM_POINT_LIGHT, FALSE, <0.0, 1.0, 0.0>, 1.0, 2.0, 2.0 ]);
llSleep(1.0);
llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_UNLOAD, PARCEL_MEDIA_COMMAND_URL, ""]);
playing = FALSE;
}
}
timer()
{
llListenRemove(lkey);
llSetTimerEvent(0);
}
}