Friends

Methods to interact with the friends gametab.

_images/friends.png

ERSFriendsButton

ERSFriendsButton = enum(ADD, DEL, FRIENDS, IGNORE);

Represents the buttons in the friends tab.


TRSFriend Record

Represents a friend/ignore in the friends tab.


TRSFriends Record

Main record responsible with handling the friends gametab.


Friends.IsOpen

function TRSFriends.IsOpen(): Boolean;

Returns true if the friends tab is open.

Example:

WriteLn Friends.IsOpen();

Friends.Open

function TRSFriends.Open(): Boolean;

Attempts to open the friends gametab.

Example:

WriteLn Friends.Open();

Friends.GetFriends

function TRSFriends.GetFriends(): TRSFriendArray;

Returns an array of all friends/ignores currently visible in the friends tab.

Example:

var
  friend: TRSFriend;
  friends: TRSFriendArray;
begin
  friends := Friends.GetFriends();
  for friend in friends do
    WriteLn('Friend: ' + friend.Name + ' World: ' + IntToStr(friend.World));
end;


- - -

## Friends.Find
```pascal
function TRSFriends.Find(name: String): TRSFriend;

Searches for a friend/ignore by name in the friends tab.

Example:

var
  friend: TRSFriend;
begin
  friend := Friends.Find('SomePlayer');
  if friend <> Default(TRSFriend) then
    WriteLn('Found friend: ' + friend.Name + ' World: ' + IntToStr(friend.World))
  else
    WriteLn('Friend not found.');
end;


- - -

## Friends.AddFriend
```pascal
function TRSFriends.AddFriend(name: String): Boolean;

Attempts to add a friend to the friends list.

Example:

WriteLn Friends.AddFriend('SomePlayer');

Friends.DeleteFriend

function TRSFriends.DeleteFriend(name: String): Boolean;

Attempts to delete a friend from the friends list.

Example:

WriteLn Friends.DeleteFriend('SomePlayer');

Friends.SendMessage

function TRSFriends.SendMessage(name, message: String): Boolean;

Attempts to send a message to a friend.

Example:

WriteLn Friends.SendMessage('SomePlayer', 'Hello there!');

Friends.AddIgnore

function TRSFriends.AddIgnore(name: String): Boolean;

Attempts to add a player to the ignore list.

Example:

WriteLn Friends.AddIgnore('SomePlayer');

Friends.DeleteIgnore

function TRSFriends.DeleteIgnore(name: String): Boolean;

Attempts to delete a player from the ignore list.

Example:

WriteLn Friends.DeleteIgnore('SomePlayer');

Friends variable

Global TRSFriends variable.