Say something in world, and type

From libopenmetaverse - libomv - Developer Wiki

Jump to: navigation, search

Contents

How to make an avatar something in world and type as well

Reason

I thought that this method may be useful for some people who have not yet found a way to make their avatar's speak in-world realistically like another avatar would.

Code

Note: We are assuming that our main "GridClient" instance variable is named "Client." If you have a different name for this variable, please substitute the name accordingly

 
//TypeChat method to make avatar do typing animation and sound
//Typing is the key for the typing animation
//delay is the time delay in milliseconds between the avatar beginning to type and sending the message and stopping the typing animation
//type is the ChatType to use, such at ChatType.Normal for regular avatar speaking
static void TypeChat(int delay, string say, int channel, ChatType type) {
    UUID typing = new UUID("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9");
    Client.Self.AnimationStart(typing, true);
    Thread.Sleep(delay); //using System.Threading;
    Client.Self.Chat(say, channel, type);
    Client.Self.AnimationStop(typing, true);
}
 

Additional API Documentation

AnimationStart Method Chat Method AnimationStop Method