Valhalla Legends Archive

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

Title: ListView Problem
Post by: BaDDBLooD on October 31, 2004, 10:40 AM
I am trying to add packet MCP_CHARCREATE 0x02 to my bot

I add some characters at the start:



Private Sub Form_Load()
    lstCharacters.ListItems.Add , , "Amazon", ICON_AMAZON
    lstCharacters.ListItems.Add , , "Sorceress", ICON_SORCERESS
    lstCharacters.ListItems.Add , , "Necromancer", ICON_NECROMANCER
    lstCharacters.ListItems.Add , , "Paladin", ICON_PALADIN
    lstCharacters.ListItems.Add , , "Barbarian", ICON_BARBARIAN
    lstCharacters.ListItems.Add , , "Druid", ICON_DRUID
    lstCharacters.ListItems.Add , , "Assassin", ICON_ASSASSIN
End Sub

Public Const ICON_AMAZON As Integer = 1
Public Const ICON_ASSASSIN As Integer = 2
Public Const ICON_BARBARIAN As Integer = 3
Public Const ICON_DRUID As Integer = 4
Public Const ICON_NECROMANCER As Integer = 5
Public Const ICON_PALADIN As Integer = 6
Public Const ICON_SORCERESS As Integer = 7



THey are in the image list as follows:

Amazon
Assassin
Barbarian
Druid
Necromancer
Paladin
Sorceress

Than when i send character class, i just use the index of the selected item.

However, as you might have guessed, the character i want to create is not the one that get's created :)

Title: Re: ListView Problem
Post by: Newby on October 31, 2004, 10:42 AM
Try sending Index + 1. IIRC, the index of the first item is 0.
Title: Re: ListView Problem
Post by: BaDDBLooD on October 31, 2004, 12:21 PM
Tried it, that was not the problem.
Title: Re: ListView Problem
Post by: Newby on October 31, 2004, 12:45 PM
Public Function GetChar(ByVal CharType As String) As Byte
    Select Case LCase(CharType)
        Case "barbarian": GetChar = 4
        Case "druid": GetChar = 5
        Case "assassin": GetChar = 6
        Case "amazon": GetChar = 0
        Case "sorceress": GetChar = 1
        Case "paladin": GetChar = 3
        Case "necromancer": GetChar = 2
        Case Else: GetChar = 4
    End Select
End Function

That's what I had in a bot I coded over half a year ago. I'm going with the assumption that your character values are wrong.