Valhalla Legends Forums Archive | Battle.net Bot Development | Standardized Plugin Structure

AuthorMessageTime
Networks
[code]

Public Host As Object

Private Sub Class_Initialize()
    'Do Stuff
End Sub

Private Sub Class_Terminate()
    'Do Stuff
End Sub

'Required:

Private Property Get Version() As String
    Version = "1.0.0"
End Property

Private Property Get Title() As String
    Title = "Blank Plugin"
End Property

Private Property Get Description() As String
    Description = "Standardized Plugin Structure Created by Networks"
End Property

Private Property Let SetHost(ByVal objHost As Object)
    Host = objHost
End Property

'EID Events:

    '#### Informational Events:

Private Sub On_Channel(ByVal Message As String)

End Sub

Private Sub On_Error(ByVal Message As String)

End Sub

Private Sub On_NotExist(ByVal Message As String)

End Sub

Private Sub On_Restricted(ByVal Message As String)

End Sub

Private Sub On_ChannelFull(ByVal Message As String)

End Sub

    '#### User Events:

Private Sub On_Join(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Client As String)

End Sub

Private Sub On_Leave(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Client As String)

End Sub

Private Sub On_User(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Client As String)

End Sub

Private Sub On_Flags(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Client As String)

End Sub

    '#### Message Events:

Private Sub On_Talk(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Message As String)

End Sub

Private Sub On_Emote(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Message As String)

End Sub

Private Sub On_WhisperFrom(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Message As String)

End Sub

Private Sub On_WhisperTo(ByVal Username As String, ByVal Flags As Long, ByVal Ping As Long, ByVal Message As String)

End Sub

'EID End

'Packet Parsing:

Private Sub Parse_Packet(ByVal PacketID As Long, ByVal Data As String, ByVal Connection As Byte)
    Select Case Connection
        Case 1 'BNCS
       
        Case 2 'MCP
       
        Case 3 'BNLS
       
        Case 4 'BotNet
       
        Case Else
    End Select
End Sub

'Host Functions:
'   Get_Access(ByVal Username as String) as String
'   AddChat(RTB, ParamArray saElements())
'   Get_Trigger()
'   Send(ByVal Message as String)
'   AddQueue(ByVal Message as String)

[/code]

Warrior mentioned to me that we really need a general plugin structure for all the bots because it's kinda lame to have about 5-6 different so why not create something we can all use. I created something we may but I am assuming it will get heavy criticism which I hope it will get so we can all comprimise on something. Anyhow I'd like to know what can be improved, what we can add, what we remove, and we should modify. I know Skywing has created BCP plugins but IMO it makes the bot dependent on it instead of the other way around. This is a simple plugin structure that can easily be modified to our liking and if you feel like you don't want to host a function then don't, it's as simple as that. Anyhow I'd like to know what we can do to improve and create a Standardized Plugin Structure. I've dubbed it 'SPS'. :)
February 16, 2005, 5:44 PM
UserLoser.
You should explain to use how you use this.  I don't think just the code from that class will be enough for somebody to actually write plugins and a framework supporting your plugins
February 16, 2005, 8:02 PM
LoRd
[quote]I know Skywing has created BCP plugins but IMO it makes the bot dependent on it instead of the other way around.[/quote]
You face this delima with every type plugin: Should I only provide users with a means of connecting to Battle.net and then give them the ability to continue the project as they wish through the use of plugins, should I create all of the essential features of this bot as plugins and then leave the rest up to the users or should I just hardcode everything essential to my bot and give users the ability to add more as they see fit.  Each option has it's own advantages and disadvantages.

As for the standardization: BCP has grown from it's original intent, to be used with Binary Chat, to a standard for those wishing to impliment an extensive plugin interface that's both been implimented in plenty of other bots and already has a number of useful plugins.
February 16, 2005, 8:08 PM
Quarantine
What about the option to ignore some packet functions :P
February 16, 2005, 9:44 PM
tA-Kane
[quote author=Warrior link=topic=10582.msg100039#msg100039 date=1108590291]
What about the option to ignore some packet functions :P
[/quote]What do you mean? You can disable some of the BinaryChat Plugin API callbacks by a simple change from TRUE to FALSE which will cause the compiler to simply not compile that callback. Later, when your plugin gets initialzed, the location of that callback is set to NULL, so the host bot knows that callback is not used.

Thus, you can ignore packet functions.
February 16, 2005, 11:37 PM
CrAz3D
I think the biggest BCP draw back, for me, is that I couldn't write plugins for my bot, I'd have to rely on others to do this until/if I learn C++.  I think there are a few more people out there that are in the same bboat I am, I GUESS I could upgrade sometime though from my dingy to a yacht.
February 16, 2005, 11:46 PM
Arta
I hate to be so stereotypical, but there's already a 'de facto' standard. BC has more plugins than anything else I know of, and is flexible and effective.. Thus, BC's plugin architecture is a sufficiently useful standard.

Perhaps Skywing should consider making BC4's plugin architecture more generalised (eg, less organised around BC's architecture) so that it can serve as a standard, but either way, it's not that important. It's pretty good as is.
February 17, 2005, 12:17 AM
Quarantine
Kane: I mean't for the plugin structure Networks is working on and how it can do that :P
February 17, 2005, 12:39 AM
Networks
That is nothing official that just something I quickly whipped up in my programming class with a little though prior to it being whipped up. Why do you think of way! :).
February 17, 2005, 1:24 AM
Myndfyr
I have used the same general architecture for .NET plugins in pretty much any extensible project I've worked on in .NET, utilizing some type of reflection/interface/base class and then attributes.  That seems to work best and most efficiently for .NET.

I'm hoping to also implement a BCP layer in my next project.
February 17, 2005, 2:13 AM

Search