Friends

Methods to interact with the friends gametab.

../../images/friends.png

EFriendsButton enum

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

Represents the buttons in the friends tab.


TFriend type

Represents a friend/ignore in the friends tab.


TFriends type

Main record responsible with handling the friends gametab.


Friends.IsOpen

function TFriends.IsOpen(): Boolean;

Returns true if the friends tab is open.

Example:

WriteLn Friends.IsOpen();

Friends.Open

function TFriends.Open(): Boolean;

Attempts to open the friends gametab.

Example:

WriteLn Friends.Open();

Friends.GetFriends

function TFriends.GetFriends(): TFriendArray;

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

Example:

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


- - -

## Friends.Find
```pascal
function TFriends.Find(name: String): TFriend;

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

Example:

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


- - -

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

Attempts to add a friend to the friends list.

Example:

WriteLn Friends.AddFriend('SomePlayer');

Friends.DeleteFriend

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

Attempts to delete a friend from the friends list.

Example:

WriteLn Friends.DeleteFriend('SomePlayer');

Friends.SendMessage

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

Attempts to send a message to a friend.

Example:

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

Friends.AddIgnore

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

Attempts to add a player to the ignore list.

Example:

WriteLn Friends.AddIgnore('SomePlayer');

Friends.DeleteIgnore

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

Attempts to delete a player from the ignore list.

Example:

WriteLn Friends.DeleteIgnore('SomePlayer');

Friends variable

Global TFriends type variable.