Ok so ive made this q basic instant messenger for my school, hah im only a junior, lol. and if you copy it and paste it onto a word pad and save it as a .bas file you can run it. its pretty simple but after a few messages have been sent, it stops the program and says cannot execute or something can i get some help on this part. oh and to talk between two qbasic windows open it up twice and login as two different people.
DECLARE SUB tu ()
DECLARE SUB online ()
DECLARE SUB im (name$)
DECLARE SUB nu ()
DECLARE SUB login (name$)
DO
CLS
RESTORE names
LOCATE 1, 36
PRINT "QBIM"
PRINT
LOCATE 3, 10
PRINT "x = exit h = help"
PRINT
PRINT
LOCATE 6, 16
PRINT "1. login"
LOCATE 7, 16
PRINT "2. People on"
LOCATE 8, 16
PRINT "3. New profile"
LOCATE 9, 16
PRINT
PRINT
LOCATE 10, 16
INPUT " Please type in the number of what you want to do"; d$
IF d$ = "3" THEN
CLS
CALL nu
ELSEIF d$ = "1" THEN
CALL login(name$)
ELSEIF d$ = "2" THEN
PRINT
READ on$
DO
OPEN on$ + ".txt" FOR INPUT AS #1
INPUT #1, name$
INPUT #1, no$
INPUT #1, no$
INPUT #1, o
CLOSE #1
IF o = 1 THEN
COLOR 18, 0
PRINT name$; " On ";
COLOR 7, 0
ELSEIF o = 0 THEN
PRINT name$; " off ";
END IF
READ on$
LOOP UNTIL on$ = "xxx"
DO
LOOP WHILE INKEY$ = ""
ELSEIF d$ = "x" THEN
END
ELSE
PRINT " Type in a valid character"
PRINT
PRINT " Hit any key to continue"
DO
LOOP WHILE INKEY$ = ""
END IF
LOOP WHILE 1 = 1
names:
DATA Dustin
DATA Korey
DATA Tucker
DATA Tyler
DATA Kayhil
DATA xxx
SUB im (name$)
OPEN name$ + ".txt" FOR INPUT AS #1
INPUT #1, name$
INPUT #1, pass$
INPUT #1, t$
INPUT #1, o
CLOSE #1
CLS
DO
LOCATE 1, 36
PRINT name$; " QBIM"
LOCATE 12, 5
PRINT "1. Talk "
PRINT
LOCATE 14, 5
PRINT "2. Logout"
PRINT
INPUT " Type in the character of your selection"; s$
IF s$ = "1" THEN
CLS
PRINT " The name must be exactly as show in main menu."
PRINT
INPUT " The name of the person you wish to talk to"; talk$
CLS
REM **************** reply/// send message *********************
DO
INPUT "Reply"; t2$
OPEN name$ + ".txt" FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t2$
WRITE #1, 1
CLOSE #1
REM **************** Recieve message **************************
check:
OPEN talk$ + ".txt" FOR INPUT AS #1
INPUT #1, name1$
INPUT #1, no$
INPUT #1, t1$
INPUT #1, o
CLOSE #1
tc1$ = t1$
IF tp$ = tc1$ THEN
GOTO check
ELSE
PRINT name1$; ": "; t1$
PRINT
tp$ = t1$
END IF
LOOP WHILE INKEY$ <> "q"
ELSEIF s$ = "2" THEN
OPEN name$ + ".txt" FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t$
WRITE #1, 0
CLOSE #1
GOTO logout
END IF
LOOP WHILE 1 = 1
logout:
END SUB
SUB login (name$)
INPUT " Your user name"; un$
login2$ = un$ + ".txt"
OPEN login2$ FOR INPUT AS #1
INPUT #1, name$
INPUT #1, pass$
CLOSE #1
IF un$ = name$ THEN
PRINT
PRINT " Welcome "; name$
PRINT
pass:
INPUT " Password"; p$
IF p$ = pass$ THEN
PRINT " You are now logged on"
OPEN name$ + ".txt" FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t$
WRITE #1, 1
CLOSE #1
PRINT
PRINT " Hit any key to continue"
DO
LOOP WHILE INKEY$ = ""
ELSE
GOTO pass
END IF
END IF
CALL im(name$)
END SUB
SUB nu
INPUT " Your name that you wish to use"; name$
PRINT
redo:
INPUT " Your password that you wish to use"; pass$
PRINT
INPUT " Confirm your password"; passc$
IF pass$ = passc$ THEN
user$ = name$ + ".txt"
OPEN user$ FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t$
WRITE #1, o
CLOSE #1
ELSE
GOTO redo
END IF
PRINT
PRINT "Thank you for registering"
PRINT
PRINT "Hit any key to continue"
DO
LOOP WHILE INKEY$ = ""
END SUB
DECLARE SUB tu ()
DECLARE SUB online ()
DECLARE SUB im (name$)
DECLARE SUB nu ()
DECLARE SUB login (name$)
DO
CLS
RESTORE names
LOCATE 1, 36
PRINT "QBIM"
LOCATE 3, 10
PRINT "x = exit h = help"
LOCATE 6, 16
PRINT "1. login"
LOCATE 7, 16
PRINT "2. People on"
LOCATE 8, 16
PRINT "3. New profile"
LOCATE 9, 16
LOCATE 10, 16
INPUT " Please type in the number of what you want to do"; d$
IF d$ = "3" THEN
CLS
CALL nu
ELSEIF d$ = "1" THEN
CALL login(name$)
ELSEIF d$ = "2" THEN
READ on$
DO
OPEN on$ + ".txt" FOR INPUT AS #1
INPUT #1, name$
INPUT #1, no$
INPUT #1, no$
INPUT #1, o
CLOSE #1
IF o = 1 THEN
COLOR 18, 0
PRINT name$; " On ";
COLOR 7, 0
ELSEIF o = 0 THEN
PRINT name$; " off ";
END IF
READ on$
LOOP UNTIL on$ = "xxx"
DO
LOOP WHILE INKEY$ = ""
ELSEIF d$ = "x" THEN
END
ELSE
PRINT " Type in a valid character"
PRINT " Hit any key to continue"
DO
LOOP WHILE INKEY$ = ""
END IF
LOOP WHILE 1 = 1
names:
DATA Dustin
DATA Korey
DATA Tucker
DATA Tyler
DATA Kayhil
DATA xxx
SUB im (name$)
OPEN name$ + ".txt" FOR INPUT AS #1
INPUT #1, name$
INPUT #1, pass$
INPUT #1, t$
INPUT #1, o
CLOSE #1
CLS
DO
LOCATE 1, 36
PRINT name$; " QBIM"
LOCATE 12, 5
PRINT "1. Talk "
LOCATE 14, 5
PRINT "2. Logout"
INPUT " Type in the character of your selection"; s$
IF s$ = "1" THEN
CLS
PRINT " The name must be exactly as show in main menu."
INPUT " The name of the person you wish to talk to"; talk$
CLS
REM **************** reply/// send message *********************
DO
INPUT "Reply"; t2$
OPEN name$ + ".txt" FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t2$
WRITE #1, 1
CLOSE #1
REM **************** Recieve message **************************
check:
OPEN talk$ + ".txt" FOR INPUT AS #1
INPUT #1, name1$
INPUT #1, no$
INPUT #1, t1$
INPUT #1, o
CLOSE #1
tc1$ = t1$
IF tp$ = tc1$ THEN
GOTO check
ELSE
PRINT name1$; ": "; t1$
tp$ = t1$
END IF
LOOP WHILE INKEY$ <> "q"
ELSEIF s$ = "2" THEN
OPEN name$ + ".txt" FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t$
WRITE #1, 0
CLOSE #1
GOTO logout
END IF
LOOP WHILE 1 = 1
logout:
END SUB
SUB login (name$)
INPUT " Your user name"; un$
login2$ = un$ + ".txt"
OPEN login2$ FOR INPUT AS #1
INPUT #1, name$
INPUT #1, pass$
CLOSE #1
IF un$ = name$ THEN
PRINT " Welcome "; name$
pass:
INPUT " Password"; p$
IF p$ = pass$ THEN
PRINT " You are now logged on"
OPEN name$ + ".txt" FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t$
WRITE #1, 1
CLOSE #1
PRINT " Hit any key to continue"
DO
LOOP WHILE INKEY$ = ""
ELSE
GOTO pass
END IF
END IF
CALL im(name$)
END SUB
SUB nu
INPUT " Your name that you wish to use"; name$
redo:
INPUT " Your password that you wish to use"; pass$
INPUT " Confirm your password"; passc$
IF pass$ = passc$ THEN
user$ = name$ + ".txt"
OPEN user$ FOR OUTPUT AS #1
WRITE #1, name$
WRITE #1, pass$
WRITE #1, t$
WRITE #1, o
CLOSE #1
ELSE
GOTO redo
END IF
PRINT "Thank you for registering"
PRINT "Hit any key to continue"
DO
LOOP WHILE INKEY$ = ""
END SUB