The final lines of code deal with death and leaving the dungeon.
On leaving the dungeon. The player is given the opportunity to renter ( if they left by mistake ) or save their character and the current state of the dungeon before returning to the Inn.
10000 TEXT : HOME : VTAB (10): PRINT "THOU LEAVEST THE DUNGEON."
10006 J = INT (EX / 65536):JJ = INT ((EX - 65536 * J) / 256): POKE KB + 3,J: POKE KB + 2,JJ: POKE KB + 1,EX - 65536 * J - 256 * JJ: IF SM < 0 THEN SM = 0
10008 POKE KB + 10,SM
10010 PRINT : PRINT "EXPERIENCE: ";EX: PRINT : INPUT "DOST THOU WISH TO REENTER?";C$: IF LEFT$ (C$,1) = "Y" THEN RUN
10012 D$ = CHR$ (4)
10020 INPUT "WOULDST THOU SAVE THY CHARACTER BEFORE RETURNING TO THE INN?";C$: IF LEFT$ (C$,1) < > "Y" GOTO 10060
10030 C$ = "": FOR I = 0 TO 10:C$ = C$ + CHR$ ( PEEK (KB - 11 + I)): NEXT I: PRINT "STORING THE ADVENTURER HIGHT "C$
10040 PRINT D$;"OPEN "C$: PRINT D$;"WRITE "C$: FOR I = 61 TO 96:J = PEEK (KA - I): PRINT J: NEXT I:J = PEEK (KA): PRINT J: FOR I = 0 TO 37:J = PEEK (KB - 12 + I): PRINT J: NEXT I: PRINT D$;"CLOSE"
10059 PRINT "CHARACTER SAVED"
10060 INPUT "WOULDST THOU SAVE THE CURRENT STATE OF THE DUNJON?";C$: IF LEFT$ (C$,1) < > "Y" GOTO 10090
10070 INPUT "WHAT LEVEL (A NUMBER) SHOULD I CALL IT?";J: IF J < 5 THEN INPUT "ART THOU SURE";C$: IF LEFT(C$,1) < > "Y" GOTO 10070
10075 C$ = "DATA" + STR$ (J): PRINT "SAVING AS "C$: PRINT D$;"BSAVE"C$;",A$1062,L$8BE": PRINT D$;"BSAVE SHAPE" STR$ (J);",A$800,L$7FF"
10080 PRINT "SAVE COMPLETE": STOP
10090 PRINT "NOW LOADING THE INNKEEPER.": PRINT D$;"RUN INN"
On being killed. There are now four logarithmically decreasing possibilites: you might be found by Benedic, in which case you return to the Inn with all your possessions intact. The next most likely possibility is that you will fond by Lowenthal, who takes all your magic items but leaves your mundane treasures alone. Next is Olias, who takes all your treasure and items. Finally, you could be eaten - in which case the magic number is cleared and the game cold starts on return to the Inn.
11000 TEXT : HOME : VTAB (10): PRINT "THOU ART SLAIN!": FOR I = 1 TO 2500: NEXT : HOME :I = SQR ( RND (1) * 16 + 1) + .7: ON I GOTO 11010,11030,11040,11020
11010 VTAB (10): PRINT "THOU ART EATEN!": POKE KB - 12,0:SM = PEEK (KB + 10): PRINT : PRINT : GOTO 10020
11020 PRINT "BENEDIC THE CLERIC FOUND THEE!": PRINT : PRINT : GOTO 10006
11030 PRINT "LOWENTHAL THE MAGE FOUND THEE!": PRINT : PRINT : FOR I = 81 TO 90: POKE KA - I,0: NEXT I: GOTO 10006
11040 PRINT "OLIAS THE DWARF FOUND THEE!": PRINT : PRINT : FOR I = 61 TO 90: POKE KA - I,0: NEXT I: POKE KB + 10,0:SM = 0: POKE KB + 16,0: POKE KB + 14,0: POKE KB + 6,0: GOTO 10006
clear the values in the left hand status column.
15000 HCOLOR= 4: FOR QI = 0 TO 7: HPLOT QX,QY + QI TO QX + B1,QY + QI: NEXT QI: HCOLOR= 7: RETURN
15010 QX = 195: HCOLOR= 4: FOR QI = 0 TO 7: HPLOT QX,QY + QI TO QX + BL,QY + QI: NEXT QI: HCOLOR= 7: RETURN
16000 QX = 255:QY = 0: GOSUB 15000:QY = 56: GOSUB 15000:QY = 64: GOSUB 15000:QX = 249:QY = 8: GOSUB 15000:QY = 16: GOSUB 15000:QY = 24: GOSUB 15000:QY = 32: GOSUB 15010:QY = 40: GOSUB 15010:QY = 48: GOSUB 15010:QY = 72: GOSUB 15010:QY = 80: GOSUB 15010
16010 FOR QY = 96 TO 184 STEP 8: GOSUB 15010: NEXT QY: RETURN
Load the data files. One file holds the data, the other contains a "shape table" holding the various shapes for the text and graphics.
20000 HOME : VTAB (10): INPUT "WHICH LEVEL OF THE DUNJON WOULDST THOU EXPLORE? ";I
20010 I = INT (I): IF I < 1 THEN PRINT "ART THOU A DOLT? THE LOWEST LEVEL IS ONE!": GOTO 20000
20015 IF I > 4 THEN INPUT "ART THOU SURE? ";A$: IF LEFT$ (A$,1) < > "Y" THEN 20000
20016 IF I = PEEK (KA) THEN 20040
20020 PRINT CHR$ (04);"BLOAD DATA";I: PRINT CHR$ (04);"BLOAD SHAPE";I
20030 POKE 232,0: POKE 233,8
20040 HOME : VTAB (5): PRINT "THE DUNGEON IS NOW OPENED. GODSPEED AND GOOD FORTUNE IN YOUR QUEST!": FOR I = 1 TO 2500: NEXT I
20050 RETURN
Print the static text in the right-hand status column.
25000 HGR : POKE - 16302,0: HCOLOR= 7: SCALE= 1: ROT= 0
25010 FOR I = 1 TO 7: READ QX,QY,Q$: GOSUB 75: NEXT I
25020 RETURN
Comments