Friends function

From StealthBot Wiki Backup
Revision as of 04:58, 28 December 2009 by Ribose (talk) (Created page with 'The Friends function, provided by the Script Support Class, returns a collection of Friend objects. ==Development== This function was added by Eric in versio…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Friends function, provided by the Script Support Class, returns a collection of Friend objects.

Development

This function was added by Eric in version 2.7.

Documentation

'// FRIENDS
'// Returns a collection of friends objects
Public Function Friends() As Object

    Dim i As Integer ' ...

    ' ...
    Set Friends = New Collection

    ' ...
    For i = 1 To g_Friends.Count
        Friends.Add g_Friends(i).Clone()
    Next i

End Function

Syntax

To store a value that a Friend object can retrieve (at index Index):

Variable = Friends(Index).GetSomething

Advanced Note: When the Friends function is called, a copy of the Friends collection is made so that you cannot cause the bot to send bad information to Battle.net by changing properties of the internal friend objects. Normally, the convention is to get values (like Friends(Index).Name) from the bot's friend collection, not from a friend colleciton that you stored before using Set FriendCol = Friends(). This also guarantees that the information is more up to date.

See the Friend object article for examples and usage of the Friend object.

See also