' M.U.C.A.S C.O.M.P.U.T.E.R.S ' presents ' ' ллллллллллллл ллллллллллл лл лл лл ' лл лл лл лл лл лл ' лл лл лл лл лл лл ' лл ллллллллллл лл лллл ' лл лл лл лл лл лл ' лл лл лл лллллллллл лл лл ' ' A Simple chat with the computer ' Taken from an old basic book and upgraded slightly, Graphics look similar ' to Sam McKoys (Author of this prog and founder of MUCAS COMPUTERS) ' dial-up program which lets you tranfers file and chat over a modem ' plus many more features, release date unknown but sometime soon!!!!! ' DECLARE SUB graphics () DECLARE SUB AnswerBack () DECLARE SUB CheckNoResponcesUsed () DECLARE SUB PhraseCheck () DECLARE SUB RandomSentence () DECLARE SUB ComputersResponce () DECLARE SUB bye () DECLARE SUB readdata () DECLARE SUB PersonsInput () DECLARE SUB ComputerTalk () DD = VAL(MID$(TIME$, 7)) * VAL(MID$(TIME$, 1, 2)) + VAL(MID$(TIME$, 4, 2)) RANDOMIZE DD SCREEN 9 CLS graphics DIM SHARED DC%(30000), PB%(30000) DIM SHARED TotalSentences, TotalVerbs, TotalAdjectives, TotalNouns, TotalStarters DIM SHARED TotalPhrases, TotalAnswers DIM SHARED u$(20), w$(20), Z$(5) DIM SHARED v$(20), n$(50), a$(20), sn$(20) DIM SHARED T$(30), S$(20), m$(40), q$(40), C(40) DIM SHARED I$, r$, D$, T, y, x, X1, Y1 LOCATE 4, 4: PRINT "T u r n C a p s L o c k O N N O W !" LOCATE 5, 4: PRINT "if you wish this to work better" x = 4: y = 4: X1 = 4: Y1 = 12 readdata PersonsInput gtdi: PRINT "A Error has occured while reading the data in!!" PRINT "It could be that the files don't exsist or they are" PRINT "in a different directory, they may even be corrupted" PRINT INPUT "Please Type in the directory they are in"; dir$ CLOSE OPEN "Talk.cfg" FOR OUTPUT AS #1 PRINT #1, dir$ CLOSE RUN 'LIST OF ANSWerS FOR TALK.BAS NUMBER BELOW =TOTALANSWERS 'NORMALLY THIS WOULD BE IN A DIFFDERENT FILE BUT IT DOESN'T WORK CAUSE 'OF THE QUOTATION MARKS DATA 13 DATA I AM,YOU ARE DATA YOU ARE,I AM DATA "I ",YOU DATA " ME",YOU DATA " MY ",YOUR DATA "YOURS ",MINE DATA " YOUR "," MY " DATA " MINE",YOURS DATA YOU'VE,I'VE DATA YOU'RE,I'M DATA "I'VE ",YOU'VE DATA YOU,COMPUTERS DATA COMPUTERS,ME SUB AnswerBack ' Answer Back subroutine 'This routine checks your answers and wirte back accordingly Z = 0 strtanswer: 'comes back here after each run through P = LEN(I$) FOR a = 1 TO P FOR B = 1 TO TotalAnswers l = LEN(u$(B)) IF MID$(I$, a, l) = u$(B) THEN GOTO MatchAnswer NEXT B NEXT a IF Z$(1) = "" THEN EXIT SUB FOR J = 1 TO Z IF LEN(Z$(J)) + X1 > 70 THEN X1 = 4: Y1 = Y1 + 1 IF Y1 >= 25 THEN GET (18, 195)-(603, 336), DC% LINE (18, 181)-(603, 336), 0, BF PUT (18, 181), DC% Y1 = 24 END IF LOCATE Y1, X1 PRINT Z$(J) X1 = X1 + LEN(Z$(J)) Z$(J) = "" NEXT J r$ = I$: ComputerTalk MatchAnswer: Z = Z + 1 ' keeps a count of answerbacks in your sentence IF a > 1 THEN Z$(Z) = LEFT$(I$, a - 1) + " " + w$(B) + " " 'gets a responce for you IF a < 2 THEN LET Z$(Z) = w$(B) + " " 'gets a responce for you LET I$ = MID$(I$, a + l, P) 'cuts out data already dealt with GOTO strtanswer END SUB SUB bye PRINT "HAD ENOUGH ALREADY??" PRINT "ISN'T THERE ANYONE ELSE I CAN TALK TO ...?" INPUT Z$: IF UCASE$(RIGHT$(Z$, 1)) = "Y" THEN D$ = "": PersonsInput PRINT "BYE THEN" SYSTEM END SUB SUB CheckNoResponcesUsed T = 0 ' resets the counter FOR k = 1 TO TotalPhrases ' Checks the number of responces used T = T + C(k) NEXT IF T >= TotalPhrases / 2 THEN ' if more then half of the responces are FOR k = 1 TO TotalPhrases ' used then reset them all C(k) = 0 ' if you have lots of responces then NEXT ' you might not want it on half, put it higher END IF T = 0 ' resets the counter PersonsInput 'goes back and lets person talk END SUB SUB ComputersResponce reply = INT(RND(1) * 8 + 1) IF reply < 4 THEN PhraseCheck IF reply > 3 AND reply < 7 THEN AnswerBack RandomSentence END SUB SUB ComputerTalk gh$ = r$ DO IF LEN(gh$) > 70 THEN f$ = MID$(gh$, 1, 70): gh$ = MID$(gh$, 70) ELSE f$ = gh$: gh$ = "" IF f$ = "" THEN GOTO hj LOCATE Y1, X1 PRINT f$; : X1 = X1 + LEN(f$) IF f$ = CHR$(13) OR X1 >= 71 THEN X1 = 4: Y1 = Y1 + 1 IF f$ = CHR$(29) AND X1 > 4 THEN X1 = X1 - 1: LOCATE Y1, X1: PRINT " "; IF Y1 >= 25 THEN GET (18, 195)-(603, 336), DC% LINE (18, 181)-(603, 336), 0, BF PUT (18, 181), DC% Y1 = 24 END IF hj: LOOP UNTIL gh$ = "" f$ = "" Y1 = Y1 + 1: X1 = 4 CheckNoResponcesUsed END SUB SUB graphics SCREEN 9, 0, 1, 0 CLS x = 4: y = 4: X1 = 4: Y1 = 14 LINE (12, 10)-(642, 340), 7, BF 'grey bit LINE (17, 41)-(604, 175), 0, BF LINE (17, 180)-(604, 337), 0, BF LINE (17, 179)-(604, 179), 8 LINE (17, 175)-(604, 175), 15 LINE (17, 41)-(604, 41), 8 LINE (17, 41)-(17, 337), 8 LINE (17, 337)-(604, 337), 15 LINE (604, 41)-(604, 337), 15 LINE (16, 13)-(635, 27), 1, BF ' blue bit LINE (15, 12)-(15, 27), 8 LINE (15, 12)-(636, 12), 8 LINE (636, 27)-(636, 12), 15 LINE (15, 28)-(636, 28), 15 LINE (12, 10)-(12, 340), 15 LINE (12, 10)-(642, 10), 15 LINE (639, 10)-(639, 340), 8 LINE (12, 340)-(642, 340), 8 LINE (616, 14)-(629, 25), 7, BF PSET (615, 14), 15 DRAW "r14d1c8d11l14c15u12 br4bd3c0r1d1r1d1r3u1r1u1r1l1d1l1d1l1d2r1d1r1d1r1l1u1l1u1l2u1d1l1d1l1d1l1r1d1" 'LINE (603, 41)-(603, 337), 7 LINE (588, 14)-(602, 25), 7, BF COLOR 15: LOCATE 2, 75: PRINT "?" FOR xc = 589 TO 602 FOR cx = 15 TO 25 IF POINT(xc, cx) = 0 THEN PSET (xc, cx), 7 IF POINT(xc, cx) = 15 THEN PSET (xc, cx), 0 NEXT: NEXT PSET (588, 14), 15 DRAW "r14d1c8d11l14c15u12 br4bd3" PSET (588, 26), 8 PSET (620, 24), 7 PSET (615, 26), 8 LINE (17, 175)-(17, 178), 7 LINE (604, 175)-(604, 178), 7 FOR q = 13 TO 27 FOR P = 16 TO 300 IF POINT(P, q) = 0 THEN PSET (P, q), 1 NEXT: NEXT PCOPY 1, 0 SCREEN 9, 0, 0, 0 END SUB SUB PersonsInput IF D$ <> "" THEN GOTO Talk LOCATE 6, 4 INPUT "WHAT IS YOUR NAME?"; D$ graphics empty: graphics LOCATE 4, 4 PRINT "TALK TO ME "; D$ x = 4: y = 5 Talk: LOCATE y, x LINE INPUT "YOU:"; I$ x = 4: y = y + 1 IF I$ = "" THEN GOTO empty IF INSTR(UCASE$(I$), "BYE") THEN bye IF y >= 13 THEN GET (18, 56)-(603, 174), PB% LINE (18, 42)-(603, 174), 0, BF PUT (18, 45), PB% y = 12: x = 4 END IF ComputersResponce END SUB SUB PhraseCheck 'Checks for phrases it can use FOR Phrase = 1 TO TotalPhrases ' loops for all the phrases l1 = LEN(q$(Phrase)) ' length of the phrase l2 = LEN(I$) ' length of persons input FOR Test = 1 TO l2 ' loops for ever letter of persons input IF MID$(I$, Test, l1) = q$(Phrase) THEN GOTO MatchedPhrase CancelledMatch: 'returns here after going to MatchedPrase and Getting cancelled NEXT Test NEXT Phrase RandomSentence 'gives up on phrases and tries to use a sentence MatchedPhrase: 'comes here when it finds a good phrase IF C(Phrase) > 0 THEN GOTO CancelledMatch'goes back if phrase already used C(Phrase) = C(Phrase) + 1 r$ = m$(Phrase) ComputerTalk END SUB SUB RandomSentence e = INT(RND(1) * TotalSentences + 1) 'Chooses a random sentence f = INT(RND(1) * TotalVerbs + 1) 'Chooses a random Verb G = INT(RND(1) * TotalAdjectives + 1) 'Chooses a random Adjectives H = INT(RND(1) * TotalNouns + 1) 'Chooses a random Noun H2 = INT(RND(1) * TotalNouns2 + 1) 'Chooses a second random Noun l = INT(RND(1) * TotalStarters + 1) 'Chooses a random Sentence Starter ON e GOTO 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 1 : r$ = "WHAT DO YOU THINK ABOUT " + n$(H) + "?" ComputerTalk 2 : r$ = S$(l) + " " + D$ + " YOU DON'T THINK ALL " + sn$(H2) + " ARE " + a$(G) + " DO YOU?" ComputerTalk 3 : r$ = "I'VE HEARD THAT YOU ARE SOME KIND OF " + a$(G) + " " + T$(H) + " " + D$ ComputerTalk 4 : r$ = S$(l) + " " + D$ + " , I THINK YOU ARE JUST AS " + a$(G) + " AS THE " + sn$(H2) + " I'VE TALKED TO" ComputerTalk 5 : r$ = "I AM FEELING " + a$(G) + " NOW" ComputerTalk 6 : LOCATE Y1, X1 PRINT "SHSSHHHH..... I AM THINKING ....." x = 4: Y1 = Y1 + 1 r$ = "LETS " + v$(f) + " " + n$(H) + " I THINK " + n$(H) + " IS " + a$(G) ComputerTalk 7 : r$ = "TELL ME ABOUT " + n$(H) + ", " + D$ ComputerTalk 8 : r$ = "DO YOU THINK I AM " + a$(G) + ", " + D$ + "?" ComputerTalk 9 : r$ = "LETS " + v$(f) + " SOMETHING ELSE MORE " + a$(G) ComputerTalk 10 : r$ = "GUESS WHAT I AM THINKING " + D$ ComputerTalk END SUB SUB readdata TotalSentences = 10 ON ERROR GOTO gtdi OPEN "talk.cfg" FOR INPUT AS #1 INPUT #1, dir$ CLOSE CHDIR dir$ ON ERROR GOTO 0 OPEN "Verb.lst" FOR INPUT AS #1 INPUT #1, rubbish$ INPUT #1, TotalVerbs FOR lop = 1 TO TotalVerbs INPUT #1, v$(lop) NEXT CLOSE OPEN "Adj.lst" FOR INPUT AS #1 INPUT #1, rubbish$ INPUT #1, TotalAdjectives FOR lop = 1 TO TotalAdjectives INPUT #1, a$(lop) NEXT CLOSE OPEN "Noun.lst" FOR INPUT AS #1 INPUT #1, rubbish$ INPUT #1, TotalNouns FOR lop = 1 TO TotalNouns INPUT #1, n$(lop) NEXT CLOSE OPEN "noun2.lst" FOR INPUT AS #1 INPUT #1, rubbish$ INPUT #1, TotalNouns2 FOR lop = 1 TO TotalNouns2 INPUT #1, sn$(lop) NEXT CLOSE OPEN "Start.lst" FOR INPUT AS #1 INPUT #1, rubbish$ INPUT #1, TotalStarters FOR lop = 1 TO TotalStarters INPUT #1, S$(lop), T$(lop) NEXT CLOSE OPEN "phrase.lst" FOR INPUT AS #1 INPUT #1, rubbish$ INPUT #1, TotalPhrases FOR lop = 1 TO TotalPhrases INPUT #1, q$(lop), m$(lop) NEXT CLOSE READ TotalAnswers FOR lop = 1 TO TotalAnswers READ u$(lop), w$(lop) NEXT CLOSE ON ERROR GOTO 0 END SUB