Shymus Roffo Posted July 9, 2013 Share Posted July 9, 2013 I'm trying to make a thing that interfaces with my database and to display names from it with floating text. I already know how to do the database part, i'm just having trouble with the list selector and menu for the hud.How it works:There is a list of names in the script. When the forward arrow is pressed, advanced down the list and set the current name selected to red and the rest to white. Same for the previous arrow.This is what i have... Yes i know it sucks.//The names to display, comes from an MySQL Database list names = ["John Smith","Shymus Roffo","Some Person","Cool Kid","Second Life","Linden Lab"]; list links4txt = [5,4,3,2]; //The link numbers of the displays for the flaoting text //Simple function to set the link text llSetLinkText(integer ln, string t, vector c) {// LinkNumber,Text,Color llSetLinkPrimitiveParamsFast(ln,[PRIM_TEXT,t,c,1]); } ffUpdateDisplay(integer pos,integer active) { integer i; for(i=0;i<4;i++) { if(i == pos) llSetLinkText(llList2Integer(links4txt,i),llList2String(names,active),<1,0.5,0.5>); else llSetLinkText(llList2Integer(links4txt,i),llList2String(names,active),<1,1,1>); } } default { touch_start(integer n) { if(llDetectedKey(0) == llGetOwner()) { integer i; for(i=0;i<n;i++) { string name = llGetLinkName(llDetectedLinkNumber(i)); integer position_in_list = 0; integer j = 0; if(name == "forward") { if(j <= llGetListLength(links4txt)) j = 0; else j++; ffUpdateDisplay(j,j); } else if(name =="backward") { if(j > llGetListLength(links4txt)) j = 0; else j--; ffUpdateDisplay(j,j); } llOwnerSay("Pos:"+(string)j); } } } } All things i've tried have not been working. It is starting to get rather annoying... >.< Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 9, 2013 Share Posted July 9, 2013 Take a look at http://community.secondlife.com/t5/LSL-Library/Float-Box-Contents/td-p/753805 for comparison. Link to comment Share on other sites More sharing options...
Shymus Roffo Posted July 9, 2013 Author Share Posted July 9, 2013 That's not really close to what i'm looking for but here might be a good example as an image, it does not work though. The image I'm trying to make it so names come in from a database then go into a list ( which i can do ) then make it so that names display on the hud ( which is not made yet ), then when an arrow is pressed the list would advance then the current list option would be red and the rest would be white. Then if the green prim is pressed it would echo out the name or current active list choice. It's knid of hard to describe, so sorry if it is not good enough. Link to comment Share on other sites More sharing options...
Xiija Posted July 10, 2013 Share Posted July 10, 2013 this is closer...but not quite there... it works forward, but not backwards arg list names = ["John Smith","Shymus Roffo","Some Person","Cool Kid","Second Life","Linden Lab"]; list links4txt = [5,4,3,2]; llSetLinkText(integer ln, string t, vector c) { // LinkNumber,Text,Color llSetLinkPrimitiveParamsFast(ln,[PRIM_TEXT,t,c,1]); } ffUpdateDisplay(integer pos,integer active) { end = index + 3; display = llList2List(names, index, end); //llOwnerSay(llDumpList2String(display, ",")); llOwnerSay(llList2String(names,pos)); // llOwnerSay(" j is" + (string)pos); integer i; for(i=0; i< prims; i++) { if(pos > 3 ){pos = 3;} // if(pos < 2 ){pos = 2;} if(i == pos) { llSetLinkText(llList2Integer(links4txt,i),llList2String(display,i),<1,0.5,0.5>); echo = llList2String(display,i); } else llSetLinkText(llList2Integer(links4txt,i),llList2String(display,i),<1,1,1>); } llSetText("Index: " + (string)index + "\n Position: "+(string)pos,<1,1,1>,1); } integer len; integer index; integer end ; integer prims ; integer j; list display; string echo; default { state_entry() { end = index + 3; len = llGetListLength(names); prims = llGetListLength(links4txt); display = llList2List(names, index, end); // llOwnerSay("namelist len " + (string)len); } touch_start(integer n) { if(llDetectedKey(0) == llGetOwner()) { string name = llGetLinkName(llDetectedLinkNumber(0)); if(name == "forward") { j++; if(j == len ) { j = 0;index = 0;} if(j > end ) { ++index;} ffUpdateDisplay(j,j); } else if(name =="backward") { j--; if(j < 0) { j = 5; index = 2;} if(j < index ) { --index;} ffUpdateDisplay(j,j); } else if(name =="Some Object") { llSay(0,"echoing : " + echo); } } } } Link to comment Share on other sites More sharing options...
Shymus Roffo Posted July 11, 2013 Author Share Posted July 11, 2013 That works a bit better, but it doesn't want to work when i try to go back through the list. Although i'm sure you already know that. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now