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);
}
}
}