Hello everyone :
I am in the process of writing code for a BBS screen creator, I have all of the code up on Github, but I am having problems with changing the colors of the display on the screen properly. The idea for the code for that part is that either the color changes or it does not. I will put in just the code that I use for displaying the text in color , I am reading in a text file and writing out @BBS codes, K-codes, Sauce and ANSI codes , those I have down but would like to convert a lot of it to case select and functions.
I have been programming for over 40 years but just have started to learn how to use functions with case select.
Here is the effected code:
DO UNTIL EOF(1)
LINE INPUT #1, lnumber
FOR i = 1 TO LEN(lnumber)
b = MID$(lnumber, i, 1) ' Calculates the ascii value of every character in the line
IF display = "ansi" THEN
GOSUB specialcharacters3
GOSUB specialcharacters2
IF flag$ = "Y1" THEN
GOSUB colorchange
COLOR t1, g1
x = g1
y = t1
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcoloransi + foregroundcoloransi + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y2" THEN
GOSUB colorchange
COLOR t2, g2
x = g2
y = t2
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcoloransi + foregroundcoloransi + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y3" THEN
GOSUB colorchange
COLOR t, g
x = g
y = t
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcoloransi + foregroundcoloransi + b;
PRINT b;
END IF
ELSE
IF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
END IF
IF display = "wc8" THEN
GOSUB specialcharacters3
GOSUB specialcharacters2
IF flag$ = "Y1" THEN
GOSUB colorchange
x = g1
y = t1
COLOR t1, g1
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorbbs + foregroundcolorbbs + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y2" THEN
GOSUB colorchange
x = g2
y = t2
COLOR t2, g2
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorbbs + foregroundcolorbbs + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y3" THEN
GOSUB colorchange
x = g
y = t
COLOR t, g
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorbbs + foregroundcolorbbs + b;
PRINT b;
END IF
ELSE
IF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
END IF
IF display = "pcb" THEN
GOSUB specialcharacters3
GOSUB specialcharacters2
IF flag$ = "Y1" THEN
GOSUB colorchange
COLOR t1, g1
x = g1
y = t1
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorpcb + foregroundcolorpcb + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y2" THEN
GOSUB colorchange
COLOR t2, g2
x = g2
y = t2
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorpcb + foregroundcolorpcb + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y3" THEN
GOSUB colorchange
COLOR t, g
x = g
y = t
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorpcb + foregroundcolorpcb + b;
PRINT b;
END IF
ELSE
IF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
END IF
IF display = "synchro" THEN
GOSUB specialcharacters3
GOSUB specialcharacters2
IF flag$ = "Y1" THEN
GOSUB colorchange
COLOR t1, g1
x = g1
y = t1
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorsynchro + foregroundcolorsynchro + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y2" THEN
GOSUB colorchange
COLOR t2, g2
x = g2
y = t2
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorsynchro + foregroundcolorsynchro + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y3" THEN
GOSUB colorchange
COLOR t, g
x = g
y = t
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolorsynchro + foregroundcolorsynchro + b;
PRINT b;
END IF
ELSE
IF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
END IF
IF display = "mystic" THEN
GOSUB specialcharacters3
GOSUB specialcharacters2
IF flag$ = "Y1" THEN
GOSUB colorchange
COLOR t1, g1
x = g1
y = t1
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolormystic + foregroundcolormystic + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y2" THEN
GOSUB colorchange
COLOR t2, g2
x = g2
y = t2
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolormystic + foregroundcolormystic + b;
PRINT b;
ELSEIF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
IF flag$ = "Y3" THEN
GOSUB colorchange
COLOR t, g
x = g
y = t
GOSUB displ
IF colorchanges = 1 THEN
PRINT #2, backgroundcolormystic + foregroundcolormystic + b;
PRINT b;
END IF
ELSE
IF colorchanges = 0 THEN
PRINT #2, b;
PRINT b;
END IF
END IF
END IF
NEXT i
PRINT #2, ""
PRINT
LOOP
fini:
closeit:
CLOSE #1
PRINT #2, "@0" + "7@";
COLOR 7, 0
IF menuchoice = "M" THEN
DO UNTIL EOF(3)
LINE INPUT #3, lnumber
PRINT #2, lnumber
PRINT lnumber
LOOP
ELSE
END IF
PRINT #2, "@0" + "7@"
CLOSE #2
CLOSE #3
COLOR 7, 0
PRINT
PRINT " Create another screen ? [Defaults to [Y]es : "
answer = INPUT$(1)
answer = UCASE$(answer)
IF answer = "N" THEN
GOSUB create
GOTO finish
ELSE
contlne = 0
CLEAR
GOTO rand
END IF
finish:
and the part that actually does the work:
colorchange:
IF flag$ = "Y1" THEN
g1 = x1
t1 = y1
colorchanges = 1
ELSEIF flag$ = "Y2" THEN
g2 = x2
t2 = y2
colorchanges = 1
ELSEIF flag$ = "Y3" THEN
g = z
t = q
colorchanges = 1
ELSE
g = z
t = q
colorchanges = 0
END IF
RETURN
This is just part of the code that I am having problems with , if I use numbers in the g1,t1,g2,t2,g,t variables it will work, but if I use a variable as the data for the initial variables , the program will not work. Any suggestions?
Russ Campbell
https://github.com/rcamp48/BBS-Screen-Menu-Creator-for-All-BBSs-Version-13-Beta-Release