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
TV Media_Controller  

Media_Controller

Media Controller.lsl

Category: TV
By : Bel Linden
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Media_Controller
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Media_Controller_1.lsl
1
2 // Media Controller 1.0
3 // by ben linden
4 //
5 //
6 // This makes it very easy to start a streaming movie on your parcel. It is meant to be easy to use. You can make a much more simple script with similar funtionality - what I am trying to do here is make rez-to-watch in as few mouseclicks as possible. For more instructions on using this script, please click the question mark.
7
8
9
10
11 key default_texture = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
12 string default_media_url = "http://secondlife.com/community/video/trailer_contest_2005/JavierPuff.mov";
13
14 key texture;
15 string media_url;
16
17 integer screen_chan = 8904312;
18 integer command;
19 integer pause;
20
21 media_check()
22 {
23
25 key start_texture = llList2Key(mediacheck, 0);
26 string start_media_url = llList2String(mediacheck, 1);
27
28 if(start_texture)
29 {
30 //if there is a texture already there, use that
31 texture = start_texture;
32
33 }
34 else
35 {
36 // no texture, set one!
38 texture = default_texture;
39 }
40
41 if(start_media_url)
42 {
43 //if there is a texture already there, use that
44 media_url = start_media_url;
45
46 }
47 else
48 {
49 // no texture, set one!
51 media_url = default_media_url;
52 }
53
54
55
56 }
57
58 screen_check_start()
59 {
60 llSensor("Movie Screen", "", SCRIPTED, 30.0, PI);
61 }
62
63 screen_check_result(integer number)
64 {
65
66 //Look for screens
67 integer i;
68 integer screens_found = 0;
69 for(i=0; i<number; i++)
70 {
72 {
73 //Are screens owned by me?
74 screens_found++;
75 }
76 }
77
78 if(screens_found < 1)
79 {
80 //if no screens, Rez a screen
81 vector pos = llGetPos();
82 rotation rot = llGetRot();
83
84 pos.z += 1.0;
85 llRezObject("Movie Screen", pos, ZERO_VECTOR, rot, 0);
86 }
87
88 llSay(screen_chan, (string)texture);
89 llParcelMediaCommandList([command]);
90
91
92 }
93
94
95 // Example media stuff
96 default
97 {
98 link_message(integer sender, integer num, string message, key id)
99 {
100
101 if(message == "pause")
102 {
103 llMessageLinked(LINK_SET, 0, "paused", "");
104 llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_PAUSE" title="View Definition" class="tooltip">PARCEL_MEDIA_COMMAND_PAUSE]);
105 pause = TRUE;
106
107 }
108
109
110 if(message == "play")
111 {
112 if(pause)
113 {
114 llMessageLinked(LINK_SET, 0, "unpaused", "");
116 pause = FALSE;
117
118 }
119 else
120 {
121 llMessageLinked(LINK_SET, 0, "playing", "");
123 media_check();
124 screen_check_start();
125 }
126
127 }
128
129 if(message == "loop")
130 {
131 if(pause)
132 {
133 llMessageLinked(LINK_SET, 0, "unpaused", "");
134 llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_LOOP]);
135 pause = FALSE;
136
137 }
138 else
139 {
140 llMessageLinked(LINK_SET, 0, "playing", "");
141 llMessageLinked(LINK_SET, 0, "looping", "");
142 command = PARCEL_MEDIA_COMMAND_LOOP;
143 media_check();
144 screen_check_start();
145 }
146 }
147
148
149
150
151 if(message == "stop")
152 {
153 pause = FALSE;
154 llMessageLinked(LINK_SET, 0, "unpaused", "");
155 llMessageLinked(LINK_SET, 0, "stopped", "");
156
158 }
159
160
161
162
163 }
164
165 sensor(integer detected)
166 {
167 screen_check_result(detected);
168 }
169
170 no_sensor()
171 {
172 screen_check_result(0);
173 }
174
175 on_rez(integer param)
176 {
177 pause = FALSE;
178 llMessageLinked(LINK_SET, 0, "unpaused", "");
179 llMessageLinked(LINK_SET, 0, "stopped", "");
181 }
182 }
183
184 // END //

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