ok what the hek

this is about my paint program i am working on

for some reason, there is a weird subscript out of bounds error:

array is set in this block:
ASK PIXELS px,py
LET px=px+1
LET py=py+1
MAT redim colors(1,px,py,4)

and the error is in this block
FOR y=1 to py
FOR x=1 to px
FOR c=3 to 1 step -1
LET t$=str$(colors(1,x,y,c)) !at this line
...

note that the 4 in the redim and the first dimension of the array are for opacity when i add in the extra layer functions

Comments

Saving your program

I copied and ran this program and i got the same error. I was looking through your source code and i see where the program opens and is supposed to save but it seems to me that when it saves i think that you need to specify a directory to save it to. For example save the file to the desktop or to the same folder that the paint progam is in.

well it WAS working...

actually, it was working with my current save method(saves to the folder the program is in) but then the odd error started happening in the main program and it made no sense to me

maybe...

could true basic be running out of memory? i know that causes some errors

YEEEEESSSSSSSSSSSSSSSSSSS

thank goodness

my comp sci teacher and i found the problem during lunch, i should have made FUNCTION dth$ external, it used for x=... in it

Creating arrays ...

jackduffybailey ... You never created a multidimensional array variable (in your message). There needs to be at least a vacuous array program line like:

DIM m1(0,0)

for a 2D array. A 3D array would be declared if you were doing something in x,y,z space. 4D and beyond won't create a programming error; you would likely be a high-powered physicist or mathematician.

You need to consult your TB user manual on the array subject.

I have used a 4D array when I wrote a 3D animation program several years ago. The 4th dimension was used for creating PEN up/down commands. Regards ... Tom M

yea i do have a dim

yea i do have a dim at the start, i did not include it because it is irrelevant to the program because the array size is dependent on window size, and the part that makes it that size is shown here

code

this is the code up until it has an error(all subs are made and function properly)

DIM colors(1,1,1,4) !layers,xval,yval,rgboval(1=r,2=g,3=b,4=opacity from 0 to 1 as a decimal for percent)
DECLARE FUNCTION dth$

LET size=10 !defaults
LET tool=1
LET l=1

SET COLOR MIX(25) .5,.5,.5
SET BACK 25
CLEAR

OPEN#1:screen .3,.7,.2,.8 !paint window

ASK PIXELS px,py
LET px=px+1
LET py=py+1
MAT redim colors(1,px,py,4)

FOR rgb=1 to 3
FOR x=1 to px
FOR y=1 to py
LET colors(l,x,y,rgb)=255
NEXT y
NEXT x
NEXT rgb

FOR x=1 to px
FOR y=1 to py
LET colors(l,x,y,4)=1
NEXT y
NEXT x

SET WINDOW 1,px,1,py

OPEN#2:screen .025,.275,.274,.4025 !r window
PRINT rcolor
BOX AREA 0,0.01,0,0.5
BOX LINES 0,1,0,0.5

OPEN#3:screen .025,.15,.5,.9 !tools, planning on pencil, pen, airbrush,eraser and line
SET WINDOW 0,1,0,5
SET TEXT justify "center","half"
BOX LINES 0,1,4,5 !pencil
PLOT TEXT, AT 0.5,4.5: "Pencil"
BOX LINES 0,1,3,4 !pen
PLOT TEXT, AT 0.5,3.5: "Pen"
BOX LINES 0,1,2,3 !eraser
BOX LINES 0,1,1,2 !airbrush
PLOT TEXT, AT 0.5,1.5: "Airbrush"
BOX LINES 0,1,0,1 !line

OPEN#4:screen .75,.95,.85,.95 !save
PRINT "SAVE"
BOX LINES 0,1,0,1

OPEN#5:screen .025,.275,.1515,.2715 !g window
PRINT gcolor
BOX AREA 0,0.01,0,0.5
BOX LINES 0,1,0,0.5

OPEN#6:screen .025,.275,.025,.15 !b window
PRINT bcolor
BOX AREA 0,0.01,0,0.5
BOX LINES 0,1,0,0.5

OPEN#7:screen .3,.4,.05,.15 !rgb sample
SET BACK 0
CLEAR

DO
WINDOW #0
DO
GET MOUSE mx,my,mc
LOOP until mc<>0

IF mx>=.3 and mx<=.7 and my>=.2 and my<=.8 then !drawing window
WINDOW #1
GET MOUSE mx,my,mc
IF tool=1 then
CALL pencil
ELSEIF tool=2 then
CALL pen
ELSEIF tool=3 then
CALL eraser
ELSEIF tool=4 then
CALL airbrush
ELSEIF tool=5 then
CALL line
END IF
ELSEIF mx>=.025 and mx<=.15 and my>=.5 and my<=.9 then !tools
WINDOW #3
GET MOUSE mx,my,mc
IF my>=4 and my<=5 then !pencil
LET tool=1
ELSEIF my>=3 and my<4 then !pen
LET tool=2
ELSEIF my>=2 and my<3 then !eraser
ELSEIF my>=1 and my<2 then !airbrush
LET tool=4
ELSEIF my>=0 and my<1 then !line
END IF
ELSEIF mx>=.025 and mx<=.275 and my>=.025 and my<=.4025 then !rgb
CALL rgb
ELSEIF mx>=.75 and mx<=.95 and my>=.85 and my<=.95 then !save
WINDOW #4
LET done=0
LET name$=""
DO
CLEAR
BOX LINES 0,1,0,1
PRINT "Name:"
PRINT ">" ;name$; ".bmp"
GET KEY cheese

IF cheese=13 then
LET done=1
ELSEIF cheese=8 then
IF len(name$)>1 then
LET name$=name$[1:len(name$)-1]
ELSEIF len(name$)=1 then
LET name$=""
END IF
ELSE
WHEN error in
LET name$=name$ & chr$(cheese)
USE
END WHEN
END IF
LOOP until done=1

LET name$=name$ & ".bmp"

LET tlen=px*py*6
SET COLOR MIX(23) 79/255,1,26/255
FOR y=1 to py
FOR x=1 to px
FOR c=3 to 1 step -1
LET t$=str$(colors(1,x,y,c))

the last line of code contains the error

Re: DebuggingTB code errors ...

jackduffybailey ... There's no way I'm going to be able to debug your posted code. I need it all so I can run the full code and reveal the TB Editor error messages. I don't have the time to reverse enginner the program objectives. Regards ... Tom M

if thats all...

the main code:

LIBRARY "WRITE DATA.TRU"
DIM colors(1,1,1,4) !layers,xval,yval,rgboval(1=r,2=g,3=b,4=opacity from 0 to 1 as a decimal for percent)
DECLARE FUNCTION dth$

LET size=10 !defaults
LET tool=1
LET l=1

SET COLOR MIX(25) .5,.5,.5
SET BACK 25
CLEAR

OPEN#1:screen .3,.7,.2,.8 !paint window

ASK PIXELS px,py
LET px=px+1
LET py=py+1
MAT redim colors(1,px,py,4)

FOR rgb=1 to 3
FOR x=1 to px
FOR y=1 to py
LET colors(l,x,y,rgb)=255
NEXT y
NEXT x
NEXT rgb

FOR x=1 to px
FOR y=1 to py
LET colors(l,x,y,4)=1
NEXT y
NEXT x

SET WINDOW 1,px,1,py

OPEN#2:screen .025,.275,.274,.4025 !r window
PRINT rcolor
BOX AREA 0,0.01,0,0.5
BOX LINES 0,1,0,0.5

OPEN#3:screen .025,.15,.5,.9 !tools, planning on pencil, pen, airbrush,eraser and line
SET WINDOW 0,1,0,5
SET TEXT justify "center","half"
BOX LINES 0,1,4,5 !pencil
PLOT TEXT, AT 0.5,4.5: "Pencil"
BOX LINES 0,1,3,4 !pen
PLOT TEXT, AT 0.5,3.5: "Pen"
BOX LINES 0,1,2,3 !eraser
BOX LINES 0,1,1,2 !airbrush
PLOT TEXT, AT 0.5,1.5: "Airbrush"
BOX LINES 0,1,0,1 !line

OPEN#4:screen .75,.95,.85,.95 !save
PRINT "SAVE"
BOX LINES 0,1,0,1

OPEN#5:screen .025,.275,.1515,.2715 !g window
PRINT gcolor
BOX AREA 0,0.01,0,0.5
BOX LINES 0,1,0,0.5

OPEN#6:screen .025,.275,.025,.15 !b window
PRINT bcolor
BOX AREA 0,0.01,0,0.5
BOX LINES 0,1,0,0.5

OPEN#7:screen .3,.4,.05,.15 !rgb sample
SET BACK 0
CLEAR

DO
WINDOW #0
DO
GET MOUSE mx,my,mc
LOOP until mc<>0

IF mx>=.3 and mx<=.7 and my>=.2 and my<=.8 then !drawing window
WINDOW #1
GET MOUSE mx,my,mc
IF tool=1 then
CALL pencil
ELSEIF tool=2 then
CALL pen
ELSEIF tool=3 then
CALL eraser
ELSEIF tool=4 then
CALL airbrush
ELSEIF tool=5 then
CALL line
END IF
ELSEIF mx>=.025 and mx<=.15 and my>=.5 and my<=.9 then !tools
WINDOW #3
GET MOUSE mx,my,mc
IF my>=4 and my<=5 then !pencil
LET tool=1
ELSEIF my>=3 and my<4 then !pen
LET tool=2
ELSEIF my>=2 and my<3 then !eraser
ELSEIF my>=1 and my<2 then !airbrush
LET tool=4
ELSEIF my>=0 and my<1 then !line
END IF
ELSEIF mx>=.025 and mx<=.275 and my>=.025 and my<=.4025 then !rgb
CALL rgb
ELSEIF mx>=.75 and mx<=.95 and my>=.85 and my<=.95 then !save
WINDOW #4
LET done=0
LET name$=""
DO
CLEAR
BOX LINES 0,1,0,1
PRINT "Name:"
PRINT ">" ;name$; ".bmp"
GET KEY cheese

IF cheese=13 then
LET done=1
ELSEIF cheese=8 then
IF len(name$)>1 then
LET name$=name$[1:len(name$)-1]
ELSEIF len(name$)=1 then
LET name$=""
END IF
ELSE
WHEN error in
LET name$=name$ & chr$(cheese)
USE
END WHEN
END IF
LOOP until done=1

LET name$=name$ & ".bmp"

LET tlen=px*py*6
SET COLOR MIX(23) 79/255,1,26/255
FOR y=1 to py
FOR x=1 to px
FOR c=3 to 1 step -1
LET t$=str$(colors(1,x,y,c))
LET temp$=temp$ & dth$(t$)
SET COLOR 23
BOX AREA 0,len(temp$)/tlen,0,.25
SET COLOR 0
BOX LINES 0,1,0,1
NEXT c
NEXT x
DO until (len(temp$)/2)/4=int((len(temp$)/2)/4)
LET temp$=temp$ & "00"
LOOP
NEXT y

CALL save(name$,px,py,temp$)
SET COLOR "black"
CLEAR
PRINT "SAVE"
BOX LINES 0,1,0,1
END IF
LOOP

SUB pencil
DO
GET MOUSE mx,my,mc
IF mx>=1 and my>=1 and mx=<px and my<=py then
SET COLOR MIX(22) rcolor/255,gcolor/255,bcolor/255
SET COLOR 22
PLOT mx,my;
LET colors(l,mx,my,1)=rcolor
LET colors(l,mx,my,2)=gcolor
LET colors(l,mx,my,3)=bcolor
ELSE
IF mx<1 or mx>px then
IF mx>px then
LET mx=px
ELSE
LET mx=1
END IF
END IF

IF my<1 or my>py then
IF my>py then
LET my=py
ELSE
LET my=1
END IF
END IF

SET COLOR MIX(22) rcolor/255,gcolor/255,bcolor/255
SET COLOR 22
PLOT mx,my;
LET colors(l,mx,my,1)=rcolor
LET colors(l,mx,my,2)=gcolor
LET colors(l,mx,my,3)=bcolor
END IF
LOOP until mc=0
PLOT mx,my
END SUB

SUB pen
DO
GET MOUSE mx,my,mc
FOR s=0 to size
LET bcx=-1
LET bcy=-1

FOR d=1 to 360
LET cx=int((s*cos(d+90))+mx)
LET cy=int((s*sin(d+90))+my)

IF cx>=1 and cy>=1 and cx=<px and cy<=py then
IF cy<>bcy or cx<>bcx then
LET bcx=cx
LET bcy=cy

LET colors(l,cx,cy,1)=rcolor
LET colors(l,cx,cy,2)=gcolor
LET colors(l,cx,cy,3)=bcolor

SET COLOR MIX(22) colors(l,cx,cy,1)/255,colors(l,cx,cy,2)/255,colors(l,cx,cy,3)/255
SET COLOR 22
PLOT cx,cy
END IF
END IF
NEXT d
NEXT s
LOOP until mc=0
END SUB

SUB eraser

END SUB

SUB airbrush
WINDOW #1
OPTION ANGLE degrees
DO
GET MOUSE mx,my,mc

IF mx>=1 and my>=1 and mx<=px and my<=py then
LET colors(l,mx,my,1)=rcolor
LET colors(l,mx,my,2)=gcolor
LET colors(l,mx,my,3)=bcolor
SET COLOR MIX(22) colors(l,mx,my,1)/255,colors(l,mx,my,2)/255,colors(l,mx,my,3)/255
SET COLOR 22
PLOT mx,my
END IF

FOR s=0 to size
LET bcx=-1
LET bcy=-1

LET opac=1-(s/size)

FOR d=1 to 360
LET cx=int((s*cos(d+90))+mx)
LET cy=int((s*sin(d+90))+my)

IF cx>=1 and cy>=1 and cx=<px and cy<=py then
IF cy<>bcy or cx<>bcx then
LET bcx=cx
LET bcy=cy

LET colors(l,cx,cy,1)=int(colors(l,cx,cy,1)+(opac*(rcolor-colors(l,cx,cy,1))))
LET colors(l,cx,cy,2)=int(colors(l,cx,cy,2)+(opac*(gcolor-colors(l,cx,cy,2))))
LET colors(l,cx,cy,3)=int(colors(l,cx,cy,3)+(opac*(bcolor-colors(l,cx,cy,3))))

SET COLOR MIX(22) colors(l,cx,cy,1)/255,colors(l,cx,cy,2)/255,colors(l,cx,cy,3)/255
SET COLOR 22
PLOT cx,cy
END IF
END IF
NEXT d
NEXT s
LOOP until mc=0
END SUB

SUB line

END SUB

SUB rgb
!.025,.275,.274,.4025
!.025,.275,.1515,.2715
!.025,.275,.025,.15
DO
WINDOW #0
GET MOUSE mx,my,mc

IF mc>0 then
IF mx>=.025 and mx<=.275 and my>=.274 and my<=.4025 then !r
WINDOW #2
GET MOUSE mx,my,mc

CLEAR
SET COLOR 0

PRINT rcolor
BOX LINES 0,1,0,0.5

IF mx<0.005 then
BOX AREA 0,0.01,0,0.5
LET rcolor=0
ELSEIF mx>=0.005 and mx<=0.995 then
BOX AREA mx-0.005,mx+0.005,0,0.5
LET rcolor=round(mx*255)
ELSE
BOX AREA 0.995,1,0,0.5
LET rcolor=255
END IF
ELSEIF mx>=.025 and mx<=.275 and my>=.1515 and my<=.2715 then !g
WINDOW #5
GET MOUSE mx,my,mc

CLEAR
SET COLOR 0

PRINT gcolor
BOX LINES 0,1,0,0.5

IF mx<0.005 then
BOX AREA 0,0.01,0,0.5
LET gcolor=0
ELSEIF mx>=0.005 and mx<=0.995 then
BOX AREA mx-0.005,mx+0.005,0,0.5
LET gcolor=round(mx*255)
ELSE
BOX AREA 0.995,1,0,0.5
LET gcolor=255
END IF
ELSEIF mx>=.025 and mx<=.275 and my>=.025 and my<=.15 then !b
WINDOW #6
GET MOUSE mx,my,mc

CLEAR
SET COLOR 0

PRINT bcolor
BOX LINES 0,1,0,0.5

IF mx<0.005 then
BOX AREA 0,0.01,0,0.5
LET bcolor=0
ELSEIF mx>=0.005 and mx<=0.995 then
BOX AREA mx-0.005,mx+0.005,0,0.5
LET bcolor=round(mx*255)
ELSE
BOX AREA 0.995,1,0,0.5
LET bcolor=255
END IF
END IF
END IF
WINDOW #7
SET COLOR MIX(22) rcolor/255,gcolor/255,bcolor/255
SET BACK 22
CLEAR
LOOP until mc=0
END SUB

FUNCTION dth$(decimal$)
LET n=-1
DO
LET n=n+1
LOOP until 16^n>val(decimal$)

LET n=n-1
LET decimal=val(Decimal$)

FOR x=n to 0 step -1
IF 16^x<=decimal then
IF 2*(16^x)<=decimal then
IF 3*(16^x)<=decimal then
IF 4*(16^x)<=decimal then
IF 5*(16^x)<=decimal then
IF 6*(16^x)<=decimal then
IF 7*(16^x)<=decimal then
IF 8*(16^x)<=decimal then
IF 9*(16^x)<=decimal then
IF 10*(16^x)<=decimal then
IF 11*(16^x)<=decimal then
IF 12*(16^x)<=decimal then
IF 13*(16^x)<=decimal then
IF 14*(16^x)<=decimal then
IF 15*(16^x)<=decimal then
LET hex$=hex$ & "F"
LET decimal=decimal-15*(16^x)
ELSE
LET hex$=hex$ & "E"
LET decimal=decimal-14*(16^x)
END IF
ELSE
LET hex$=hex$ & "D"
LET decimal=decimal-13*(16^x)
END IF
ELSE
LET hex$=hex$ & "C"
LET decimal=decimal-12*(16^x)
END IF
ELSE
LET hex$=hex$ & "B"
LET decimal=decimal-11*(16^x)
END IF
ELSE
LET hex$=hex$ & "A"
LET decimal=decimal-10*(16^x)
END IF
ELSE
LET hex$=hex$ & "9"
LET decimal=decimal-9*(16^x)
END IF
ELSE
LET hex$=hex$ & "8"
LET decimal=decimal-8*(16^x)
END IF
ELSE
LET hex$=hex$ & "7"
LET decimal=decimal-7*(16^x)
END IF
ELSE
LET hex$=hex$ & "6"
LET decimal=decimal-6*(16^x)
END IF
ELSE
LET hex$=hex$ & "5"
LET decimal=decimal-5*(16^x)
END IF
ELSE
LET hex$=hex$ & "4"
LET decimal=decimal-4*(16^x)
END IF
ELSE
LET hex$=hex$ & "3"
LET decimal=decimal-3*(16^x)

END IF
ELSE
LET hex$=hex$ & "2"
LET decimal=decimal-2*(16^x)
END IF
ELSE
LET hex$=hex$ & "1"
LET decimal=decimal-16^x
END IF
ELSE
LET hex$=hex$ & "0"
END IF
NEXT x
DO until len(hex$)/2=int(len(hex$)/2)
LET hex$="0" & hex$
LOOP
LET dth$=hex$
END FUNCTION
END

and the library "write data":

EXTERNAL

!bytes 0-1 file header (BM)
!bytes 2-5 size in bytes note that the bytes are in reversed order: a file 250,054 bytes would not be (00 03 d0 c6)h, but it would be (c6 d0 03 00)h
!bytes 6-7 reserved; actual value depends on the application that creates the image
!bytes 8-9 reserved; actual value depends on the application that creates the image
!bytes 10-13 starting address, of the byte where the bitmap data can be found
!bytes 14-17 (28 00 00 00)h
!bytes 18-21 x size (remember it's reversed)
!bytes 22-25 y size (remember it's reversed)
!bytes 26-27 01 00
!bytes 28-29 the number of bits per pixel, which is the color depth of the image. use 24: 18h so 18 00
!bytes 30-33 compression method, use 00 00 00 00 for no compression
!bytes 34-37 the image size. This is the size of the raw bitmap data, and should not be confused with the file size.
!bytes 38-41 the horizontal resolution of the image. (pixel per meter, signed integer), use 13 0B 00 00
!bytes 42-45 the vertical resolution of the image. (pixel per meter, signed integer), use 13 0B 00 00
!bytes 46-49 the number of colors in the color palette, or 0 to default to 2n.
!bytes 50-53 the number of important colors used, or 0 when every color is important; generally ignored.

SUB save(n$,sx,sy,d$)
DECLARE FUNCTION htd
DIM fs(3),tfs(3),dx(3),dy(3)

OPEN#1: NAME n$ ,ORG byte, ACCESS outin, CREATE newold
ERASE #1

!finding the file size
LET temp=len(d$)/2
FOR x=3 to 0 step -1
LET s=0
DO until temp<16^x
LET s=s+1
LET temp=temp-16^x
LOOP
LET fs(x)=s*(16^x)
NEXT x

!finding the total file size
LET temp=len(d$)/2+54
FOR x=3 to 0 step -1
LET s=0
DO until temp<16^x
LET s=s+1
LET temp=temp-16^x
LOOP
LET fs(x)=s*(16^x)
NEXT x

LET temp=sx !x width
FOR x=3 to 0 step -1
LET s=0
DO until temp<16^(4-x)
LET s=s+1
LET temp=temp-16^(4-x)
LOOP
LET dx(x)=s*(16^(4-x))
NEXT x

LET temp=sy !y width
FOR y=3 to 0 step -1
LET s=0
DO until temp<16^y
LET s=s+1
LET temp=temp-16^y
LOOP
LET dy(y)=s*(16^y)
NEXT y

CLEAR
SET COLOR MIX(23) 79/255,1,26/255
PRINT "SAVE"
SET COLOR 0
BOX LINES 0,1,0,1
PRINT "Name:"
PRINT ">" ;name$

FOR x=1 to len(d$) step 2
LET t$=t$ & chr$(htd(d$[x:x+1]))
SET COLOR 23
BOX AREA 0,len(t$)/(len(d$)/2),0,.25
SET COLOR 0
BOX LINES 0,1,0,1
NEXT x

LET temp$="BM" !0-1
LET temp$=temp$ & chr$(tfs(1)) & chr$(tfs(2)) & chr$(tfs(3)) & chr$(tfs(4)) !2-5
LET temp$=temp$ & chr$(0) & chr$(0) & chr$(0) & chr$(0) !6-9
LET temp$=temp$ & chr$(54) & chr$(0) & chr$(0) & chr$(0) !10-13
LET temp$=temp$ & chr$(40) & chr$(0) & chr$(0) & chr$(0) !14-17
LET temp$=temp$ & chr$(dx(1)) & chr$(dx(2)) & chr$(dx(3)) & chr$(dx(4)) & chr$(dy(1)) & chr$(dy(2)) & chr$(dy(3)) & chr$(dy(4)) !18-25
LET temp$=temp$ & chr$(1) & chr$(0) !26-27
LET temp$=temp$ & chr$(24) & chr$(0) !28-29
LET temp$=temp$ & chr$(0) & chr$(0) & chr$(0) & chr$(0) !30-33
LET temp$=temp$ & chr$(fs(1)) & chr$(fs(2)) & chr$(fs(3)) & chr$(fs(4)) !34-37
LET temp$=temp$ & chr$(19) & chr$(11) & chr$(0) & chr$(0) & chr$(19) & chr$(11) & chr$(0) & chr$(0) !38-45
LET temp$=temp$ & chr$(0) & chr$(0) & chr$(0) & chr$(0) !46-49
LET temp$=temp$ & chr$(0) & chr$(0) & chr$(0) & chr$(0) !50-53
LET temp$=temp$ & t$
WRITE #1: temp$
END SUB

FUNCTION htd(hex$)
LET length=len(hex$)
FOR n=(length-1) to 0 step -1

IF hex$[length-n:length-n]="0" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="1" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="2" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="3" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="4" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="5" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="6" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="7" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="8" then
LET num=val(hex$[length-n:length-n])
ELSEIF hex$[length-n:length-n]="9" then
LET num=val(hex$[length-n:length-n])
ELSEIF lcase$(hex$[length-n:length-n])="a" then
LET num=10
ELSEIF lcase$(hex$[length-n:length-n])="b" then
LET num=11
ELSEIF lcase$(hex$[length-n:length-n])="c" then
LET num=12
ELSEIF lcase$(hex$[length-n:length-n])="d" then
LET num=13
ELSEIF lcase$(hex$[length-n:length-n])="e" then
LET num=14
ELSEIF lcase$(hex$[length-n:length-n])="f" then
LET num=15
END IF

LET decimal=num*(16^n)+decimal
NEXT n
LET htd=decimal
END FUNCTION

when it happens

the error occurs when you try to save after pressing enter at name input

At line 139, x is -1 when

At line 139, x is -1 when you save.

Roger

i know, read my last reply on the first part

yes yes, i found that all out today at lunch with my comp sci teacher