Say something inworld (chat)

From libopenmetaverse - libomv - Developer Wiki

Jump to: navigation, search

Contents

Prerequisites

The following prerequisites are required in order for you to create your first bot by following this tutorial.

Real World

  • This tutorial assumes that you were able to successfully build libsecondlife! If you have not compiled libsl, please follow the instructions on the Getting Started wikipage.
  • Also, if you have no experience with the C# (c-sharp) programming language, I highly recommend that you stop now and please follow the list of links to csharp tutorials located here.
  • A libsl bot that is able to login successfully. If you don't know how to create a libsl bot, please go to the "How to create a basic libSL bot (obsolete)" wikipage

The Code

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

 
Client.Self.Chat("Hey There World", 0, ChatType.Normal);
 

Parameters:

  • message (string) What the bot is to say
  • channel (int) What channel the bot is to say the message on (use 0 for public chat)
  • type (ChatType) How to say 'message' on 'channel'

Additional API Documentation

[1] The Chat Method [2] The ChatType Enum

Notes

  • MainAvatar.ChatType.Normal = Saying (20m range).. Do NOT use MainAvatar.ChatType.Say, it is an obsolete version and will likely be removed in the near future.
  • Please only shout on channel 0 on rare occasions, as it can be annoying and bothersome to other residents.