Jump to content

llDialog: button labels must be 24 or fewer characters long


gsgraaf
 Share

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

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

Recommended Posts

I have a full perm tracking script, that I would like to use to have a spotlight follow a specific avatar. I only run into the issue that I get the script error message " llDialog: button labels must be 24 or fewer characters long" when a specific avatar with a long name is around. 

here below the script. I tried to find a workaround on this forum, but I'm totally not familiar with scripting, and I have no clue where to changfe things so the LLDialog button would shorten the name. So I'm hoping anyone can offer me the solution for it.

//Formatted Sensor Dialog script by Evil Fool
//Modified by blazed Undercity
//Now its got a use, i modified to allow owner to do stuff to the ppl that are in the sensor's range
integer followTarget        = TRUE;
float   endAlpha   =1.0;
float   startAlpha          = 1.0;
integer effectFlags=0;
integer gOwnerOnly = FALSE;
integer gChann = 952; //make your OWN unique channel to be sure your not on someone else's.
integer gStride = 9;
list names;
list keys;
integer gPos = 0;
key tReq;
key texture = "3c8ec327-0bc2-a823-891f-b5650e51936e";


dialog(key id) 
{
    integer nTop = gPos + gStride - 1;
    list buttons = llList2List(names, gPos, nTop);
    string msg = llDumpList2String(buttons, "\n");
    while(llGetListLength(buttons) % 3 != 0)
    { buttons = llListInsertList(buttons , [" "], gStride);
    }
    if (gPos >= gStride)
    { buttons += ["PREVIOUS"];
    }
    if (nTop - 1 < llGetListLength(names))
    { buttons += ["NEXT"];
    }
    llDialog(id, "Targets in Range: \n \n" + msg, ["END","Myself"] + buttons, gChann);
}

default
{
    state_entry()
    {
        llListen(gChann, "", NULL_KEY, "");
    }
    
    touch_start(integer num_times)
    {  if ( ( gOwnerOnly == TRUE && llDetectedKey(0) == llGetOwner() ) || gOwnerOnly == FALSE)
        {tReq = llDetectedKey(0);
         llSensor("", NULL_KEY, AGENT, 96.0, PI);
           
        }
    }
    no_sensor()
    {key id = llGetOwner();
        llDialog(id,"To Follow a target, you and the bot must be within 96 meters of your desired target.", ["Myself","NoThanks"], gChann);
    }
    
    sensor(integer num_detected)
    { 
        names = [];
        gPos = 0;
        integer i;

       
        for (i = 0; i < num_detected; i++)
        {
            names = names + llDetectedName(i);
        }
        
        keys = [];
        integer k;

       
        for (k = 0; k < num_detected; k++)
        {
            keys = keys + llDetectedKey(k);
        }
        
        dialog(tReq);

     
    }
    
    
    ///This script handles 16 keys & names associated with the dialog buttons. Feel free to add more.
        
    
    
    
    listen(integer channel, string name, key id, string msg) 
    {  
         string key0 = llList2String(keys, 0);
         string key1 = llList2String(keys, 1);
         string key2 = llList2String(keys, 2);
         string key3 = llList2String(keys, 3);
         string key4 = llList2String(keys, 4);
         string key5 = llList2String(keys, 5);
         string key6 = llList2String(keys, 6);
         string key7 = llList2String(keys, 7);
         string key8 = llList2String(keys, 8);
         string key9 = llList2String(keys, 9);
         string key10 = llList2String(keys, 10);
         string key11 = llList2String(keys, 11);
         string key12 = llList2String(keys, 12);
         string key13 = llList2String(keys, 13);
         string key14 = llList2String(keys, 14);
         string key15 = llList2String(keys, 15);
         string key16 = llList2String(keys, 16);

         string name0 = llList2String(names, 0);
         string name1 = llList2String(names, 1);
         string name2 = llList2String(names, 2);
         string name3 = llList2String(names, 3);
         string name4 = llList2String(names, 4);
         string name5 = llList2String(names, 5);
         string name6 = llList2String(names, 6);
         string name7 = llList2String(names, 7);
         string name8 = llList2String(names, 8);
         string name9 = llList2String(names, 9);
         string name10 = llList2String(names, 10);
         string name11 = llList2String(names, 11);
         string name12 = llList2String(names, 12);
         string name13 = llList2String(names, 13);
         string name14 = llList2String(names, 14);
         string name15 = llList2String(names, 15);
         string name16 = llList2String(names, 16);
        string me = id;
         integer b_channel =1052;
        
        if (msg == "NEXT")
        {   gPos = gPos + gStride;
            dialog(id);
        }else if (msg == "PREVIOUS")
        {   gPos = gPos - gStride;
            dialog(id);
        }else if (msg == " ")
        {}
        
        
        
        //If you wanna do stuff to the Avatars Detected, you must do the same for all the 'else if' statements below
        
        else if (msg == "END")
        { 
        llRegionSay(b_channel,"testend"); 
        llRegionSay(b_channel,"testend");
        llRegionSay(b_channel,"testend");
        llSleep(1);
        llRegionSay(b_channel,"testend");
        

        }
          else if (msg == "Myself")
        { 
        llRegionSay(b_channel,"test" + me); 
        

        }
     
        
        else if (msg == name0)
        { 
        llRegionSay(b_channel,"test" + key0); 
        

        }
        else if (msg == name1)
        {
       llRegionSay(b_channel,"test" + key1); 
        }
        else if (msg == name2)
        {
        llRegionSay(b_channel,"test" + key2);
        }
        else if (msg == name3)
        {
        llRegionSay(b_channel,"test" + key3);
        }
        else if (msg == name4)
        {
        llRegionSay(b_channel,"test" + key4);
        }
        else if (msg == name5)
        {
        llRegionSay(b_channel,"test" + key5);
        }
        else if (msg == name6)
        {
        llRegionSay(b_channel,"test" + key6);
        }
        else if (msg == name7)
        {
        llRegionSay(b_channel,"test" + key7);
        }
        else if (msg == name8)
        {
        llRegionSay(b_channel,"test" + key8);
        }
        else if (msg == name9)
        {
        llRegionSay(b_channel,"test" + key9);
        }
        else if (msg == name10)
        {
        llRegionSay(b_channel,"test" + key10);
        }
        else if (msg == name11)
        {
        llRegionSay(b_channel,"test" + key11);
        }
        else if (msg == name12)
        {
        llRegionSay(b_channel,"test" + key12);
        }
        else if (msg == name13)
        {
        llRegionSay(b_channel,"test" + key13);
        }
        else if (msg == name14)
        {
        llRegionSay(b_channel,"test" + key14);
        }
        else if (msg == name15)
        {
        llRegionSay(b_channel,"test" + key15);
        }
        
            
        
        
    }

 

Link to comment
Share on other sites

There are several solutions to your immediate problem, including simply truncating the names so they are all fewer than 24 characters long.  Actually, the practical limit is really 12, not 24, because a label longer than 12 characters won't fit on a button anyway, even if the system accepts it. The best solution -- said with no modesty -- is this one:

Once you get past that small issue, though, you should start to learn about how to handle lists and loops so that you don't need to have those repetitive lines of

string X = llList2String(Y, 0);

Your whole script can be shortened by about 90%.  Take a look at http://wiki.secondlife.com/wiki/List and http://wiki.secondlife.com/wiki/Category:LSL_Flow_Control.

Link to comment
Share on other sites

it's not my own script, and I'm totally not familiar with scripting. I would be very thankful if anyone could show me where to change or adapt this script so I don't get that error anymore 🙂

Edited by gsgraaf
Link to comment
Share on other sites

 

11 minutes ago, gsgraaf said:

it's not my own script, and I'm totally not familiar with scripting. I would be very thankful if anyone could show me where to change or adapt this script so I don't get that error anymore 🙂

55 minutes ago, gsgraaf said:

        for (i = 0; i < num_detected; i++)

        {
            names = names + llDetectedName(i);
        } 

 

 

 

the simple fix for the button problem is:

names = names + llGetSubString(llDetectedName(i), 0, 11);

http://wiki.secondlife.com/wiki/LlGetSubString

Edited by Mollymews
typeo
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1451 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...