Mirage Source
RTE 9: Subscript out of Range - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: RTE 9: Subscript out of Range (/showthread.php?tid=2611)



RTE 9: Subscript out of Range - Ciao - 10-03-2009

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?


Re: RTE 9: Subscript out of Range - GIAKEN - 10-03-2009

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



Re: RTE 9: Subscript out of Range - Ciao - 10-03-2009

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?


Re: RTE 9: Subscript out of Range - GIAKEN - 10-03-2009

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



Re: RTE 9: Subscript out of Range - Ciao - 10-03-2009

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


Re: RTE 9: Subscript out of Range - GIAKEN - 10-03-2009

download/file.php?id=251

Big Grin


Re: RTE 9: Subscript out of Range - Ciao - 10-03-2009

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.


Re: RTE 9: Subscript out of Range - Ciao - 10-03-2009

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