I'm just learning a bit about writing plugins for MsgPlus in VB6 and I've been trying to write one that just adds one command, but my command isn't recognized and doesn't appear in the list that appears when you just press "/" in a conversation window. My plugin is loaded and checked in the MsgPlus preferences, so the problem must be in my coding. I just have no idea what I'm doing wrong.
I have the two modules loaded into my project and my own module looks like this:
code:
Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
Initialize = True
End Function
Public Function ParseCommand(ByVal sCommand As String, ByVal sCommandArg As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
If (StrComp(LCase(sCommand), "/xphobia", vbTextCompare) = 0) Then
Dim PhobiaFile As String
Dim Phobias() As String
Dim RandomPhobia As String
Open "E:\My Documents\phobialist.txt" For Input As #1
PhobiaFile = Input(LOF(1), 1)
Close #1
Phobias = Split(PhobiaFile, vbNewLine)
Randomize
RandomPhobia = Phobias(Fix((UBound(Phobias) + 1) * Rnd))
sResult = RandomPhobia
ParseCommand = True
Exit Function
End If
ParseCommand = False
End Function
It's supposed to pull up a file and send back a random line from it. That part works. I'm probably just missing something stupid because I've never done this before. Any help would be appreciated.