H
HardySpicer
The procedure is
Option Explicit On
Option Strict On
Imports Microsoft.VisualBasic
Imports System
Imports System.Xml
Imports System.Text
Imports System.Collections.Generic
Namespace AIMLbot.AIMLTagHandlers
''' <summary>
''' The random element instructs the AIML interpreter to return
exactly one of its contained li
''' elements randomly. The random element must contain one or more li
elements of type
''' defaultListItem, and cannot contain any other elements.
''' </summary>
Public Class random
Inherits AIMLbot.Utils.AIMLTagHandler
''' <summary>
''' Ctor
''' </summary>
''' <param name="bot">The bot involved in this request</param>
''' <param name="user">The user making the request</param>
''' <param name="query">The query that originated this node</param>
''' <param name="request">The request inputted into the system</
param>
''' <param name="result">The result to be passed to the user</param>
''' <param name="templateNode">The node to be processed</param>
Public Sub New(ByVal bot As AIMLbot.Bot, ByVal user As AIMLbot.User,
ByVal query As AIMLbot.Utils.SubQuery, ByVal request As
AIMLbot.Request, ByVal result As AIMLbot.Result, ByVal templateNode As
XmlNode)
MyBase.New(bot, user, query, request, result, templateNode)
Me.isRecursive = False
End Sub
Protected Overrides Function ProcessChange() As String
If Me.templateNode.Name.ToLower() = "random" Then
If Me.templateNode.HasChildNodes Then
' only grab <li> nodes
Dim listNodes As List(Of XmlNode) = New List(Of XmlNode)()
For Each childNode As XmlNode In Me.templateNode.ChildNodes
If childNode.Name = "li" Then
listNodes.Add(childNode)
End If
Next childNode
If listNodes.Count > 0 Then
Dim r As New random()
Dim chosenNode As XmlNode = CType(listNodes(r.Next
(listNodes.Count)), XmlNode)
Return chosenNode.InnerXml
End If
End If
End If
Return String.Empty
End Function
End Class
End Namespace
and I am getting the error at every Dim r as New random()
Error 1 Argument not specified for parameter 'bot' of 'Public Sub New
(bot As Bot, user As User, query As Utils.SubQuery, request As
Request, result As Result, templateNode As System.Xml.XmlNode)'. C:
\Users\smithy\Desktop\vbaiml\AIMLbot\AIMLTagHandlers\random.vb 42 29
AIMLbot
any ideas
Hardy
Option Explicit On
Option Strict On
Imports Microsoft.VisualBasic
Imports System
Imports System.Xml
Imports System.Text
Imports System.Collections.Generic
Namespace AIMLbot.AIMLTagHandlers
''' <summary>
''' The random element instructs the AIML interpreter to return
exactly one of its contained li
''' elements randomly. The random element must contain one or more li
elements of type
''' defaultListItem, and cannot contain any other elements.
''' </summary>
Public Class random
Inherits AIMLbot.Utils.AIMLTagHandler
''' <summary>
''' Ctor
''' </summary>
''' <param name="bot">The bot involved in this request</param>
''' <param name="user">The user making the request</param>
''' <param name="query">The query that originated this node</param>
''' <param name="request">The request inputted into the system</
param>
''' <param name="result">The result to be passed to the user</param>
''' <param name="templateNode">The node to be processed</param>
Public Sub New(ByVal bot As AIMLbot.Bot, ByVal user As AIMLbot.User,
ByVal query As AIMLbot.Utils.SubQuery, ByVal request As
AIMLbot.Request, ByVal result As AIMLbot.Result, ByVal templateNode As
XmlNode)
MyBase.New(bot, user, query, request, result, templateNode)
Me.isRecursive = False
End Sub
Protected Overrides Function ProcessChange() As String
If Me.templateNode.Name.ToLower() = "random" Then
If Me.templateNode.HasChildNodes Then
' only grab <li> nodes
Dim listNodes As List(Of XmlNode) = New List(Of XmlNode)()
For Each childNode As XmlNode In Me.templateNode.ChildNodes
If childNode.Name = "li" Then
listNodes.Add(childNode)
End If
Next childNode
If listNodes.Count > 0 Then
Dim r As New random()
Dim chosenNode As XmlNode = CType(listNodes(r.Next
(listNodes.Count)), XmlNode)
Return chosenNode.InnerXml
End If
End If
End If
Return String.Empty
End Function
End Class
End Namespace
and I am getting the error at every Dim r as New random()
Error 1 Argument not specified for parameter 'bot' of 'Public Sub New
(bot As Bot, user As User, query As Utils.SubQuery, request As
Request, result As Result, templateNode As System.Xml.XmlNode)'. C:
\Users\smithy\Desktop\vbaiml\AIMLbot\AIMLTagHandlers\random.vb 42 29
AIMLbot
any ideas
Hardy