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
Animated GIF MultiGIF_menu  

MultiGIF_menu

Add GIFS from the GIF 2 SL Animated Texture Program (http://www.free-lsl-scripts.com/Secondlife/Posts/gif/Create-Gif-in-Second-Life.htm) and touch the prim to change them

Category: Animated GIF
By : Ferd Frederix
Created: 2012-10-18 Edited: 2012-10-18
Worlds: Second Life

the Zip file

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

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