I found this script on the internet and it works fine.
However, I have been trying to modify it for days so that it not only clicks and opens the menu, even if a stranger clicks on it, but I want to redesign it so that it also listens to a chat command like -123456 and then opens the menu for the sender even though another is wearing it.
I have now tried several days to adapt the script but I just can't. Does anyone have an IDEA how to rebuild it?
Thank you very much :-)
----------------------------------------------------------------------
//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 = -29250; //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, SCRIPTED , 96.0, PI);
//llSensor("", NULL_KEY, ACTIVE , 24.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);
names = names + llGetSubString(llDetectedName(i), 0, 11);
}
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 =-9911;
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")
{
llSay(0,"test end");
llSleep(1);
llSay(0,"test end");
}
else if (msg == "Myself")
{
llSay(0,"test " + me);
}
else if (msg == name0)
{
string sit1;
llSay(0,name0 + " " + key0);
llOwnerSay("@sit:" + key0 + "=force");
llResetScript();
}
else if (msg == name1)
{
llSay(0,name1 + " " + key1);
llOwnerSay("@sit:" + key1 + "=force");
llResetScript();
}
else if (msg == name2)
{
llSay(0,name2 + " " + key2);
llOwnerSay("@sit:" + key2 + "=force");
llResetScript();
}
else if (msg == name3)
{
llSay(0,name3 + " " + key3);
llOwnerSay("@sit:" + key3 + "=force");
}
else if (msg == name4)
{
llSay(0,name4 + " " + key4);
llOwnerSay("@sit:" + key4 + "=force");
}
else if (msg == name5)
{
llSay(0,name5 + " " + key5);
llOwnerSay("@sit:" + key5 + "=force");
}
else if (msg == name6)
{
llSay(0,name6 + " " + key6);
llOwnerSay("@sit:" + key6 + "=force");
}
else if (msg == name7)
{
llSay(0,name7 + " " + key7);
llOwnerSay("@sit:" + key7 + "=force");
}
else if (msg == name8)
{
llSay(0,name8 + " " + key8);
llOwnerSay("@sit:" + key8 + "=force");
}
else if (msg == name9)
{
llSay(0,name9 + " " + key9);
llOwnerSay("@sit:" + key9 + "=force");
}
else if (msg == name10)
{
llSay(0,name10 + " " + key10);
llOwnerSay("@sit:" + key10 + "=force");
}
else if (msg == name11)
{
llSay(0,name11 + " " + key11);
llOwnerSay("@sit:" + key11 + "=force");
}
else if (msg == name12)
{
llSay(0,name12 + " " + key12);
llOwnerSay("@sit:" + key12 + "=force");
}
else if (msg == name13)
{
llSay(0,name13 + " " + key13);
llOwnerSay("@sit:" + key13 + "=force");
}
else if (msg == name14)
{
llSay(0,name14 + " " + key14);
llOwnerSay("@sit:" + key14 + "=force");
}
else if (msg == name15)
{
llSay(0,name15 + " " + key15);
llOwnerSay("@sit:" + key15 + "=force");
}
}
}