Xpl0ad3r Neox Posted December 22, 2013 Share Posted December 22, 2013 Hello there,I'm sorry, though I'm almost sure this has been answered a few times for some reason, I can't seem to find anything that could really help me.The max length of a button label is 24 bytes, is there any workaround for this? Looking at the wiki I noticed this part:[quote]llBase64ToString(llGetSubString(llStringToBase64(theString), 0, 31))[/quote]I'm not sure if has anything to do with it anyway... Any help? Thank you in advance! Link to comment Share on other sites More sharing options...
steph Arnott Posted December 22, 2013 Share Posted December 22, 2013 no. That snippet just hacks off the end off so the word fits the button. Link to comment Share on other sites More sharing options...
Xiija Posted December 22, 2013 Share Posted December 22, 2013 about the only thing you can do is trim any longer items to fit the 24 character limit.... button = llGetSubString(button, 0, 23) ; Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 22, 2013 Share Posted December 22, 2013 Not only are you limited to 24 characters, but only about 12 of them will actually show on the button. One good way around the problem is not to use long button labels. Use a numbered list and then use the numbers as button labels. Link to comment Share on other sites More sharing options...
Xpl0ad3r Neox Posted December 22, 2013 Author Share Posted December 22, 2013 @Rolig Loon Thank you. I actually was looking forward for that idea, I was just looking for a way around, but that will save me some time. The thing is, I'm developing a Delivery Script which automatically finds out the contents inside the prim and lists them up on the buttons of the menu... So the buttons are automatically set to the content name, however, sometimes there are contents, like a notecard or texture that have a longer name, in these cases, it reproduces the following script error: "button labels must be 24 or fewer characters long". Well, I'll use this method if there isn't anything else I could try. Link to comment Share on other sites More sharing options...
Nova Convair Posted December 22, 2013 Share Posted December 22, 2013 You have a list of your long entries. Make a 2nd list, by cutting all entries down to 12 characters or some more. Shorter entries you fill up to a length of 12 with spaces. Add the listindex to each entry, it will be out of sight. When you get the menu answer you cut the part after the 12th character to the end and you will get back the listindex. With the listindex you can easily get the long entry out of your 1st list. Just cutting the long entries can result in 2 or more equal shortened entries. Another question is: does it make sense to show only the 1st 12 characters or your long entries? If not - use a numbered list as Rolig suggested. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted December 22, 2013 Share Posted December 22, 2013 The only other way to do it is something like this, though I would, in general, prefer Rolig's method since it makes it easier to distinguish between items. integer handle;list contents;list buttonNames;default{ state_entry() { integer i; integer max = llGetInventoryNumber(INVENTORY_ALL); do { string str = llGetInventoryName(INVENTORY_ALL,i); if (llGetInventoryType(str)!=llGetScriptName()){//don't include this script contents += [str]; // add full name to contents list buttonNames+=[llGetSubString(str,0,23)];//add truncated name to buttonNames list } } while (++i<max); } touch_start(integer total_number) { key k = llDetectedKey(0); llListenRemove(handle); handle = llListen(99,"",k,""); llDialog(k,"Please choose something",buttonNames,99);//use the list of truncated names } listen(integer channel, string name, key id, string message) { llListenRemove(handle); integer n = llListFindList(buttonNames,[message]); // find the index number in the buttonNames list if (~n){//if it's not -1 string obj = llList2String(contents,n); // find the untruncated name in the contents list llRegionSayTo(id,0,"You chose "+obj); } }} Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now