Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ThrowBack Friday: "Haunted House"
#1
Created from "Write Your Own Adventure Games for Your Microcomputer", 1983

Wrote in the program straight from the PDF book Steve posted early, mid-December. Have it running now, though I haven't played it clear through yet though.

A Basic little text based adventure game with a very simple parser for input commands

Turn your caps lock on, type 'HELP' for a list of commands.
to move you can type GO + NORTH\SOUTH\EAST\ WEST  or you can just use the first letter of the direction; N,S,W,E

the rest you will have to figure out on your own...

only found one compatibility issue with the whole program and that was where they originally had the DIM statements.  I just had to move them to the top of the program for things to work.

Code: (Select All)
10 REM Haunted house adventure
20 REM ***********************
30 REM this version for "microsoft" basic
40 REM requires a minimum of 16k
50 REM select *text mode*if necessary
60 REM ******************************
65 CLEAR 100
70 V = 25: W = 36: G = 18

72 DIM R$(63), D$(63), O$(W), V$(V) 'moved here for compatibility issue (1600)
74 DIM C(W), L(G), F(W) 'moved here for compatibility issue(1610)

80 GOSUB 1600
90 CLS: PRINT "Haunted House"
100 PRINT "-------------"
110 PRINT "Your Location"
120 PRINT D$(RM)
130 PRINT "Exits:";
140 FOR i = 1 TO LEN(R$(RM))
150 PRINT MID$(R$(RM), i, 1); ",";
160 NEXT i
170 PRINT
180 FOR i = 1 TO G
190 IF L(i) = RM AND F(i) = 0 THEN PRINT "you can see "; O$(i); " here"
200 NEXT i
210 PRINT "========================="
220 PRINT M$: M$ = "what"
230 INPUT "What will you do now"; Q$
240 V$ = "": W$ = "": VB = 0: OB = 0
250 FOR i = 1 TO LEN(Q$)
260 IF MID$(Q$, i, 1) = " " AND V$ = "" THEN V$ = LEFT$(Q$, i - 1)
270 IF MID$(Q$, i + 1, 1) <> " " AND V$ <> "" THEN W$ = MID$(Q$, i + 1, LEN(Q$) - 1): i = LEN(Q$)
280 NEXT i
290 IF W$ = "" THEN V$ = Q$
300 FOR i = 1 TO V
310 IF V$ = V$(i) THEN VB = i
320 NEXT i
330 FOR i = 1 TO W
340 IF W$ = O$(i) THEN LET OB = i
350 NEXT i
360 IF W$ > "" AND qb = 0 THEN M$ = "That's Silly"
370 IF VB = 0 THEN VB = V + 1
380 IF W$ = "" THEN M$ = "I need two words"
390 IF VB > V AND OB > 0 THEN M$ = "You can't '" + Q$ + "'"
400 IF VB > V AND OB = 0 THEN M$ = "you don't make sense"
410 IF VB < V AND OB > 0 AND C(OB) = 0 THEN M$ = "you don't have '" + W$ + "'"
420 IF F(26) = 1 AND RM = 13 AND RND(3) <> 3 AND VB <> 21 THEN M$ = "Bats attacking!": GOTO 90
430 IF RM = 44 AND RND(2) = 1 AND F(24) <> 1 THEN F(27) = 1
440 IF F(0) = 1 THEN LL = LL - 1
450 IF LL < 1 THEN F(0) = 0
460 ON VB GOSUB 500, 570, 640, 640, 640, 640, 640, 640, 640, 980, 980, 1030, 1070, 1140, 1180, 1220, 1250, 1300, 1340, 1380, 1400, 1430, 1460, 1490, 1510, 1590
470 IF LL = 10 THEN M$ = "Your Candle is waning!"
480 IF LL = 1 THEN M$ = "your candle is out!"
490 GOTO 90
500 PRINT "Words I know:"
510 FOR i = 1 TO V
520 PRINT V$(i); ",";
530 NEXT i
540 M$ = "": PRINT
550 GOSUB 1580
560 RETURN
570 PRINT "you are carrying:"
580 FOR i = 1 TO G
590 IF C(i) = 1 THEN PRINT O$(i); ",";
600 NEXT i
610 M$ = "": PRINT
620 GOSUB 1580
630 RETURN
640 d = 0
650 IF OB = 0 THEN d = VB - 3
660 IF OB = 19 THEN d = 1
670 IF OB = 20 THEN d = 2
680 IF OB = 21 THEN d = 3
690 IF OB = 22 THEN d = 4
700 IF OB = 23 THEN d = 5
710 IF OB = 24 THEN d = 6
720 IF RM = 20 AND d = 5 THEN d = 1
730 IF RM = 20 AND d = 6 THEN d = 3
740 IF RM = 22 AND d = 6 THEN d = 2
750 IF RM = 22 AND d = 5 THEN d = 3
760 IF RM = 36 AND d = 6 THEN d = 1
770 IF RM = 36 AND d = 5 THEN d = 2
780 IF F(14) = 1 THEN M$ = "Crash! you fell out of the tree!": F(14) = 0: RETURN
790 IF F(27) = 1 AND RM = 52 THEN M$ = "Ghosts will not let you move": RETURN
800 IF RM = 45 AND C(1) = 1 AND F(34) = 0 THEN M$ = "A Magical barrier to the west": RETURN
810 IF (RM = 26 AND F(0) = 0) AND (d = 1 OR d = 4) THEN M$ = "You need a light": RETURN
820 IF RM = 54 AND C(15) <> 1 THEN M$ = "You're Stuck!": RETURN
830 IF C(15) = 1 AND NOT (RM = 53 OR RM = 54 OR RM = 55 OR RM = 47) THEN M$ = "You can't carry a boat!": RETURN
840 IF (RM > 26 AND RM < 30) AND F(0) = 0 THEN M$ = "Too Dark to move": RETURN
850 F(35) = 0: RL = LEN(R$(RM))
860 FOR i = 1 TO RL
870 U$ = MID$(R$(RM), i, 1)
880 IF (U$ = "N" AND d = 1 AND F(35) = 0) THEN RM = RM - 8: F(35) = 1
890 IF (U$ = "S" AND d = 2 AND F(35) = 0) THEN RM = RM + 8: F(35) = 1
900 IF (U$ = "W" AND d = 3 AND F(35) = 0) THEN RM = RM - 1: F(35) = 1
910 IF (U$ = "E" AND d = 4 AND F(35) = 0) THEN RM = RM + 1: F(35) = 1
920 NEXT i
930 M$ = "OK"
940 IF F(35) = 0 THEN M$ = "Can't go that way!"
950 IF d < 1 THEN M$ = "Go where?"
960 IF RM = 41 AND F(23) = 1 THEN R$(49) = "SW": M$ = "The Door slams shut!": F(23) = 0
970 RETURN
980 IF OB > G THEN M$ = "I can't get " + W$: RETURN
985 IF L(OB) <> RM THEN M$ = "it isn't here"
990 IF F(OB) <> 0 THEN M$ = "What " + W$ + "?"
1000 IF C(OB) = 1 THEN M$ = "you already have it"
1010 IF OB > 0 AND L(OB) = RM AND F(OB) = 0 THEN C(OB) = 1: L(OB) = 65: M$ = "You have the " + W$
1020 RETURN
1030 IF RM = 43 AND (OB = 28 OR OB = 29) THEN F(17) = 0: M$ = "Drawer open"
1040 IF RM = 28 AND OB = 25 THEN M$ = "It's locked"
1050 IF RM = 38 AND OB = 32 THEN M$ = "That's creepy!": F(2) = 0
1060 RETURN
1070 IF OB = 30 THEN F(18) = 0: M$ = "Something here!"
1080 IF OB = 31 THEN M$ = "That's Disgusting!"
1090 IF (OB = 28 OR OB = 29) THEN M$ = "There is a drawer"
1100 IF OB = 33 OR OB = 5 THEN GOSUB 1140
1110 IF RM = 43 AND OB = 35 THEN M$ = "There is something beyond..."
1120 IF OB = 32 THEN GOSUB 1030
1130 RETURN
1140 IF RM = 42 AND OB = 33 THEN M$ = "They are demonic works"
1150 IF (OB = 3 OR OB = 36) AND C(3) = 1 AND F(34) = 0 THEN M$ = "Use this word with care 'XZANFAR'"
1160 IF C(5) = 1 AND OB = 5 THEN M$ = "The Script is in an alien tongue"
1170 RETURN
1180 M$ = "OK '" + W$ + "'"
1190 IF C(3) = 1 AND OB = 34 THEN M$ = "*MAGIC OCCURS*": IF RM <> 45 THEN RM = INT(RND(63))
1200 IF C(3) = 1 AND OB = 34 AND RM = 45 THEN F(34) = 1
1210 RETURN
1220 IF C(12) = 1 THEN M$ = "You made a hole"
1230 IF C(12) = 1 AND RM = 30 THEN M$ = "Dug the bars out": D$(RM) = "Hole in wall": R$(RM) = "NSE"
1240 RETURN
1250 IF C(14) <> 1 AND RM = 7 THEN M$ = "This is no time to play games"
1260 IF OB = 14 AND C(14) = 1 THEN M$ = "You swung it"
1270 IF OB = 13 AND C(13) = 1 THEN M$ = "Whoosh!"
1280 IF OB = 13 AND C(13) = 1 AND RM = 43 THEN R$(RM) = "WN": D$(RM) = "Study with secret room": M$ = "You broke the thin wall"
1290 RETURN
1300 IF OB = 14 AND C(14) = 1 THEN M$ = "it isn't attached to anything!"
1310 IF OB = 14 AND C(14) <> 1 AND RM = 7 AND F(14) = 0 THEN M$ = "you see thick forest and cliff south": F(14) = 1: RETURN
1320 IF OB = 14 AND C(14) <> 1 AND RM = 7 AND F(14) = 1 THEN M$ = "going down!": F(14) = 0
1330 RETURN
1340 IF OB = 17 AND C(17) = 1 AND C(8) = 0 THEN M$ = "it will burn your hands"
1350 IF OB = 17 AND C(17) = 1 AND C(9) = 0 THEN M$ = "Nothing to light it with"
1360 IF OB = 17 AND C(17) = 1 AND C(9) = 1 AND C(8) = 1 THEN M$ = "it casts a flickering light": F(0) = 1
1370 RETURN
1380 IF F(0) = 1 THEN F(0) = 0: M$ = "extinguished"
1390 RETURN
1400 IF OB = 26 AND C(16) = 1 THEN M$ = "hissss"
1410 IF OB = 26 AND C(16) = 1 AND F(26) = 1 THEN F(26) = 0: M$ = "PFFT! Got them"
1420 RETURN
1430 IF OB = 10 AND C(10) = 1 AND C(11) = 1 THEN M$ = "switched on": F(24) = 1
1440 IF F(27) = 1 AND F(24) = 1 THEN M$ = "WHIZZ- Vacuumed the Ghosts Up!": F(27) = 0
1450 RETURN
1460 IF RM = 43 AND (OB = 27 OR OB = 28) THEN GOSUB 1030
1470 IF RM = 28 AND OB = 25 AND F(25) = 0 AND C(18) = 1 THEN F(25) = 1: R$(RM) = "SEW": D$(RM) = "Huge Open Door": M$ = "The Key Turns!"
1480 RETURN
1490 IF C(OB) = 1 THEN C(OB) = 0: L(OB) = RM: M$ = "Done"
1500 RETURN
1510 S = 0
1520 FOR i = 1 TO G
1530 IF C(i) = 1 THEN S = S + 1
1540 NEXT i
1550 IF S = 17 AND C(15) <> 1 AND RM <> 57 THEN PRINT "You have everything!": PRINT "Return to the gate for final score"
1560 IF S = 17 AND RM = 57 THEN PRINT "Double Score for reaching here!": S = S * 2
1570 PRINT "your score="; S: IF S > 18 THEN PRINT "Well Done! You finshed the game": END
1580 INPUT "press return to continue"; Q$
1590 RETURN

1600 REM dim R$(63),D$(63),O$(W),V$(V) 'moved to 72
'1610 dim C(w),L(g),F(w) 'Moved to 74

1620 DATA 46,38,35,50,13,18,28,42,10,25,26,4,2,7,47,60,43,32
1630 FOR i = 1 TO G
1640 READ L(i)
1650 NEXT i
1660 DATA "HELP",CARRYING?,GO,N,S,W,E,U,D,GET,TAKE,OPEN,EXAMINE,READ,SAY
1665 DATA DIG,SWING,CLIMB,LIGHT,UNLIGHT,SPRAY,USE,UNLOCK,LEAVE,SCORE
1680 FOR i = 1 TO V
1690 READ V$(i)
1700 NEXT i
1710 DATA SE,WE,WE,SWE,WE,WE,SWE,WS
1720 DATA NS,SE,WE,NW,SE,W,NE,NSW
1730 DATA NS,NS,SE,WE,NWUD,SE,WSUD,NS
1740 DATA N,NS,NSE,WE,WE,NSW,NS,NS
1750 DATA S,NSE,NSW,S,NSUD,N,N,NS
1760 DATA NE,NW,NE,W,NSE,WE,W,NS
1770 DATA SE,NSW,E,WE,NW,S,SW,NW
1780 DATA NE,NWE,WE,WE,WE,NWE,NWE,W
1790 FOR i = 0 TO 63
1800 READ R$(i)
1810 NEXT i
1820 DATA DARK CORNER,OVERGROWN GARDEN,BY LARGE WOODPILE,YARD BY RUBBISH
1825 DATA WEEDPATCH,FOREST,THICK FOREST,BLASTED TREE
1840 DATA CORNER OF HOUSE,ENTRANCE TO KITCHEN,KITCHEN & GRIMY COOKER,SCULLERY DOOR
1845 DATA ROOM WITH INCHES OF DUST,REAR TURRET ROOM,CLEARING BY HOUSE,PATH
1860 DATA SIDE OF HOUSE,BACK OF HALLWAY,DARK ALCOVE,SHALL DARK ROOM
1865 DATA BOTTOM OF SPIRAL STAIRCASE,WIDE PASSAGE,SLIPPERY STEPS,CLIFFTOP
1880 DATA NEAR CRUMBLING WALL,GLOOHY PASSAGE,POOL OF LIGHT,IMPRESSIVE VAULTED HALLWAY
1885 DATA HALL BY THICK WOODEN DOOR,TROPHY ROOH,CELLAR WITH BARRED WINDOW,CLIFF PATH
1900 DATA CUPBOARD WITH HANGING COAT,FRONT HALL,SITTING ROOM,SECRET ROOM
1905 DATA STEEP MARBLE STAIRS,DINING ROOM,DEEP CELLAR WITH COFFIN,CLIFF PATH
1920 DATA CLOSET,FRONT LOBBY,LIBRARY OF EVIL BOOKS,STUDY WITH DESK & HOLE IN WALL
1925 DATA WEIRD COBWEBBY ROOM,VERY COLD CHAMBER,SPOOKY ROOM,CLIFF PATH BY MARSH
1940 DATA RUBBLE-STREWN VERANDAH,FRONT PORCH,FRONT TOWER,SLOPING CORRIDOR
1945 DATA UPPER GALLERY,MARSH BY WALL,MARSH,SOGGY PATH
1960 DATA BY TWISTED RAILING,PATH THROUGH IRON GATE,BY RAILINGS,BENEATH FRONT TOWER
1965 DATA DEBRIS FROM CRUMBLING FACADE,LARGE FALLEN BRICKWORK,ROTTING STONE ARCH,CRUMBLING CLIFFTOP
1980 FOR i = 0 TO 63
1990 READ D$(i)
2000 NEXT i
2010 DATA PAINTING,RING,MAGIC SPELLS,GOBLET,SCROLL,COINS,STATUE,CANDLESTICK
2012 DATA MATCHES,VACUUM,BATTERIES,SHOVEL,AXE,ROPE,BOAT,AEROSOL,CANDLE,KEY
2014 DATA NORTH,SOUTH,WEST,EAST,UP,DOWN
2016 DATA DOOR,BATS,GHOSTS,DRAWER,DESK,COAT,RUBBISH
2018 DATA COFFIN,BOOKS,XZANFAR,WALL,SPELLS
2060 FOR i = 1 TO W
2070 READ O$(i)
2080 NEXT i
2090 F(18) = 1: F(17) = 1: F(2) = 1: F(26) = 1: F(28) = 1: F(23) = 1: LL = 60: RM = 57: M$ = "OK"
2100 RETURN
Reply
#2
235 Q$ = UCASE$(Q$)

(No worry over caps lock anymore.)
Reply
#3
(01-05-2024, 03:47 PM)SMcNeill Wrote: 235 Q$ = UCASE$(Q$)

(No worry over caps lock anymore.)
Where is the fun in that?

Well, I was presenting it in its original "Glory" so to speak.
Reply
#4
I've been spoiled by Colossal Cave Adventure & Zork.  I'd forgotten how terse those old low-spec adventure games were.

Trivia: From the earliest days of the TRS-80 Radio Shack sold an adventure called Haunted House.  They made it as terse as possible and then split it into two parts, so it would run on machines with as little as 4K or RAM.
Reply




Users browsing this thread: 2 Guest(s)