Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Soo Many Questions

KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 18:37
ok, im sorry im throwing so many posts up here but im very eager to learn and have many questions.anyway someone helped me with a scan command,wich he showed me sensor and i was able to put the rest of the infrormation together to get it to work.now my other question is how do i implemment the lldetect command in my script.if anyone could help that would be appreciated.thanks
CODE

string MENU_PROMPT = "What do you need help with?";
list MENU_BUTTONS = ["Scan", "option"];
list MENU_OPTION = ["help"];
integer MENU_CHANNEL = 1024;


default
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "help")
{
llDialog(id, MENU_PROMPT, MENU_BUTTONS, MENU_CHANNEL);
llListen(MENU_CHANNEL, "", NULL_KEY, "");
}
else if (message == "option")
{
llDialog(id, "", MENU_OPTION, MENU_CHANNEL);
}
else if(message == "Scan")
{
llSensor("", NULL_KEY, AGENT, 96, PI);
}
}

sensor(integer total_number)
{
llWhisper(0, (string)total_number + " avatars detected" );
// The following 'for' loop runs through all detected avatars and says "Hello Jane Doe",
// where "Jane Doe" is the name of the current detected avatar.
integer i;
for (i = 0; i < total_number; i++)
{
llWhisper(0, "Hello " + llDetectedName(i));
}
}

// if nobody is within 10 meters, say so.
no_sensor() {
llSay(0, "Nobody is around.");
}
}
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-27-2006 19:14
From: KINGR Redgrave
now my other question is how do i implemment the lldetect command in my script.
Excuse me, but I see you've already done...
CODE

llWhisper(0, (string)total_number + " avatars detected" );
// The following 'for' loop runs through all detected avatars and says "Hello Jane Doe",
// where "Jane Doe" is the name of the current detected avatar.
integer i;
for (i = 0; i < total_number; i++)
{
llWhisper(0, "Hello " + llDetectedName(i));
}

_____________________
:) Seagel Neville :)
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 19:33
ah i see, but would i just add this to it or is there more?
CODE

llWhisper(0, (string)total_number + " avatars detected" );
// The following 'for' loop runs through all detected avatars and says "Hello Jane Doe",
// where "Jane Doe" is the name of the current detected avatar.
integer i;
for (i = 0; i < total_number; i++)
{
llWhisper(0, "Hello " + llDetectedName + llDectectKey(i));
}

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-27-2006 19:37
I would also suggest taking apart and understanding a basic radar script first. LSL will come to you but it isn't going to happen overnight. Start out small and keep going. It has taken me a few months to get to the stage I am at now. There are a whole lot of functions you need to assimilate and understand. There were times I had to wait before attempting some scripts.

I would also highly suggest installing either Scite-EZ or Notepadd++ & lslint. THey will show problems much better then the script window will and you can also have multiple scripts open to use as reference. Go to the wiki and look at the Alternate Editers page.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-27-2006 19:42
From: KINGR Redgrave
ah i see, but would i just add this to it or is there more?
Here are llDetected functions. I'm not sure what you want to do though.
_____________________
:) Seagel Neville :)
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 19:45
Good advice.Sometimes i try to get ahead of my self because im so eager to do things.Also where should i start out at.I think i pretty much understand for the most part how to make and edit a voice command dialog, so i thougt the next step would be adding commands.Maybe sensor and get key commands are out of my range for now,but where should i start?if maybe you can give me some sort of road map that would help out alot.thanks
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-27-2006 19:51
From: KINGR Redgrave
llWhisper(0, "Hello " + llDetectedName + llDectectKey(i));
hmm.. I didn't see your script carefully. Did you want to get keys, too? Then,

llWhisper(0, "Hello" + llDetectedName(i) + (string)llDetectedKey(i));

llWhipser requires string, so that you need to use type casting.
But the return becomes like this... "Hello, Jane Doe35f217a3-f618-49cf-bbca-c86d486551a9". Do you really want this?
_____________________
:) Seagel Neville :)
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 20:01
well sort of.im thinking if i wanted to say shoot a particle at an avatar, would i need there key or some sor of id?or how would i go about.im trying to get the command of getting information to do stuff to a object or avatar.
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 20:02
also,would i just change the channel to 1 so i can just see the info,or how would i do that also?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-27-2006 20:21
From: KINGR Redgrave
well sort of.im thinking if i wanted to say shoot a particle at an avatar, would i need there key or some sor of id?or how would i go about.im trying to get the command of getting information to do stuff to a object or avatar.
OK, so you need avatars' key information. If only you want to listen to it, try llOwnerSay.

llOwnerSay(llDetectedName(i) + "'s key is " + (string)llDetectedKey(i));
_____________________
:) Seagel Neville :)
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-27-2006 20:59
thanks, now say if i wanted to seperate the key,and the avatars name to different buttons,how would i get that to work.would it be something like this?
CODE


else if(message == "Scan")
{
llSensor("", NULL_KEY, AGENT, 96, PI); //<--- AND EDIT SOMETHING INSIDE HERE?




// OR WOULD I EDIT SOMETHING IN HERE AND PUT A "ELSE IF"SOME WHERE?IM NOT SURE




sensor(integer total_number)
{
llWhisper(0, (string)total_number + " avatars detected" );
// The following 'for' loop runs through all detected avatars and says "Hello Jane Doe",
// where "Jane Doe" is the name of the current detected avatar.
integer i;
for (i = 0; i < total_number; i++)
{
llOwnerSay(llDetectedName(i) + "'s key is" + (string)llDetectedKey(i));
}


}

// if nobody is within 10 meters, say so.
no_sensor() {
llSay(0, "Nobody is around.");
}
}
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-27-2006 21:34
I tried.
CODE
string  MENU_PROMPT     = "What do you need help with?";
list MENU_BUTTONS = ["Scan", "option"];
list MENU_OPTION = ["help"];
integer MENU_CHANNEL = 1024;
integer ListenHandle;

key User;
string MENU_PROMPT2 = "Whose key do you want to know?";
list NAME_BUTTONS;
list KEY_LIST;


default
{
state_entry()
{
llListen(1,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string message)
{
User = id;
if (llToLower(message) == "help")
{
llListenRemove(ListenHandle);
llDialog(User, MENU_PROMPT, MENU_BUTTONS, MENU_CHANNEL);
ListenHandle = llListen(MENU_CHANNEL, "", NULL_KEY, "");
}
else if (message == "option")
{
llDialog(User, "", MENU_OPTION, MENU_CHANNEL);
}
else if(message == "Scan")
{
NAME_BUTTONS = [];
KEY_LIST = [];
llSensor("", NULL_KEY, AGENT, 96, PI);
}
else
{
llInstantMessage(User, (string)llList2Key(KEY_LIST, llListFindList(NAME_BUTTONS, [message])));
}
}

sensor(integer total_number)
{
integer i;
for (i = 0; i < total_number; i++)
{
NAME_BUTTONS += llDetectedName(i);
KEY_LIST += llDetectedKey(i);
}
llDialog(User, MENU_PROMPT2, NAME_BUTTONS, MENU_CHANNEL);
}

// if nobody is within 10 meters, say so.
no_sensor() {
llInstantMessage(User, "Nobody is around.");
}
}
And I chanded the listen channel to "1", so that you need to say "/1help" to show the dialog box. And the message of result would be listend to by just the person using this.
_____________________
:) Seagel Neville :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-28-2006 01:58
From: KINGR Redgrave
thanks, now say if i wanted to seperate the key,and the avatars name to different buttons,how would i get that to work.would it be something like this?



KINGR, Dont worry about throwing up posts, its a way to get information.
You do seem to be reiterating the same question in several posts though, are you sure you understand the concepts or are you just trying to reinforce the information ?

We covered this topic previously in this thread

The Particle System is passed a key as its target so you only need a key, but for human readability use the AV's name.
KINGR Redgrave
Registered User
Join date: 23 Dec 2006
Posts: 37
12-28-2006 16:23
sorry,im not so bright so sometimes it takes a lot of little baby steps for me to get the hang of something,but once i do its all good from there.i dont mean to sound repetitive but i do beleive programming is very picky.thanks for everyones help though
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-28-2006 17:30
I remember I was like you when I was a newbie. And everybody here was so kind to tell me anything that I became able to write scripts even though I had never experienced any program language.

One thing that I can advise you is that you should make sure what you really need to know.
It is good that your purpose is clear. But you seem to be overhasty to ask. Everybody who told you feels vain when you asks from one minute to the next.

You should already know how a particle script works. And you wanted to know how to get people's keys around you. But you asked about llDetected at the top of this thread. It was too long-winded. You should have asked like this.

I can get people's names around me by this script. But I want to get keys insted of names. It would be better if I could select each person and get his/her key. Does anyone tell me what to do?
_____________________
:) Seagel Neville :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-29-2006 01:05
From: KINGR Redgrave
sorry,im not so bright so sometimes it takes a lot of little baby steps for me to get the hang of something,but once i do its all good from there.i dont mean to sound repetitive but i do beleive programming is very picky.thanks for everyones help though


KINGR I wasnt suggesting anything about your 'brightness' and little baby steps are the best when approaching new concepts.

SL uses Keys to identify everything, it doesnt care if you are talking about Newgate Ludd or a plant pot, they are both just identified by keys. The names we apply to them are purely for our benefit, to make it easier for us to interact and identify things.

It doesnt make sense, not really, to display a list of keys on the Dialog, it will be meaningless since they will not allow the user to identify 'targets'. Instead you display the names and keep a corresponding copy of the keys to allow you to look up the key when the user selects a name. This is all covered in the thread link I posted earlier.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-29-2006 07:20
There is also one more problem with assigning keys to the buttons. Buttons can only display a limited number of characters. The buttons would only display the first few numbers of the keys. This also applies to the names on the buttons. For example; your name would show up on a button as KINGR R. If you go back and look at how I handled llDialog in the script I supplied the other day you will see that the names are on the buttons but I also display the full names at the top of the llDialog box.

In Seagels script when you got ready to display the names in the llDialog you could use either:
CODE

llDialog(User, KEY_LIST, NAME_BUTTONS, MENU_CHANNEL);

TO display the keys at the top of the menu and the truncated names on the buttons OR to display the full names on the top of the menu and the truncated names on the buttons you would:
CODE

llDialog(User, NAME_BUTTONS, NAME_BUTTONS, MENU_CHANNEL);
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-29-2006 07:44
From: Jesse Barnett
There is also one more problem with assigning keys to the buttons. Buttons can only display a limited number of characters. The buttons would only display the first few numbers of the keys. This also applies to the names on the buttons. For example; your name would show up on a button as KINGR R. If you go back and look at how I handled llDialog in the script I supplied the other day you will see that the names are on the buttons but I also display the full names at the top of the llDialog box.
Good point. I forgot it completely. :o
But he may intend to change target to thorow particles by the dialog box.
What about just showing each first name and limiting at most twelve people?
CODE
        sensor(integer total_number) 
{
if(total_number > 12)
{
total_number = 12;
}
integer i;
for (i = 0; i < total_number; i++)
{
NAME_BUTTONS += llGetSubString(llDetectedName(i), 0, llSubStringIndex(llDetectedName(i), " ") - 1);
KEY_LIST += llDetectedKey(i);
}
_____________________
:) Seagel Neville :)