Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Animation by attachment

Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
05-17-2007 07:00
I have an attachment that some of my friends can wear, it will animate them based on something I say (llListen). I would like to change it such that I can add their name to it, or some part of their name maybe. Example: "-SitDown" now will make everyone in my voice range sit. I would like just Johnny Blurf to sit down so I would like to say "Johnny SitDown" or "-SitDown Johnny" or "-SitDown J" if he is the only one wearing it with a first name startign with "J".

I have seen the posing attachments that you cna says "hug Zel" that will then approach Zeldini Hooberflatchet because that is the only person whos name matches Zel, then offers to animate that icon. I guess I am looking to do it in reverse, listening for some command you understand, then parsing the rest of the command to discern if it may be aimed at you, based on your first name or whole name or some part of it.

Obviously I am already getting to the point that I detected that -SitDown was said. How can I get the rest of the line in which it was spoken? And how do I get the wearing avatar's name?

The other direction may be listening instead of listening for -SitDown to somehow listen for <getMyFirstName>+' SitDown'
Amity Slade
Registered User
Join date: 14 Feb 2007
Posts: 2,183
05-17-2007 08:56
This is more of a scripting question than an animation question. You might try asking on a scripting forum.

Basically, you'll need to alter the script inside the attachment (or possibly a notecard from which the script reads). The script determines what the object is lisetning for, and what it does with what it hears.
Dopel Dollinger
Registered User
Join date: 25 May 2007
Posts: 14
06-01-2007 06:40
I am not a scripting expert and this is far from perfect code, but this should get you started.

CODE

// Pull the chat text into a string
// This is an example string
string text = "-SitDown John";

// Get the name of the avi
string aviName = llKey2Name(llDetectedKey(0));
llSay(0, "My name is " + aviName);

//Check to see if my avi's name was in the text command
if (llSubStringIndex(text, aviName) >= 0)
{
llSay(0, "I will now react to command because its for me!");
}
else
{
llSay(0, "You must be talking to somone else");
}