'Custom search Function was written by: Gerald L. Blakley 2007 A.K.A OnTheCuttingEdge2005

'Here are some coding techniques for the custom search function:
'This search function already assumes you know a little about VbScript
'and are in need of a flexible custom search function.

'when this plugin is used then this function below will appear in your HalScript.dbg
'so that it can be used for programming.
Search = CustomSearch(UserSentence)

'Custom Search Function
'this search function is not reversed person.
'NOTE!!!
'do not use punctuation in the search because
'the function automatically removes punctuation
'from the search string and is not needed.
'Examples below:

'here is where we use our new search function called Search
'and not search, the name of the function is case sensitive.
'notice there is no comma used in this search or a question mark.

'if you use the count feature then you must encase the string to search in a left and right parenthesis
'and the string must have a leading space and a trailing space, the search number proceeds the left
'parenthesis with no spaces.

'there are 4 words in this sentence, if the number is 4 and there are 5 words then the string search
'will be False or will equal 0 and will not give a response.

If InStr(1, Search, "4( HELLO HOW ARE YOU )", vbTextCompare) > 0 Then
	GetResponse = " Hello my friend "
End If

'Or

If InStr(1, Search, "4( hello how are you )", vbTextCompare) > 0 Then
	GetResponse = " Hello my friend "
End If

'Or

If InStr(1, Search, " HELLO HOW ARE YOU ", vbTextCompare) > 0 Then
	GetResponse = " Hello my friend "
End If

'Or

If InStr(1, Search, " HELLO HOW ARE YOU ", vbTextCompare) > 0 Then

	Select Case HalBrain.RandomNum(Int(Rnd * 11) + 1)
		Case 1
			GetResponse = " Hey, How have you been? "
	End Select

End If

'Or

If InStr(1, Search, " hello how are you ", vbTextCompare) > 0 Then

	Select Case HalBrain.RandomNum(6)
		Case 1
			GetResponse = " Hey, How have you been? "
	End Select

End If

'Or

If InStr(1, Search, "hello how are you", vbTextCompare) > 0 Then

	Select Case HalBrain.RandomNum(1)
		Case 1
			GetResponse = " Hey, How have you been? "
	End Select

End If

'Note!!!!
'the search string is not case sensitive when used with the vbTextCompare search method as shown above.

'the string to search can be used with or without a search number.
'the number is used for when a search contains only one word
'like: Hello. = "1( HELLO )" in our Search function.

'The search becomes more useful because it allows you to detect single words
'or just use it for common string searchs.

'If you use this plugin then you can use this function called search in any of your other
'plugins and or default brain that caches to the HalScript.dbg