Jump to content

Sensor Dialog


ModelAgentur
 Share

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

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

Recommended Posts

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

Link to comment
Share on other sites

23 minutes ago, ModelAgentur said:

I have made about 30 changes that have NOT brought success. It also makes no sense to have all 30 attempts here. 🙂

 

post the last attempt then

i could point you to the LSL wiki: llListen but am assuming that you have already looked at that

edit add:

see below

Edited by Mollymews
Link to comment
Share on other sites

3 minutes ago, Mollymews said:

post the last attempt then

i could point you to the LSL wiki: llListen but am assuming that you have already looked at that

More than once and also all other information that can be found on the Internet. Before I ask a question, I really tried everything to find a solution

Link to comment
Share on other sites

@ModelAgenturWhat's the script trying to do exactly?

It looks as if it's trying to use RLV for force sit people on something, but if it is,  that's not how to do it.

@sit:<UUID>=force will force the object's owner to sit on the object identified by <UUID>,  assuming they  have RLV activated in their viewer, that there's nothing preventing them from sitting (other RLV restrictions particularly) and that the object has a sit target set.     

So if I properly understand the script logic, someone touches the object, it scans for scripted objects within 96 metres (it will only return the first 16) and the toucher then tries to seat the object's owner on one of them, regardless of whether that's possible.   Is that your intention?

If you want to force third parties to sit on things, then you need to use the RLV Relay api, first to check they're wearing an RLV relay that's accepting commands and then to ask it to force sit them for you.

Or you could trying using Experience Tools and llSitOnLink.

Either way, quite apart from the dialog part and the listener, that needs a bit of attention, too.  

And you might also want to consider using something like DialogPlus  or Rolig Loon's example Dialog Choices from numbered buttons (which is what I would use for something like this, so I don't have to worry about truncating names) to build the dialog rather than the somewhat archaic method used in the model you found to work from.

You might also want to consider using strided lists and indexing rather than huge long lists of else if clauses.

 

Edited by Innula Zenovka
  • Haha 1
Link to comment
Share on other sites

16 minutes ago, ModelAgentur said:

The script is as it is good for my needs. I just can't modify the script, that it listens to -1234567 for example and then the sender of -1234567 opens the menu as if I were to click on it

 

In state entry, you have 

llListen(gChann, "", NULL_KEY, "");

Earlier, you have defined gChann thus:

integer gChann = -29250; //make your OWN unique channel to be sure your not on someone else's.

So if you want it to listen to a channel other than -29250,  you might consider changing the number you assign to gChann.

I'm not quite sure, though, what you want to happen when someone touches it -- at the moment it looks as if anyone can touch it (because you've set integer gOwnerOnly = FALSE;). When they touch it, it assigns their uuid as the value of tReq, and gives them the menu. 

What's supposed to happen, and what is actually happening?

Edited by Innula Zenovka
Link to comment
Share on other sites

even if I take the channel -29250 and set an IF command like:

if (msg = "menu")
    • llDialog(id, "Targets in Range: n n" + msg, ["END","Myself"] + buttons, gChann);


        • It does not work it does not open a menu that outputs all the surrounding objects. only if you click and that is not possible if someone wears the script in a HUD 😞

Link to comment
Share on other sites

7 minutes ago, ModelAgentur said:

even if I take the channel -29250 and set an IF command like:

if (msg = "menu")
    • llDialog(id, "Targets in Range: n n" + msg, ["END","Myself"] + buttons, gChann);


        • It does not work it does not open a menu that outputs all the surrounding objects. only if you click and that is not possible if someone wears the script in a HUD 😞

 

I'm sorry, but I don't understand what you want to happen.   Why are you wearing it as HUD if you want other people to be able to click it?    

If you mean you want to wear it and for someone else to be able to send a message to it that bring up the menu for them, look at the script logic -- it fires the sensor when you touch the object, and presents a menu, based on what the sensor has detected, to the toucher.

So if you want someone else to be able bring up a menu they can see, while you're wearing the HUD, then you have to make the sensor fire when it hears a trigger message, not when it's touched.     

So think of a trigger message you want them to be able to use, and then fire the sensor when the HUD hears that, not when it's touched (or as well as when it's touched if you want the  wearer to be able to use it too).

Link to comment
Share on other sites

2 hours ago, Amy Morane said:

that is exactly what the person setting up the post communicates. That he cannot change it the way he wishes and needs help

a difficulty is that the way the posted script is designed, is not very efficient

it can be hacked about to add the addition OP wants, but I think most scripters who can do this would not want to proffer such a hack to an already inefficient script

i suggest ModelAgentur should post in Wanted to obtain another script that would be far more efficient, or to obtain the services of a scripter to help them achieve their goal

 

 

Link to comment
Share on other sites

@Mollmews I think you are forgetting we all learned to script this way , better not force anyone without RLA enabled in their viewer or nothing will happen most scripts like this rely on  

RLA but not many use it . You might be better with a http://wiki.secondlife.com/wiki/LlPushObject as it doesn't require RLA I have some success limited pushing in a circle but never finished it as got involved with other things xD

Link to comment
Share on other sites

1 hour ago, VirtualKitten said:

@Mollmews I think you are forgetting we all learned to script this way , better not force anyone without RLA enabled in their viewer or nothing will happen most scripts like this rely on

my comment wasn't aimed at RLVA. It was directed at the atrociousness of the code in the listen event. The OP should not want to learn from this kind of scripting. And nobody with any reasonable level of scripting experience is going to want to proffer a way to hack around this level of scripting. So the suggestion, find another script or failing that find a scripter to write the OP a less atrocious script to learn/begin  with

 

Edited by Mollymews
clarify
  • Like 2
Link to comment
Share on other sites

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