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.

Newcomers DBPro Corner / New...DBC problem...matrix coordinates.

Author
Message
Dirtman
18
Years of Service
User Offline
Joined: 20th Sep 2006
Location:
Posted: 20th Sep 2006 16:28
Hi,

Being new to this, I'm making a lot of simple mistakes. But that's all part of the learning process. Here is the first one I couldn't cure on my own.

I'm getting the following error message: Runtime error at line 337. Matrix coordinate does not exist at line 337

Here is the code that pertains:



(In that code block, the line 'next y' is the one numbered 337 according to darkedit.)

(And I realise it's technically 'z' and not 'y' but I think in 2D...)

Now, the matrix appears to draw OK -- I can see it and it's textured correctly as far as I can tell, and with the correct number of cells. So I don't see what the problem is. Also, any other command placed on the offending line causes the same problem -- I tried putting in print statements for debugging and it caused the same error on the same line.

Different values for xdim and ydim do not change the error and they appear to draw correctly regardless of the value. Different values of fieldsize# do cause non-drawing if small enough, but I think that is not related to my problem.

If anyone can point out what I'm doing wrong, I'd be very appreciative. I have little enough hair left as it is!

Cheers, and thanks in advance.

We don't need no stinking badgers.
Crit
18
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 20th Sep 2006 20:19
I've never used a matrix before, but based on what I've seen on the forum, this should work:



CHESS ENCOUNTER
Demo
WIP
D Ogre
20
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 20th Sep 2006 22:54
Crit is correct. The matrix always starts with zero (0,0) being the first tile.
Just make sure that you check for a limit if you increment the tile texture
within your nested loop. So, if you divide the texture into 4 pieces using
PERPARE MATRIX TEXTURE 1, mat_texture, 2, 2, you do something like this:


Of course the limit would be whatever you divided the texture up into...
Dirtman
18
Years of Service
User Offline
Joined: 20th Sep 2006
Location:
Posted: 21st Sep 2006 00:59
Aha! The old '0 = 1' trick. And I fell for it! I knew it would be something simple.

D Ogre, I did have a four-tile texture with random designation to each matrix tile but decided to leave that out until the rest of it worked. Happily, it does now, so I'm back to weeding out mistakes that I can identify myself...

Thank you both for the help; my remaining hairs also thank you.

D

We don't need no stinking badgers.

Login to post a reply

Server time is: 2024-11-12 13:51:01
Your offset time is: 2024-11-12 13:51:01