Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Recognizing spoken text

Xixao Dannunzio
Owner, X3D Enterprises
Join date: 20 Mar 2006
Posts: 114
04-29-2006 17:42
Hi,

I've gotten a script to recognize commands (ie, "Light on!";), but I want to take it a step further. Here's what I'm trying to do:

- Player gives command "<command>, <player name>"
- Object is rezzed from their inventory, and a variable for <player name> is stored
- As certain actions are performed, <player name> is read, and spoken by the object
- <player name> is also able to perform an action on the object that others are not

Anyone know how to go about doing this? I thought of using llGetSubString, but don't know how to retrieve the information obtained by it.


Thanks!
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
04-29-2006 18:36
varibles, llSubStringIndex, and llGetSubString

CODE


integer where_is_the_comma;

string command;
string av_name;

default
{
state_entry()
{
llListen( 88, "",llGetOwner(), "" ); //start listening for the owner on channel 88
}

//when the owner speaks on channel 88 (/88stuff)
listen( integer channel, string name, key id, string message )
{
where_is_the_comma = llSubStringIndex(message, ",");

command = llGetSubString(message,0, (where_is_the_comma - 1));
//you want one space before the comma hince the (minus) 1

av_name = llGetSubString(message,(where_is_the_comma + 1),-1);
// +1 to start after the comma, -1 to read the rest of the string

llOwnerSay("command given: "+command+" name given: "+av_name);
}
}



http://secondlife.com/badgeo/wakka.php?wakka=llSubStringIndex
http://secondlife.com/badgeo/wakka.php?wakka=llGetSubString
Xixao Dannunzio
Owner, X3D Enterprises
Join date: 20 Mar 2006
Posts: 114
04-29-2006 18:39
Thank you so much. I'll try this tonight!
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
04-29-2006 18:45
i just caught a mistake, if it doesnt compile it should now (forgot () after llGetOwner) :)