Join us in Phaze Demesnes or follow us:

Home   Show All
Category: Contributor: Creator
Texture Texture_switcher_for_many_textures  

Texture_switcher_for_many_textures

Texture switcher with many levels of menus

Category: Texture
By : Ferd Frederix
Created: 2011-10-06 Edited: 2011-10-06
Worlds: Second Life + OpenSim

the Zip file

Download all files for Texture_switcher_for_many_textures
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Texture_switcher_for_many_textures_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 integer i = 0;
2 integer currentPos = 0;
3
4 integer listener;
5 integer MENU_CHANNEL ;
6
7 // opens menu channel and displays dialog
8 Dialog(key id)
9 {
10 list MENU1 = [];
11
12 // count the textures in the prim to see if we need pages
14 if (c <= 12)
15 {
16 for (i = 0; i < c; i++ ) {
18 }
19 }
20 else
21 {
22 for (i = 10 * currentPos; i < (10 + (10 * currentPos)) ; i++) {
23
24 // check to make sure name <= 24, or else the menu will not work.
26 if ( llStringLength(aname) >24)
27 {
28 llOwnerSay("The texture named " + aname + " has too long of a name to be used, please give it a shorter name <= 24 characters ");
29 }
30 else
31 {
32 if (i < c ) {
33 MENU1 += aname;
34 }
35 }
36 }
37 MENU1 += ">>";
38 if (currentPos != 0)
39 MENU1 += "<<";
40 else
41 MENU1 += "-";
42 }
43
44
45 MENU_CHANNEL = (integer) (llFrand(10000) + 10000);
46 listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");
47
48 llDialog(id, "Select one object below: ", MENU1, MENU_CHANNEL);
49 }
50
51 default
52 {
54 {
55 // reset scripts on rez
57 }
58
59 touch_start(integer total_number)
60 {
61 // display the dialog
62 Dialog(llDetectedKey(0));
63 }
64
65 listen(integer channel, string name, key id, string message)
66 {
67 if (channel == MENU_CHANNEL)
68 {
69 llListenRemove(listener);
70 if (message == ">>")
71 {
72 currentPos ++;
73 Dialog(id);
74 }
75 else if (message == "<<")
76 {
77 currentPos--;
78 if (currentPos < 0)
79 currentPos = 0;
80 Dialog(id);
81 }
82 else
83 {
84 // display the texture from menu selection
85 llSetTexture(message, ALL_SIDES);
86
87 }
88 }
89 }
90 }