Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sending object toward avatar based on name. :)

Rune Quinnell
Registered User
Join date: 25 Aug 2007
Posts: 28
09-10-2007 19:43
Ok so I've gotten some comfort with the scripting system and can now mix and match my functions and those nasty syntax errors are fewer and fewer between...

But thus far I can't find a script that does what I'm looking for.

Basically I want the object to listen for a command in chat that includes a name of the target avatar.

Then I want the object to rez something and send it at the target. (simple homing missile type of thing) or generate particles that target the named avatar.

Can't figure it out. I can get an object to follow, I can detect avatar names, and keys in the area, but I can't get the rez object to listen for the command and target a uuid based on a name input or anything.

Please help. :)
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
09-10-2007 20:23
Sounds like you're on the right path, using a sensor to detect the names of nearby agents. Perhaps it helps that when llDetectedName(x) is the one to be targeted, then llDetectedKey(x) will be the target's UUID, so the sensor event handler could maintain parallel lists of names and keys. Then the tricky (and laggy) bit is to match substrings parsed from the chat listen with the names in the list; the index of the matching name will then give the target key in the other list.

Parsing the chat into substrings will be a lot easier if first names are sufficient, to keep it just a single token comparison. (The sensor-detected names would also have to be truncated at first name only with such an approach.)

Anything that can be done to reduce the number of chat strings that are tested would be a win. For example, if only the owner can chat the targeting command, the llListen should be for just llGetOwner(). And if the name could be limited to the first token in the chat, or if at least that first token could be a keyword identifying the string as a targeting command, it would save a lot of list matching.
Rune Quinnell
Registered User
Join date: 25 Aug 2007
Posts: 28
09-10-2007 21:43
Thanks I can see what your saying but it will take some working to impliment.

I'm a bit fuzzy on how you would get the object to listen for a detected name though? Making it only take commands from the owner should be easy but how do I tell it what words to look for and where.

A simple command line like "Shoot Ted" would be fine, so I want the llDetectedName to look for the second word as a name, how would I do that?

And you're saying if it detects a name it automatically saves it as a paralel to all other lldetected functions yes?

:)

Still bumbling through but that helped a lot, also any other resources/sites I might check out for a refference would be great if you know of them.