Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RTE 9: Subscript out of Range
#1
Public Sub CheckSprites()
Dim i As Long

i = 1

While FileExist(GFX_PATH & "sprites\" & i & GFX_EXT)
NumSprites = NumSprites + 1
i = i + 1
Wend

ReDim DDS_Sprite(1 To NumSprites)
ReDim DDSD_Sprite(1 To NumSprites)

ReDim SpriteTimer(1 To NumSprites)

End Sub

It highlights the part of the code thats red.

Any ideas on what to do to fix this error?
Reply
#2
Change i = 1 to i = 0 and

While FileExist(GFX_PATH & "sprites\" & i & GFX_EXT)

To

While FileExist(GFX_PATH & "sprites\" & i + 1 & GFX_EXT)

Then make a check like:

Code:
If i < 1 Then
    MsgBox "You are missing sprite files!"
    GameDestroy
End If
Reply
#3
I found the problem, the problem is that Tony's image splitter renames the images as sprite0, sprite1 and so on but the sprites should be called 0,1,2 and shouldn't have "sprite" in the file name for them to be MS4 Compatible, so would you be able to change the code so that it allows it to work if the sprites are named sprite0,sprite1 and so on instead of just the numbers, like: 0,1,2 and so on?
Reply
#4
Yeah just open the image splitter source and change this:

Code:
SavePicture frmMain.picConversion.Image, App.Path & "\Splitted Images\sprite" & i & Extension

To this:

Code:
SavePicture frmMain.picConversion.Image, App.Path & "\Splitted Images\" & i & Extension
Reply
#5
Got it, im so stupid I forgot that the source was uploaded too because lately i've been checking around different forums and I sometimes get mixed up between them. Thank you so much for your help and patience so far. I really really appreciate the time you sacrificed to help me Big Grin
Reply
#6
download/file.php?id=251

Big Grin
Reply
#7
Thanks, blah i've been editing my client lately but ever since I added the graphics I get errors.
Do you know what I should do when I get a "Error Rendering Graphics: The rectangle was invalid. " Error?
I checked the forums and used the search bar but I couldn't find anyone who had the same error.
Reply
#8
Nevermind fixed it, everythings fixed now.
Thanks for you time Big Grin

I really appreciated it and I hope I can help you out in the future.
Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)