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
GIF GIF Player  

GIF Player

GIF to Sl

Category: GIF
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
Worlds: Second Life

the Zip file

Download all files for GIF Player
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Automatic_GIF_to_SL_script player.lsl
Get file # 2. Automatic_GIF_to_SL_script player.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2
3 // Put any texture converted by gif_2_SL_animation_v0.6.exe into a prim with this script to get it to play back automatically as a movie
4
5 integer SIDE = ALL_SIDES; // change to 1,2,3 for just one side
6
7 //Effect parameters: (can be put in list together, to make animation have all of said effects)
8 //LOOP - loops the animation
9 //SMOOTH - plays animation smoothly
10 //REVERSE - plays animation in reverse
11 //PING_PONG - plays animation in one direction, then cycles in the opposite direction
12 list effects = [LOOP]; // LOOP for GIF89 movies
13 //Movement parameters (choose one):
14 //ROTATE - Rotates the texture
15 //SCALE - Scales the texture
16 //Set movement to 0 to slide animation in the X direction, without any special movement.
17 integer movement = 0;
18 integer face = ALL_SIDES; //Number representing the side to activate the animation on.
19 integer sideX = 1; //Represents how many horizontal images (frames) are contained in your texture.
20 integer sideY = 1; //Same as sideX, except represents vertical images (frames).
21 float start = 0.0; //Frame to start animation on. (0 to start at the first frame of the texture)
22 float length = 0.0; //Number of frames to animate, set to 0 to animate all frames.
23 float speed = 10.0; //Frames per second to play.
24
25
26 // menu stuff
27 integer listen_id; // int of the current listener
28 integer menuChannel; // int of the channel number
29
30 // from the menu system http://wiki.secondlife.com/wiki/SimpleDialogMenuSystem
31 integer N_DIALOG_CHOICES;
32 integer MAX_DIALOG_CHOICES_PER_PG = 8; // if not offering back button, increase this to 9
33 string PREV_PG_DIALOG_PREFIX = "< Page ";
34 string NEXT_PG_DIALOG_PREFIX = "> Page ";
35 string DIALOG_DONE_BTN = "Done";
36 string DIALOG_BACK_BTN = "<< Back";
37
38 integer pageNum;
39 list DIALOG_CHOICES;
40
41 giveDialog(key ID, integer pageNum) {
42
43 list buttons;
44 integer firstChoice;
45 integer lastChoice;
46 integer prevPage;
47 integer nextPage;
48 string OnePage;
49
50 CancelListen();
51
52 menuChannel = llCeil(llFrand(1000000) + 11000000);
53 listen_id = llListen(menuChannel,"","","");
54
56
57
58 N_DIALOG_CHOICES = llGetListLength(DIALOG_CHOICES);
59
60
61 if(N_DIALOG_CHOICES <= 10) {
62 buttons = DIALOG_CHOICES;
63 OnePage = "Yes";
64 }
65 else {
66 integer nPages = (N_DIALOG_CHOICES+MAX_DIALOG_CHOICES_PER_PG-1)/MAX_DIALOG_CHOICES_PER_PG;
67
68
69 if(pageNum < 1 || pageNum > nPages) {
70 pageNum = 1;
71 }
72 firstChoice = (pageNum-1)*MAX_DIALOG_CHOICES_PER_PG;
73
74 lastChoice = firstChoice+MAX_DIALOG_CHOICES_PER_PG-1;
75
76
77 if(lastChoice >= N_DIALOG_CHOICES) {
78 lastChoice = N_DIALOG_CHOICES;
79 }
80 if(pageNum <= 1) {
81 prevPage = nPages;
82 nextPage = 2;
83 }
84 else if(pageNum >= nPages) {
85 prevPage = nPages-1;
86 nextPage = 1;
87 }
88 else {
89 prevPage = pageNum-1;
90 nextPage = pageNum+1;
91 }
92 buttons = llList2List(DIALOG_CHOICES, firstChoice, lastChoice);
93 }
94
95
96 // FYI, this puts the navigation button row first, so it is always at the bottom of the dialog
97 list buttons01 = llList2List(buttons, 0, 2);
98 list buttons02 = llList2List(buttons, 3, 5);
99 list buttons03 = llList2List(buttons, 6, 8);
100 list buttons04;
101 if(OnePage == "Yes") {
102 buttons04 = llList2List(buttons, 9, 11);
103 }
104 buttons = buttons04 + buttons03 + buttons02 + buttons01;
105
106 if(OnePage == "Yes") {
107 buttons = [ DIALOG_DONE_BTN, DIALOG_BACK_BTN ]+ buttons;
108 //omit DIALOG_BACK_BTN in line above if not offering
109
110 }
111 else {
112 buttons = [
113 PREV_PG_DIALOG_PREFIX + (string)prevPage,
114 DIALOG_BACK_BTN, NEXT_PG_DIALOG_PREFIX+(string)nextPage, DIALOG_DONE_BTN
115 ]+buttons;
116 //omit DIALOG_BACK_BTN in line above if not offering
117 }
118 llDialog(ID, "Page "+(string)pageNum+"\nChoose one:", buttons, menuChannel);
119 }
120
121
122 CancelListen() {
123 llListenRemove(listen_id);
124 }
125
126
127
128
129 initAnim() //Call this when you want to change something in the texture animation.
130 {
131 integer effectBits;
132 integer i;
133 for(i = 0; i < llGetListLength(effects); i++)
134 {
135 effectBits = (effectBits | llList2Integer(effects,i));
136 }
137 integer params = (effectBits|movement);
138 llSetTextureAnim(ANIM_ON|params,face,sideX,sideY, start,length,speed);
139 }
140
141 fetch(string texture)
142 {
143
144 integer i;
146 for (i = 0; i < j; i ++)
147 {
149 list data = llParseString2List(myTexture,[";"],[]);
150 string name = llList2String(data,0);
151 if(name == texture) {
152 string X = llList2String(data,1);
153 string Y = llList2String(data,2);
154 string Z = llList2String(data,3);
155
156 sideX = (integer) X;
157 sideY = (integer) Y;
158 speed = (float) Z;
159 //llOwnerSay("Name=" + myTexture + " X=" + X + " Y=" + Y + " Z = " + (string) Z);
160
161 if(speed) {
162 llSetTexture(myTexture,SIDE);
163 initAnim();
164 }
165 }
166 }
167 }
168
169 // Make a list of all bare names for the dialog
170 list fetchAll()
171 {
172 list choices = [];
173 integer i;
175 for (i = 0; i < j; i ++)
176 {
178 list data = llParseString2List(texture,[";"],[]);
179 choices += llList2String(data,0);
180 }
181 return choices;
182 }
183
184
185 default
186 {
188 {
189 }
190
192 {
194 {
195 pageNum = 1;
196 DIALOG_CHOICES = fetchAll();
197 giveDialog(llGetOwner(), pageNum);
198 }
199 }
200
201 listen(integer channel, string name, key id, string message)
202 {
203 integer where ;
204 if( message == DIALOG_DONE_BTN)
205 {
206 CancelListen();
207 return;
208 }
209 else if(message == DIALOG_BACK_BTN)
210 {
211 pageNum = 1;
212 DIALOG_CHOICES = fetchAll();
213 giveDialog(llGetOwner(), pageNum);
214 }
215 else if(llSubStringIndex(message, PREV_PG_DIALOG_PREFIX) == 0)
216 {
217 pageNum = (integer)llGetSubString(message, llStringLength(PREV_PG_DIALOG_PREFIX), -1);
218 giveDialog(llGetOwner(), pageNum);
219 }
220 else if(llSubStringIndex(message, NEXT_PG_DIALOG_PREFIX) == 0)
221 {
222 pageNum = (integer)llGetSubString(message, llStringLength(NEXT_PG_DIALOG_PREFIX), -1);
223 giveDialog(llGetOwner(), pageNum);
224
225 } else { //this is the section where you do stuff
226
227 where = llListFindList(fetchAll(),[message]);
228 if(where >= 0)
229 {
230 fetch(message);
231 giveDialog(llGetOwner(), pageNum);
232 }
233
234 // add more buttons here
235 }
236 }
237 }

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