Difference between revisions of "User talk:Nyeomi Resident"
Line 1: | Line 1: | ||
JSON Multi-Page Dialog Menu | |||
<lsl> | <lsl> | ||
string dialog; | string dialog; |
Revision as of 18:22, 10 November 2013
JSON Multi-Page Dialog Menu <lsl> string dialog; list RETURN; integer chan; integer handle; key detectedKey; float time = 60.0; float timeOut = 0.0; list dialogButtons_subMenu; list dialogButtons_mainMenu;
string a = "A"; list A = ["A10","A11","A12","A7","A8","A9","A4","A5","A6","A1","A2","A3"];
string b = "B"; list B = ["B10","B11","B12","B7","B8","B9","B4","B5","B6","B1","B2","B3"];
string c = "C"; list C = ["C10","C11","C12","C7","C8","C9","C4","C5","C6","C1","C2","C3"];
string d = "D"; list D = ["D10","D11","D12","D7","D8","D9","D4","D5","D6","D1","D2","D3"];
string e = "E"; list E = ["E10","E11","E12","E7","E8","E9","E4","E5","E6","E1","E2","E3"];
string f = "F"; list F = ["F10","F11","F12","F7","F8","F9","F4","F5","F6","F1","F2","F3"];
string g = "G"; list G = ["G10","G11","G12","G7","G8","G9","G4","G5","G6","G1","G2","G3"];
string h = "H"; list H = ["H10","H11","H12","H7","H8","H9","H4","H5","H6","H1","H2","H3"];
string i = "I"; list I = ["I10","I11","I12","I7","I8","I9","I4","I5","I6","I1","I2","I3"];
string j = "J"; list J = ["J10","J11","J12","J7","J8","J9","J4","J5","J6","J1","J2","J3"];
string k = "K"; list K = ["K10","K11","K12","K7","K8","K9","K4","K5","K6","K1","K2","K3"];
string l = "L"; list L = ["L10","L11","L12","L7","L8","L9","L4","L5","L6","L1","L2","L3"];
JSON() {
dialog = llList2Json( JSON_OBJECT,[ j,llList2Json(JSON_ARRAY,J),k,llList2Json(JSON_ARRAY,K),l,llList2Json(JSON_ARRAY,L), g,llList2Json(JSON_ARRAY,G),h,llList2Json(JSON_ARRAY,H),i,llList2Json(JSON_ARRAY,I), d,llList2Json(JSON_ARRAY,D),e,llList2Json(JSON_ARRAY,E),f,llList2Json(JSON_ARRAY,F), a,llList2Json(JSON_ARRAY,A),b,llList2Json(JSON_ARRAY,B),c,llList2Json(JSON_ARRAY,C)]); RETURN = llJson2List(dialog); dialogButtons_mainMenu = llList2ListStrided(RETURN,0,-1,2);
} reset() {
llSetTimerEvent(timeOut); llListenControl(handle,FALSE); llRegionSayTo(detectedKey,PUBLIC_CHANNEL,"DIALOG HAS TIMED OUT");
} resetNset() {
llSetTimerEvent(timeOut); llListenControl(handle,FALSE); llSleep(0.022222); llSetTimerEvent(time); chan = (integer)llFrand(-142857.142857); handle = llListen(chan,"",detectedKey,""); llListenControl(handle,TRUE);
} default {
state_entry() { JSON(); llSetMemoryLimit(16384); llSetTimerEvent(timeOut); } touch_end(integer num) { detectedKey = llDetectedKey(0); resetNset(); llDialog(detectedKey, " ",dialogButtons_mainMenu,chan); } listen(integer channel, string name, key id, string message) { integer mainIndex = llListFindList(dialogButtons_mainMenu,[message]); integer subIndex = llListFindList(dialogButtons_subMenu,[message]); if(~mainIndex) { dialogButtons_subMenu = llParseString2List(llJsonGetValue(dialog,[message]),[",","[","]","\""],[]); llDialog(detectedKey, " ",dialogButtons_subMenu,chan); } if (mainIndex != -1) { llRegionSayTo(detectedKey, PUBLIC_CHANNEL,"Button Label: " + llList2String(dialogButtons_mainMenu,mainIndex) + "\nButton Index: " + (string)mainIndex); } if (~subIndex) { llRegionSayTo(detectedKey, PUBLIC_CHANNEL,"Button Label: " + llList2String(dialogButtons_subMenu,subIndex) + "\nButton Index: " + (string)subIndex); reset(); } } timer() { reset(); }
}