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
Menu multi_note_card_reading  

multi_note_card_reading

reload key is censored.

Category: Menu
By : heskemo oyen
Created: 2010-10-04 Edited: 2010-10-04
Worlds: Second Life

the Zip file

Download all files for multi_note_card_reading
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. multi_note_card_reading_1.lsl
1 integer reload_key = 000000;
2 integer CALL_DEBUG = 10011111;
3 //===============================================================
4 //
5 // menu buttons
6 //
7 //===============================================================
8 string btn_about = "ABOUT";
9 string btn_load = "LOAD.D";
10 string btn_close_menu = "BACK";
11 string btn_permssion = "PERM";
12 string btn_next = "NEXT";
13 string btn_prev = "PREV";
14 string btn_1 = "[1]";
15 string btn_2 = "[2]";
16 string btn_3 = "[3]";
17 string btn_4 = "[4]";
18 string btn_instruction = "HELP";
19 string btn_off = "OFF";
20 string btn_close = "CLOSE";
21 string btn_group = "GROUP";
22 string btn_owner = "OWNER";
23 string btn_public = "PUBLIC";
24 string btn_debug = "DEBUG";
25 string btn_on ="ON";
26 string btn_texture ="TEXTURE";
27 string btn_sculpt = "SCULPT";
28 string btn_option ="OPTION";
29 //
30 integer MENU_HANDLE;
31 integer MENU_CHANNEL;
32 string calllistener;
33 integer debug=TRUE;
34 integer isMenuSIMPLE=FALSE;
35 integer permissionOptions=0;
36 //
37 integer group;
38 key agent;
39 key objectowner;
40 string requestagentname;
41 string textabout="copyright 2010 HKM Gears. \n more to come! www.hkm.com";
42 string textload ="there are lists of notecards to read";
43 string textmenu="This is the gear menu with the heavy weapons";
44 string textoption="Ooops extra functions options but its not neccessary.";
45 string textdebug="the debug functions is there";
46 string textpermission="this gives the control of this device.";
47 //===============================================================
48 list MAIN_SIMPLE = [btn_about,btn_load];
49 list MAIN_ADVANCE = [
50 btn_about,
51 btn_load,
52 btn_option
53 ];
54 list M_btn_option = [
55 btn_permssion,
56 btn_debug,
57 btn_instruction,
58 btn_close_menu
59 ];
60 list M_btn_permssion = [
61 btn_group,
62 btn_owner,
63 btn_public,
64 btn_close_menu
65 ];
66 list M_starting_menu(){
67 calllistener="";
68 return MAIN_ADVANCE;
69 }
70 list M_switches(){
71 return [M_debug(),btn_close_menu];
72 }//=================================
73 // find the cards
74 //
75 string nextface = ">>>";
76 string prevface = "<<<";
77 integer cardfaces = 0;
78 integer cartsetcount = 0;
79 integer menucards_limit=0;
80 list all_cards=[];
81 integer cardnumbers;
82 detectCards(){
83 all_cards=[];
84 float i;
85 integer j;
87 i = (float) cardnumbers/9;
88 cardfaces=llCeil(i)-1;
89 for (j=0; j<cardnumbers;j++)
90 {
92 }
93 //if(debug)say(llList2CSV(all_cards));
94 }
95 list findcards(){
96 list this=[];
97 integer containingbuttons = 9;
98 integer j;
99 menucards_limit = cardnumbers-cartsetcount*containingbuttons;
100 if(cardnumbers==0){
101 // if(debug)say("there is no notecards detected.");
102 this = [btn_close_menu];
103 return this;
104 }
105 for (j=0; j<containingbuttons;j++)
106 {
107 integer index = j+cartsetcount*containingbuttons;
108 //if(debug)say("index :"+(string)index);
109 //if(debug)say("j:"+(string)j);
110 if(j<menucards_limit){
111 this+=llList2List(all_cards,index,index);
112 }
113 else if(j>=menucards_limit){
114 this+=["--"];
115 }
116 }
117 if(cardfaces>0){
118 this+=[prevface,btn_close_menu,nextface];
119 }else{
120 this+=["--",btn_close_menu,"--"];
121 }
122 //if(debug)say("menucards_limit:"+(string)menucards_limit+"\n \\"+(string)cartsetcount+" / "+(string)cardfaces);
123 //if(debug)say(llList2CSV(this));
124 return this;
125 }
126 //==========================================end
127 string touchstarttitle(){
128 string b;
129 if(isMenuSIMPLE){
130 b= "this is a simple standalone menu";}else{b= "this is the advance heavy geared menu";};
131 return b;
132 }
133 string MENU_TEXT="";
134 ccommand(string cmd){
135 if(debug)llSay(0,"call = "+calllistener);
136 if(calllistener==""){
137 if(cmd==btn_about){
138 MENU_TEXT=textabout;
139 TD([btn_close_menu],"menu_about_");
140 }
141 if(cmd==btn_load){
142 MENU_TEXT=textload;
143 detectCards();
144 TD(findcards(),"menu_reload_");
145 }
146 if(cmd==btn_option){
147 MENU_TEXT=textoption;
148 TD(M_btn_option,"menu_option_");
149 }
150 }
151 if(calllistener=="menu_about_"){
152 if(cmd ==btn_close_menu){
153 MENU_TEXT=textmenu;
154 TD(M_starting_menu(),"");
155 }
156 }
157 if(calllistener=="menu_reload_"){
158 if(cmd ==btn_close_menu){
159 MENU_TEXT=textmenu;
160 TD(M_starting_menu(),"");
161 }else if(cmd==nextface){
162 cartsetcount++;
163 if(cartsetcount>cardfaces){
164 cartsetcount=0;
165 }TD(findcards(),"menu_reload_");
166 }else if(cmd==prevface){
167 cartsetcount--;
168 if(cartsetcount<0){
169 cartsetcount=cardfaces;
170 }
171 TD(findcards(),"menu_reload_");
172 }else if(cmd =="--"){
173 TD(M_starting_menu(),"");
174 }
175 if(cmd !="--"
176 && cmd!=btn_close_menu
177 && cmd!=btn_load
178 && cmd!=nextface
179 && cmd!=prevface){
180 llMessageLinked(LINK_ROOT, reload_key, cmd, NULL_KEY);
181 //checking_other_users();
182 }
183 }
184 if(calllistener=="menu_option_"){
185 if(cmd==btn_permssion){
186 MENU_TEXT=textpermission;
187 TD(M_btn_permssion,"menu_option_permission");
188 }
189 if(cmd==btn_close_menu){
190 MENU_TEXT=textmenu;
191 TD(M_starting_menu(),"");
192 }
193 if(cmd==btn_instruction){
194 TD(M_starting_menu(),"");
195 }
196 if(cmd==btn_debug){
197 MENU_TEXT=textdebug;
198 TD(M_switches(),"menu_option_debug");
199 }
200 }
201 if(calllistener=="menu_option_debug"){
202 if(cmd==btn_close_menu){
203 MENU_TEXT=textoption;
204 TD(M_btn_option,"menu_option_");
205 }
206 if(cmd=="d FALSE"){
207 debug=TRUE;
208 llMessageLinked(LINK_SET, CALL_DEBUG, "TRUE","");
209 TD(M_switches(),"menu_option_debug");
210 }
211 if(cmd=="d TRUE"){
212 debug=FALSE;
213 llSay(0,"debug => false");
214 llMessageLinked(LINK_SET, CALL_DEBUG, "","");
215 TD(M_switches(),"menu_option_debug");
216 };
217 }
218 if(calllistener=="menu_option_permission"){
219 if(cmd==btn_group){TD(M_btn_permssion,"menu_option_permission");permissionOptions=1;
220 llSay(0,"set to GROUP only");}
221 if(cmd==btn_owner){TD(M_btn_permssion,"menu_option_permission");permissionOptions=0;
222 llSay(0,"set to OWNER only");}
223 if(cmd==btn_public){TD(M_btn_permssion,"menu_option_permission");permissionOptions=2;
224 llSay(0,"set to PUBLIC only");}
225 if(cmd==btn_close_menu){
226 MENU_TEXT=textoption;
227 TD(M_btn_option,"menu_option_");
228 }
229 }
230 }
231 integer uuidBaseChannel(){
232 integer chNumber;
233 string s = (string)llGetKey();
234 chNumber = (integer)("0x"+llGetSubString(s, 0, 7)) +(integer)("0x"+llGetSubString(s, 9, 12) + llGetSubString(s, 14, 17)) + (integer)("0x"+llGetSubString(s, 19, 22) + llGetSubString(s, 24, 27)) + (integer)("0x"+llGetSubString(s, 28, 35));
235 if(chNumber > 0){chNumber = -chNumber;
236 }else if(chNumber == 0){
237 chNumber = -1;
238 }
239 return chNumber;
240 }
241 string M_debug(){
242 string bbde_bug;
243 if(!debug){
244 bbde_bug="d FALSE";
245 }else{
246 bbde_bug="d TRUE";
247 }
248 return bbde_bug;
249 }
250 TD(list menu, string call){
251 llListenRemove(MENU_HANDLE);
252 MENU_CHANNEL = uuidBaseChannel();
253 calllistener=call;
254 if(debug)llSay(0,(string)MENU_CHANNEL);
255 MENU_HANDLE = llListen(MENU_CHANNEL,"","","");
256 if(debug)llSay(0,"at this "+(string)agent+" CHANNEL: "+(string)MENU_CHANNEL+" change call: "+calllistener);
257 llDialog(agent, MENU_TEXT, menu, MENU_CHANNEL);
258 }
259
260 integer getPermUser(){
261 group = llDetectedGroup(0); // Is the Agent in the objowners group?
262 //agent = llDetectedKey(0); // Agent's key
263 objectowner = llGetOwner(); // objowners key
264 requestagentname = llKey2Name(agent);
265 llSay(0,requestagentname+" has the menu");
266 integer A= FALSE;
267 integer B= FALSE;
268 integer C= FALSE;
269 if(permissionOptions==0){// 0 for owner only
270 A =(objectowner == agent);
271 }
272 if(permissionOptions==1){// 1 for group only
273 B=group;
274 }
275 if(permissionOptions==2){// 2 for the public
276 C = TRUE;
277 }
278 return A||B||C;
279 }
280 open_a_lisntener(){
281 MENU_CHANNEL = llFloor(llFrand(-99999.0 - -100));
282 MENU_HANDLE = llListen(MENU_CHANNEL,"","","");
283 }
284 startmenu(){
285 if(getPermUser()){
286 //iListenTimeout = llGetUnixTime() + llFloor(fListenTime);
287 open_a_lisntener();
288 llDialog(agent, touchstarttitle(), M_starting_menu(), MENU_CHANNEL);
289 }else{
290 llSay(0,requestagentname+" is not allow to use the menu. sorry.");
291 }
292 }
293 default{
294 on_rez(integer rez)
295 {
296 // llResetScript();
297 }
298 link_message(integer sender_num, integer num, string msg, key idk) {
299 if(msg =="MENU"){
300 if(debug)llSay(0, "conversation starts to :"+(string)idk);
301 agent = idk;
302 startmenu();
303 }
304 }
305 listen(integer channel, string name, key id, string message){
306 ccommand(message);
307 }
308 }

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