Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: BaDDBLooD on October 10, 2004, 01:28 AM

Title: Function Problem
Post by: BaDDBLooD on October 10, 2004, 01:28 AM


Public Characters() As CharacterInfo

Public Type CharacterInfo
    Name As String
    Prefix As String
    Class As Classes
    Level As Byte
    Expiration As Date
    Difficulty As String
    Flags As String
    Dead As Boolean
End Type

Public Enum Classes
    Amazon
    Assassin
    Barbarian
    Druid
    Necromancer
    Paladin
    Sorceress
    Unknown
End Enum



Each Item in the Array is a Character i Recieve in 0x19, Each Character has it's own Stats, as you can see.

in 0x19



    Case MCP_CHARLIST2
        Dim Count As Byte, Position As Integer
        Dim Name As String, Statstring As String

        Count = Asc(Mid(Data, 6, 1))
        Position = 12
        For I = 1 To Count
            Characters(I).Expiration = GetDWORD(Mid(Data, Position, 4))
            Position = Position + 4
            Name = Mid(Data, Position, InStr(Mid(Data, Position), Chr(0)) - 1)
            Characters(I).Name = Name
            Position = Position + Len(Name) + 1
            Statstring = Mid(Data, Position, InStr(Mid(Data, Position), Chr(0)) - 1)
            'Some Function
            Position = Position + Len(Statstring) + 1
           
            AddChat frmMain.rtbChat, vbCyan, Characters(I).Name
            AddChat frmMain.rtbChat, vbCyan, Characters(I).Expiration
           
            'AddChat frmMain.rtbChat, vbCyan, Characters(I).Class
            'AddChat frmMain.rtbChat, vbCyan, Characters(I).Dead
            'AddChat frmMain.rtbChat, vbCyan, Characters(I).Difficulty
            'AddChat frmMain.rtbChat, vbCyan, Characters(I).Flags
            'AddChat frmMain.rtbChat, vbCyan, Characters(I).Level
            'AddChat frmMain.rtbChat, vbCyan, Characters(I).Prefix
        Next I



How would i go about writing a function like this:

Modified Statstring as an Argument, than Parses the Statstring into

EX:
Level
Class
Difficulty

( I can do this myself )

Than Export the Parsed Info, Back into the Array i had in 0x19

Characters(I).Level
Characters(I).Class
Characters(I).Difficulty

Thank you SO VERY Much

Title: Re: Function Problem
Post by: LivedKrad on October 14, 2004, 12:17 PM
Clarify your statements by using transitional words in the place of comparison words.

e.g.: "than" becomes "then"