Jump to content
  • Advertisement
Sign in to follow this  
cdeathjd

blitz3d code not wrong but program is :s

This topic is 3750 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Dim poem_db$(4096,2048,1024) ; Open the file to Read ; WE ARE NOW IN READ MODE (LOADING) Global c_POEM=1 Global c_STANZA=0 Global c_LINE=0 filein = ReadFile("TEXTFILE.TXT") c_POEM=c_POEM+1 c_STANZA=1 C_LINE=1 While Eof(filein)=0 Read1$ = ReadLine(filein) poem_db$(c_POEM,c_STANZA,c_LINE)=Read1$ c_LINE=c_LINE+1 Wend ; Close the file once reading is finished CloseFile( filein ) --------------------------------------------------------------------- blitz3d says "poem_db$(c_POEM,c_STANZA,c_LINE)=Read1$" make the "array index out of bounds", however at the variables are well inside those set in the DIM statement so... wtf is it doing?

Share this post


Link to post
Share on other sites
Advertisement
looks to me like it's c_LINE which is causing the problem.

It's difficult to test without your poem text file.



I'm not sure why youve set your variable c_poem to 1. Theres nothing wrong with it, it's just usual to set indexes to 0, ie, at the start of the array.

Global c_POEM=1
Global c_STANZA=0
Global c_LINE=0

and here you set them again ?

c_POEM=c_POEM+1
c_STANZA=1
C_LINE=1

so, c_POEM becomes 2

Doesnt look necesesary to me, but then again it shouldn't present a problem.


My advice would be to rewrite the code slightly to use a 1 dimensionaly array.

When thats working, expand the code to a two dimensional array and then when thats working to change to the 3 dimensional array code you have here.


The problem probably lies with your text file.
You could also try reducing your array sizes, as this might be the error which blitz isn't reporting.

KJM

Share this post


Link to post
Share on other sites
I'm not sure if Blitz3D is case specific but you have used a capital 'C' for the second use of c_line.

Regards,
Adam

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!