Private Messaging

From AI Wiki

Jump to: navigation, search

Private Messaging

In Blue Mars you can send either a public message, for everyone to see, or a private message which can only be seen by the recipient. Sending a private message instead of a public message is as simple as calling sayTo() instead of say(). But there are a few details that need attention. First a practical one. Sending private messaging requires another communication channel. By default Iams do not open this channel so as not to unnecessarily waste resources. That means they can neither send nor receive private messages by default. In order to enable the PM feature, you need to add the following property to you Iam:


<bean id="PrivateChatter" class="com.avatar_reality.blue_mars.iam.framework.IamBot">
    .
    .
<property name="hasChat" value="true"/>
    .
    .
</bean>

The other detail is that sayTo() requires an extra parameter, which is a recipient. For the recipient you can use the name of an entity. Or you can use the sender parameter passed into receiveSayAction() and receiveSayFromAction(). They are not identical, but the IamFramework is flexible in this regard, and in most cases where you can use one, you can also use the other. Just make sure you don't rely on them being identical in your own code. Also, it is common to use the sender to call findEntity() to get further information about the sender. When received from receiveSayAction() it is guaranteed to find the entity information. But not so in case of receiveSayFromAction() because the sender could be logged into a completely different world.

Friends

In the Blue Mars client one can only send a private message to someone on the friends list. Iams currently do not have this requirement. They can send a private message to entities nearby as well. This is a very useful feature in cases where an Iam provides information only pertinent to one player, without causing the public chat channel to overload. asdfpoiu

Personal tools