Jump to content

Problem with length of name and llDialog buttons


You are about to reply to a thread that has been inactive for 4537 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

So I am having trouble with scripts that display the name of people around you in a LLDialog button. My partners name is "NightingaleShadow Littlebird" which is too many characters to put into a button. So I get an error everytime she is around and it crashes the script. Usually I can find ways around it if it is a one time thing like making sure she is the only one around and editing the script so all buttons say "1" or some random word. Then I click on it and it chooses her.

So anyway I was working with a freebie muzzle script and kept getting that error. And my usual trick of changing the buttons label doesn't seem to work. It gives me an "Sorry, but no one is within 32m and in the same sim as you, at least that I can find.". I know there is a way out there to display only the first name of avatars around you or maybe make buttons that say "1", "2", "3" and each number corresponds to a list of avatars 1. Fake NameA 2.Fake NameB 3.Fake NameC.

 

This is the chunk of script in the much larger script I have been working with

Link to comment
Share on other sites

See the demo script I posted in the Scripting Library.  It builds a menu of user options and an associated list of numbered button labels from information on a notecard, but you could build the list of options (in your case, avatar names) in any other way you like.  The list of options is displayed in the dialog text and the button labels are the option numbers.

BTW, you can get an avatar's first name from the login name by looking for the blank space between first and last names, as in ....

integer idx = llSubStringIndex(llDetectedName(0)," ");

string First_Name = llGetSubString(llDetectedName(0),0,idx-1);

Link to comment
Share on other sites

sensor( integer vIntSns ){	gLstNom = [];	gLstKey = [];	if (12 < vIntSns){		vIntSns = 12;	}	do{		gLstNom += llDetectedName( --vIntSns );		gLstKey += llDetectedKey( --vIntSns );	}while (vIntSns);	string vStrMsg;	vIntSns = ([] != gLstKey); //-- same as: -llGetListLength( gLstKey )	do{		vStrMsg = (string)(-vIntSns) + ": " + llList2String( gLstNom, vIntSns ) + "\n" + vStrMsg;	}while (++vIntSns);	//-- your listen code could go here, or you could use a static listen channel	llDialog( llGetOwner(),	          "Choose one of the following names:\n" + vStrMsg,	          llList2List( ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],	                       0,	                       ~([] != glstNom) ), /*//- Same as: (llGetListLength( gLstNom ) - 1)                  channel );	llSetTimerEvent( 120.0 );}

this saves you from a second sensor to get the key, simply use the number returned, and subtract 1 to get an index and use that to pull it out of gLstKey

Link to comment
Share on other sites

If this is for a hud you can also create buttons using prims, and label them with llSetText.   Then there is no limit to length.

The text can be positioned on the button (instead of hovering over it) by rotating the prim, setting Z size as small as possible, and dimpling the prim appropriately.

Link to comment
Share on other sites

  • 7 months later...

I am having the same problem with my dialog scripts telling me the button lengths are too long.  I tried both work arounds suggested here, and the first name work around still tells me the name is too long for the button, and the scripting later posted kept giving me syntax errors that I was unable to fix.  I am not an LSL genuis by any stretch of the imagination, so can someone please give me a bit a of a hint as to what I might be doing wrong?  Thanks in advance.

Link to comment
Share on other sites

I normally do something on these lines (these are just fragments, obviously, but should give you the idea)

 

key chosen;list detected;list buttons;	sensor(integer num ){		detected=[];		while (num--){			key k = llDetectedKey(num);			detected += [llGetSubString(llGetDisplayName(k),0,23)]+[k];		}		detected=llListSort(detected,2,TRUE);		buttons = llList2ListStrided(detected,0,-1,2);		llDialog(owner,"Please choose someone",buttons,dialog_channnel);	}	listen(integer channel, string name, key id, string msg){		if(~llListFindList(buttons,[msg])){			integer n = llListFindList(detected,[msg]);			chosen = llList2Key(detected,(n+1));		}	}

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4537 days.

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
 Share

×
×
  • Create New...