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

[EA] Unrecoverable DX8 Error and Run-time error 9


ranslsad
 Share

Recommended Posts

Hi, im trying to draw more equipement items i added to my EA Project.

but im having the next error when i try to set each item position on Character Window Draw.

Select Case Item(itemNum).Type gives me the next error:

```

The following error occured at 'Render_Graphics' in 'modGraphics'.

Run-time error '9': Subscript out of range.

```

Code:

```

Public Sub DrawEquipment()

Dim x As Long, y As Long, i As Long

Dim itemNum As Long, ItemPic As DX8TextureRec

For i = 1 To Equipment.Equipment_Count - 1

itemNum = GetPlayerEquipment(MyIndex, i)

' get the item sprite

If itemNum > 0 Then

ItemPic = Tex_Item(Item(itemNum).Pic)

Else

' no item equiped - use blank image

ItemPic = Tex_GUI(28 + i)

End If

Select Case Item(itemNum).Type

Case ITEM_TYPE_WEAPON

y = GUIWindow(GUI_CHARACTER).y + EqTop

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) Mod EqColumns)

Case ITEM_TYPE_ARMOR

y = GUIWindow(GUI_CHARACTER).y + EqTop + 34

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) Mod EqColumns)

Case ITEM_TYPE_HELMET

y = GUIWindow(GUI_CHARACTER).y + EqTop + 68

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) Mod EqColumns)

Case ITEM_TYPE_SHIELD

y = GUIWindow(GUI_CHARACTER).y + EqTop

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) * (((i - 1) Mod EqColumns)))

Case ITEM_TYPE_GLOVES

y = GUIWindow(GUI_CHARACTER).y + EqTop

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) * (((i - 1) Mod EqColumns)))

Case ITEM_TYPE_PANTS

y = GUIWindow(GUI_CHARACTER).y + EqTop

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) * (((i - 1) Mod EqColumns)))

Case ITEM_TYPE_SHOES

y = GUIWindow(GUI_CHARACTER).y + EqTop

x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 34) * (((i - 1) Mod EqColumns)))

End Select

'EngineRenderRectangle itempic, x, y, 0, 0, 32, 32, 32, 32, 32, 32

RenderTexture ItemPic, x, y, 0, 0, 32, 32, 32, 32

Next

End Sub

```

Sry for bad english and thanks.

Greetings

Ranslsad
Link to comment
Share on other sites

~~Client Debug should only be set by people who actually play the game. (Don't have the source or the tools required for it.) So I suggest you set debug as false. After that use the code that errors. When it does error a box with the error desc and the number will appear. (Do the running within VB6 by pressing ctrl+F5\. This will begin full compile meaning that each and every line is checked.)

Within the box there should be a 'Debug' button. Press it and it will highlight the line of code on which the error occurs.

Now hover over each variable. A small message will popup. When the message has the following text

Or similar, tell is which variable it is.~~

Didn't see the topic title.
Link to comment
Share on other sites

Did you create the variable to define [background=rgb(248, 248, 248)]ITEM_TYPE_GLOVES [/background][background=rgb(248, 248, 248)]ITEM_TYPE_PANTS [/background]and [background=rgb(248, 248, 248)]ITEM_TYPE_SHOES [/background]?

Such as:

Public Const ITEM_TYPE_GLOVES as Byte = 6 <–--- Example.
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...