Hey guys.

So, basically, this tutorial tells you how to make chat stated ingame get posted to an IRC channel as well as all ingame players. This is especially useful for moderating ingame chat, and is a nice thing to add to your feature list  😉

All this tutorial is mine, and I would like for people to credit me if you use this tutorial.

RECOMMENDED PREREQUISITES:

  1. mIRC, or another IRC client with a scripting interface. (I recommend mIRC because I am fluent with its scripting system.)
  2. EO2, I don’t know if this tutorial works with other versions  😛

The mIRC bot is only recommended because some channels/irc servers block “external chat messages”. Basically, you have to be in the channel to chat, and it didn’t join the channel for me.

ALL OF THESE CODE EDITS ARE IN THE SERVER ONLY - THE CLIENT IS NOT MODIFIED.

Right, let’s get down to it.


First, go to frmServer, and create a Winsock there. In this code Winsock is called “Winsock1” but you can change that if you want.

Once that is done, open the Code View for frmServer and find

Private Sub Form_Load()

and add

Winsock1.RemoteHost = "irc.editingarchive.com"
    Winsock1.RemotePort = "6667"
    Winsock1.Connect

to that sub.

add below that:

Private Sub Winsock1_Connect()
    Call TextAdd("Connected to ArchiveIRC!")
    Winsock1.SendData ("NICK nickname" & vbCrLf)
    Winsock1.SendData ("USER username x x :server" & vbCrLf)
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    On Error Resume Next
    Dim sRecv As String
    Winsock1.GetData sRecv, vbString
    If Split(sRecv, " ")(0) = "PING" Then
        Winsock1.SendData "PONG " & Split(sRecv, " ")(1)
        Call TextAdd("Ponging.")
    End If

    Call TextAdd("IRC: " & sRecv)
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    Unload Me
    MsgBox ("WINSOCK ERROR!")
End Sub

now in modHandleData find

Private Sub HandleSayMsg(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

and add just above

Set Buffer = Nothing

this

    frmServer.Winsock1.SendData ("PRIVMSG botname [Map #" & GetPlayerMap(index) & "] " & GetPlayerName(index) & ": " & Msg & vbCrLf)

and in

Private Sub HandleBroadcastMsg(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

add

    frmServer.Winsock1.SendData ("PRIVMSG botname " & s & vbCrLf)

Now we’re done in VB6! Now to mIRC

In mIRC’s Script editor, add this:

on *:TEXT:*:*: { If $nick = youservernickname msg #channel GameName: $1- }

Now run the server, and voila! I get the distinct feeling I missed something, so report any errors. Also, I hope you enjoy and spin off to make it amazing! 😄