Variable trouble

Nick
Nick

August 1st, 2009, 6:21 am #1

ok, I'll try not to make this too long...

I'm working on a CAD ish program and so far so good cept this

right now I'm just useing lines and have this (shortend for simplification purposes):

screen 7,0,1,0

vr = 1
DO

'user draws a line:

LINE (x1,y1)-(x2,y2), 14

'data of the line gets stored

lin1(vr) = x1
lin2(vr) = y1
lin3(vr) = x2
lin4(vr) = y2

and then to show the line drawn (and other lines drawn afterwards)
cls
lp = vr
DO WHILE lp > 0
LINE (lin1(lp), lin2(lp)) - (lin3(lp), lin4(lp)), 14
lp = lp - 1
LOOP

PCOPY 1,0
LOOP

****************************************************************---


every thing works, it draws multiples lines and shows them all.. that is, untill i reach 10 lines
to which i get the message "subscript out of range"
and highlights the "LINE (lin1(lp), lin2(lp)) - (lin3(lp), lin4(lp)), 14"

I'm %90 shure it's the lp varialbe that seems to have a problem going into the double digits.
but i also know for a fact the vr variable has no problem going over that #

anybody know why that might be and how I could fix it?

if you need more info feel free to ask

cheers!
Quote
Share

Joined: February 2nd, 2006, 10:38 pm

August 1st, 2009, 6:57 am #2

*Ya gotta DIM those arrays after 10. Those aren't just variables.
Quote
Like
Share

Galleon
Galleon

August 1st, 2009, 9:17 am #3

DIM lin1(1000)
DIM lin2(1000)
DIM lin3(1000)
DIM lin4(1000)
Quote
Share

Nick
Nick

August 3rd, 2009, 4:04 am #4

Ahhh ok.

thanks!
Quote
Share