Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Array does not exist (or out of bound, etc etc)

Author
Message
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 10th Sep 2010 22:42 Edited at: 10th Sep 2010 22:48
Hi,

I haven't posted here in a while. Truth is, I'm an avid player of Lord of The Rings Online, and most of my free time has been spent on that instead of trying to wrap my head around DarkBasic (!)

Now that that is out of the way.. I am running into the problem in the thread title (Array does not exist or out of bounds....) when I compile (successfully) and then run the code I am testing out.

This is TDK's scrolling text box code, he so kindly provided to me with detailed comments. Since I was in the mood to try and fuss with DB and see if I could accomplish my goal of getting the basic text rendering of my game complete, I copied his code by hand, only changing some variable names and writing in my own personalized comments.

As far as I know, I don't have any naming errors, and changed everything over completely, nor do I have any naming conflicts? But I get this error when I run the program. It points to line #113 in my dedicated include file for custom Functions, but the code on that line is exactly the same except for the changes in variables, and also my removal of specifying a "Window Number" in every piece of code I could find it (since I'm only working with 1 text window realistically).

I don't understand why the error is occuring, but was hoping someone (or TDK himself) might be able to spot an easily overlooked error on my part.


As I was just testing things and playing around with ideas, I also split the original function into 2 separate functions - but I am pretty sure I did a quick re-combine of my original code into a single function, and still got the same error... so I'm not sure that splitting the function in half was the problem (or maybe the way I did it?).

edit: sorry the post is messed up..I am adding the appropriate code now

Here is TDK's original commented code he gave to me.


Here is my main source file


Here is my functions include file


The board screwed up a little of the formatting (indentations) but that's about it.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Sep 2010 01:35
The best way to solve this is to insert some code inside the suspect loop such as



You'll obviously need to experiment with the values - but you'll have a far better idea than any of us where to look and what the output means. For example you might find that one of the variousThings has a completely unexpected value. If so, then work back from there.

Things like that will help you isolate roughly where the error occurs and then you can check in more detail to see which specific variable or operation has gone wrong.
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 11th Sep 2010 04:55
Thanks for your suggestion.
I will see about giving it a shot tomorrow some time after I get home from work, and see if I can't isolate the issue that way..

I know using the built in debugger, etc and its various monitoring tools, is all greek to me.

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 11th Sep 2010 07:07
Array does not exist or out of bounds

This means what it says exactly.Or you renamed some array with a typo or you are trying to write or read from beyound the array lenght.Are you renamed all by hand?Do you used Find and Replace function of the editor?Can you find the suspicious array which is giving trouble and increase it's lenght so you are absolutely sure that you aren't trying to read/write something outside of array boundary?Also GG's suggestion is maybe best option for something more complicated.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 11th Sep 2010 21:14
Yeah I did everything by hand.

I hand copied everything save a few things, figured it was the best way to drill what is going on into my brain so I can retain that knowledge of how its working.

I looked over it as best I could, several times but I was tired so maybe I missed something. If need be I'll do it again and just use find/replace to rename stuff

Login to post a reply

Server time is: 2026-07-22 12:41:19
Your offset time is: 2026-07-22 12:41:19