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

Subscript out of range by allowing packets - still not fixed :(


teh jimpie
 Share

Recommended Posts

Hi

When I add the following packets:

> HandleDataSub(SMoveEditor) = GetAddress(AddressOf HandleMoveEditor)
>     HandleDataSub(SUpdateMove) = GetAddress(AddressOf HandleUpdateMove)

and compile, I'll get a subscript out of range error while logging in on the game.

>! ```
Private Sub HandleUpdateMove(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim n As Long
    Dim Buffer As clsBuffer
    Dim MoveSize As Long
    Dim MoveData() As Byte
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    n = Buffer.ReadLong
    ' Update the move
    MoveSize = LenB(Move(n))
    ReDim MoveData(MoveSize - 1)
    MoveData = Buffer.ReadBytes(MoveSize)
    CopyMemory ByVal VarPtr(Move(n)), ByVal VarPtr(MoveData(0)), MoveSize
    Set Buffer = Nothing
>! End Sub
``````
Private Sub HandleMoveEditor()
    Dim I As Long
>!     With frmEditor_Move
        'Editor = EDITOR_MOVE
        .lstIndex.Clear
>!         ' Add the names
        For I = 1 To MAX_MOVES
            .lstIndex.AddItem I & ": " & Trim$(Move(I).Name)
        Next
>!         .Show
        .lstIndex.ListIndex = 0
        ItemEditorInit
    End With
>! End Sub
```

can anybody help?
Link to comment
Share on other sites

> Private Sub HandleUpdateMove(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
>     Dim n As Long
>     Dim Buffer As clsBuffer
>     Dim MoveSize As Long
>     Dim MoveData() As Byte
>     Set Buffer = New clsBuffer
>     Buffer.WriteBytes Data()
>     n = Buffer.ReadLong
>     ' Update the move
>     MoveSize = LenB(Move(n))
>     ReDim MoveData(MoveSize - 1)
>     MoveData = Buffer.ReadBytes(MoveSize)
>   CopyMemory ByVal VarPtr(Move(n)), ByVal VarPtr(MoveData(0)), MoveSize
>     Set Buffer = Nothing
>
> End Sub
Link to comment
Share on other sites

@Ballie:

> Move is a VB6 keyword, for one. You'll likely not be able to use it.
>
> Since it's a subscript out of range, I venture to say your Move() array isn't dimmed high enough.

sorry, late reaction, but what do you mean by that? I've changed all "Move" to "PMove".

also, I've found this: ' The order of the packets must match with the client's packet enumeration

what does it exactly mean? Do I need to order the packets? Must I order everything the same in modEnumerations?
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...