Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help with searching a player's inventory


Yxxe
 Share

Recommended Posts

Basically what I want to do in this piece of code is to display different pieces of lore to read, depending on whether the lore scripture is in their inventory. You click the label, it checks the inventory and updates labels (i'll add the pictures bit later). The only problem is that when I click the button, I come up with "Subscript out of range" error. I was wondering if anyone could help me. Here is the code so far:

```
Private Sub lblLore_Click()
Dim i As Integer

'check through inventory
'maybe use select case?
For i = 1 To MAX_ITEMS
    If GetPlayerInvItemNum(MyIndex, i) = 10 Then
    frmLore.lblVol2.Caption = "Volume 2 - "
    'show image
    End If

    If GetPlayerInvItemNum(MyIndex, i) = 11 Then
    frmLore.lblVol3.Caption = "Volume 3 - "
    'show image
    End If

    If GetPlayerInvItemNum(MyIndex, i) = 12 Then
    frmLore.lblVol4.Caption = "Volume 4 - "
    'show image
    End If

    If GetPlayerInvItemNum(MyIndex, i) = 13 Then
    frmLore.lblVol5.Caption = "Volume 5 - "
    'show image
    End If

    Next

    frmLore.Visible = True
End Sub
```
When I go into debug, it points to the "GetPlayerInvItemNum" function, and has a value of zero.

Thanks for your time.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...