31-07-2009, 10:58 AM
Function which automatically checks the first letter of what's fed into it. Will see if it's correct to use 'An' or 'A'. Supports capitalisation and proper nouns. If the item, npc etc. has $ as the first character of it's name, it'll be read as a proper noun. Of course, you'll have to remove this when rendering item names and stuff on the map.
Example:
Code:
Public Function CheckGrammar(ByVal Word As String, Optional ByVal Caps As Byte = NO) As String
Dim FirstLetter As String * 1
FirstLetter = LCase$(Left$(Word, 1))
If FirstLetter = "$" Then
CheckGrammar = (Mid$(Word, 2, Len(Word) - 1))
Exit Function
End If
If Caps Then CheckGrammar = "A " & Word Else CheckGrammar = "a " & Word
If FirstLetter = "a" Or FirstLetter = "e" Or FirstLetter = "i" Or FirstLetter = "o" Or FirstLetter = "u" Then
If Caps Then CheckGrammar = "An " & Word Else CheckGrammar = "an " & Word
End If
End FunctionExample:
Code:
msg = "You picked up " & CheckGrammar(Trim(Item(GetPlayerInvItemNum(index, n)).Name)) & "."Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


