Say something inworld (chat)

From libsecondlife

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.

The Code

Note: We are assuming that our main "SecondLife" variable 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'

See this page on monodoc for the list of ChatTypes

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.