Send an instant message
From libsecondlife
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" wikipage
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
LLUUID target = new LLUUID("243dd044-1127-11dc-8314-0800200c9a66"); //That key goes no where, replace it with the avatar key of the person you want to IM client.Self.InstantMessage(target, "Hello, World!");
Parameters:
- target (LLUUID) The key of the avatar you want to instant message
- message (string) The message you want to send them
- sessionID (LLUUID) [OPTIONAL] The UUID of the instant message session, can be found when you recieve an instant message from someone
Notes
- See "Finding the key of an Avatar by a name" if you don't know the key of the target and need to look it up on runtime.
- If you do not use the sessionID parameter, the reciever of the IMs will just recieve multiple instant message windows instead of grouping them into one window.. See how to respond to instant messages properly