[EO] Need help with a code that doesn't work correctly

Hello.Well this is the third massive bug I have found with my code.I have made a sub that loads a picture on an certain image in frmMainGame based on your hotbar skill number in a certain slot.In the first time I try to use it , it only sets the variables but doesnt load the images.Then I try it again and it works perfectly.Well here is the subs :

PS: YeahHotBar sets the hotbar variable.I dunno why I have put this name into it.
PS2: All the packets are set up.

LoadImages Sub:

Sub LoadHotBarImages(ByVal Index As Long)
Dim number As Long
Dim skill As String
Dim i As Long

For number = 1 To 10
LoadHotBar (number)
Next
frmMainGame.picHotBar.Picture = frmMainGame.picTempBank.Picture

For i = 1 To 10
If HotBar(Index).slot(i) <> "0" Then
skill = CLng(HotBar(Index).slot(i))
number = spell(skill).Icon
frmMainGame.Image1(i).Picture = LoadPicture(App.Path & "\data files\graphics\spellicons\" & number & ".gif")
Else
frmMainGame.Image1(i).Picture = frmMainGame.picTempBank.Picture
End If
Next

End Sub

Here is how I call it:

Private Sub picSpells_DblClick()
    Dim spellnum As Long
Dim i As Long

For i = 1 To 10
LoadHotBar (i)
Next
    spellnum = IsPlayerSpell(SpellX, SpellY)

    If spellnum <> 0 Then
        For i = 1 To 10
        If GetHotBar(MyIndex, i) = "0" Then
        Call YeahHotBar(i, spellnum)
        LoadHotBar (i)
        LoadHotBarImages (MyIndex)
        Exit Sub
        End If
        Next

    End If

End Sub

Thanks , Vitin.

Look at how I handle rendering graphics to the UI. That’s how you should do it.

Having an array of picture boxes is how you would do it in old versions of Eclipse. You’re using Origins now. Shape up.

Log in to reply