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 Discussion / Array Question / Error

Author
Message
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 15th Oct 2007 01:47
I just fixed a bug in my program that related to the use of arrays and I can't replicate it again but here is what was happening:

I dimensioned 2 arrays PathX(x,y) and PathZ(x,y)

Then I saved a set of values to PathX(num,all values here) and PathZ(num,all values here). Then if I printed the all the values in the arrays, I could see that if num was even, then the values of PathX(x,all values here) and PathZ(x,all values here) would be equal to PathX(num,all values here) and PathZ(num,all values here) for all even numbers x. And vice-versa for odd values of x.

I hope that makes sense, but has anyone heard of this happening before? I know it sounds strange but am 100% sure it was not an error I made and the only things I changed to fix it were the ways the arrays PathX() and PathZ() were dimensioned.
Comrade Robski
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 15th Oct 2007 13:37
Hi luke - never seen a problem like this before - often I think I've found a new bug in DBC or experience some crazy behaviour like you describe, but for me it always turns out i've made a typing error somewhere.

Remember in your case the problem may be with the code that fills the the arrays with data - it's pretty easy to get an x and z mixed up, or something along those lines.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 16th Oct 2007 03:30
I though it might have been a strange for next loop, so I removed all the loops and tried again, it still happened. The changes I made to the code to fix it were only in the way the arrays were defined. They were previously based on a value inserted into another array from a function that set the value of said array, and I changed it from that and it went away. I tried replicating it but I can't remember exactly what I changed. I'm going to try again tonight.

Login to post a reply

Server time is: 2025-05-31 20:54:17
Your offset time is: 2025-05-31 20:54:17