Source:Desc Edit

From Eamon Wiki
Jump to navigation Jump to search
This page is a verbatim reproduction of original source material and should not be edited except for maintenance.
Description

The Applesoft BASIC source code of the Eamon utility program Desc Edit

Source

EAG Utilities Disk

Date

c. 1984, last modified 19 February 1996

Author

John Nelson

License

It is believed that the use of this copyrighted item in Eamon Wiki qualifies as fair use under the copyright law of the United States.

1  REM     EDIT DESCRIPTION PROGRAM
2  REM      BY JOHN NELSON
3  REM 
4  REM  REV 2/19/96
5  REM 
10 DK$ =  CHR$ (4):D$ = DK$: HOME : FOR X = 1 TO 4: READ TYP$(X): NEXT :
20  VTAB 5: PRINT "     EDITING EAMON DESCRIPTION FILE": PRINT : PRINT "     INSERT DISKETTE WITH ADVENTURE"
30  PRINT : PRINT "     PRESS ANY KEY TO CONTINUE...";: POKE  - 16368,0: GET A$: PRINT 
50  DATA  ROOM,ARTIFACT,EFFECT,MONSTER
60  PRINT DK$"UNLOCK EAMON.DESC"
70  PRINT DK$;"OPEN EAMON.DESC,L256"
80  PRINT DK$;"READ EAMON.DESC,R0": FOR X = 1 TO 4: INPUT N%(X): NEXT :NR = N%(1):NA = N%(2):NE = N%(3):NM = N%(4): PRINT DK$
100  REM  --- MAIN MENU ---
110  HOME : PRINT  SPC( 9);"EAMON DESCRIPTION EDIT": PRINT  SPC( 12);"BY JOHN NELSON"
120  VTAB 8: HTAB 4: PRINT "SELECT OPTION ...": PRINT 
130  PRINT "  1. INITIALIZE BEGINNER'S CAVE": PRINT : PRINT "  2. ADD A DESCRIPTION"
140  PRINT : PRINT "  3. EDIT A DESCRIPTION": PRINT : PRINT "  4. VIEW A DESCRIPTION": PRINT : PRINT "  5. QUIT"
160  PRINT : PRINT "INPUT NUMBER (1-5) [_]"; CHR$ (8); CHR$ (8);
170  GET A$: IF A$ < "1" OR A$ > "5" THEN 170
180  PRINT A$: ON  VAL (A$) GOTO 1000,2000,3000,4000,5000
600  REM ///ROUTINE TO INPUT I$, HAVING BEEN PASSED I2$
605 I$ = ""
610  PRINT I2$;: CALL  - 958: IF  LEN (I2$) THEN  FOR A = 1 TO  LEN (I2$): PRINT  CHR$ (8);: NEXT 
615  GET A$: IF A$ =  CHR$ (13) THEN  CALL  - 958: PRINT : RETURN 
620  IF (A$ >  CHR$ (31) OR A$ =  CHR$ (9) OR (A$ =  CHR$ (21) AND  NOT  LEN (I2$))) AND  LEN (I$) +  LEN (I2$) > 250 THEN  PRINT  CHR$ (7);: GOTO 615
625  IF A$ >  CHR$ (31) THEN  PRINT A$;:I$ = I$ + A$:I2$ =  MID$ (I2$,2): GOTO 615
630  IF A$ =  CHR$ (5) THEN  PRINT I2$;:I$ = I$ + I2$:I2$ = "": GOTO 615
635  IF A$ =  CHR$ (2) AND  LEN (I$) THEN  FOR A = 1 TO  LEN (I$): PRINT  CHR$ (8);: NEXT :I2$ = I$ + I2$:I$ = "": GOTO 615
640  IF A$ =  CHR$ (4) THEN I2$ =  MID$ (I2$,2): GOTO 610
645  IF A$ =  CHR$ (9) THEN I2$ = " " + I2$: GOTO 610
650  IF A$ =  CHR$ (21) AND  LEN (I2$) THEN A$ =  LEFT$ (I2$,1): GOTO 625
655  IF A$ =  CHR$ (21) THEN A$ = " ": GOTO 625
660  IF A$ =  CHR$ (8) AND  LEN (I$) > 1 THEN I2$ =  RIGHT$ (I$,1) + I2$:I$ =  LEFT$ (I$, LEN (I$) - 1): PRINT A$;: GOTO 615
665  IF A$ =  CHR$ (8) AND  LEN (I$) THEN I2$ = I$ + I2$: PRINT A$;: GOTO 600
670  IF A$ =  CHR$ (8) THEN 600
675  IF A$ =  CHR$ (27) THEN  PRINT I2$:I$ = I$ + I2$: RETURN 
680  GOTO 615
1000  REM  --- INIT BEGIN CAVE ---
1010  READ NR,NA,NE,NM:UP = 1
1015  IF NR = 0 THEN 1025
1020  FOR REC = 1 TO NR: READ DE$: GOSUB 18000: NEXT 
1025  IF NA = 0 THEN 1035
1030  FOR R = 1 TO NA:REC = 100 + R: READ DE$: GOSUB 18000: NEXT 
1035  IF NE = 0 THEN 1045
1040  FOR R = 1 TO NE:REC = 200 + R: READ DE$: GOSUB 18000: NEXT 
1045  IF NM = 0 THEN 1055
1050  FOR R = 1 TO NM:REC = 300 + R: READ DE$: GOSUB 18000: NEXT 
1055  REM 
1090  GOTO 100
2000  REM --- ADD A DESC ---
2010 UP = 1: GOSUB 10000: ON ST GOSUB 2100,2200,2300,2400
2020  GOSUB 600:DE$ = I2$: GOSUB 18000: GOTO 100
2100  REM  --- ROOM ADD ---
2110 NR = NR + 1:REC = NR: RETURN 
2200  REM  --- ART. ADD ---
2210 NA = NA + 1:REC = NA + 100: RETURN 
2300  REM  --- EFF. ADD ---
2310 NE = NE + 1:REC = NE + 200: RETURN 
2400  REM  --- MON. ADD ---
2410 NM = NM + 1:REC = NM + 300: RETURN 
3000  REM  --- EDIT A DESC ---
3010 UP = 1: GOSUB 10000: GOSUB 11000
3020  ON ST GOSUB 3100,3200,3300,3400
3030  GOSUB 20000
3040 I2$ = DE$: GOSUB 600:DE$ = I$
3050  GOSUB 18000
3090  GOTO 100
3100  REM  --- ROOM EDIT ---
3110 REC = NO: RETURN 
3200  REM  --- ART. EDIT ---
3210 REC = NO + 100: RETURN 
3300  REM   --- EFF. ADD ---
3310 REC = NO + 200: RETURN 
3400  REM   --- MON. EDT ---
3410 REC = NO + 300: RETURN 
4000  REM  --- VIEW A DESC ---
4005  GOSUB 10000
4010  VTAB 8: CALL  - 958: PRINT "SELECT VIEW OPTIONS:": PRINT : PRINT "  1. ALL DESCRIPTIONS": PRINT : PRINT "  2. SINGLE DESCRIPTION": PRINT : PRINT "INPUT YOUR CHOICE 1-2 OR [P] ";
4020  GET A$: IF A$ = "�" THEN PRT =  NOT PRT: GOTO 4020
4030  IF A$ < "1" OR A$ > "2" THEN 4020
4040  PRINT A$: IF PRT THEN  PRINT D$;"PR#1"
4050  ON  VAL (A$) GOTO 4100,4200
4100  FOR NO = 1 TO N%(ST):REC = 100 * (ST - 1) + NO: GOSUB 20000
4110  GOSUB 4500: NEXT : GOTO 4900
4200  GOSUB 11000:
4220  ON ST GOSUB 3100,3200,3300,3400
4230  GOSUB 20000: GOSUB 4500: GOTO 4900
4500  HOME : PRINT TYP$(ST);" ";NO: PRINT : PRINT : FOR LW = 1 TO  LEN (DE$) STEP 40: PRINT  MID$ (DE$,LW,40): NEXT 
4530  VTAB 24: INVERSE : PRINT  SPC( 7);"PRESS ANY KEY TO CONTINUE"; SPC( 7);: POKE  - 16368,0: GET A$: PRINT : NORMAL 
4540  IF A$ =  CHR$ (27) THEN  POP : GOTO 4900
4590  RETURN 
4900  PRINT D$;"PR#0": GOTO 100
5000  REM  --- QUIT ---
5010  IF  NOT UP THEN  END 
5110  PRINT D$;"WRITE EAMON.DESC,R0": PRINT NR: PRINT NA: PRINT NE: PRINT NM: PRINT D$;"CLOSE": END 
10000  REM  --- GET TYPE ---
10010  VTAB 8: CALL  - 958: PRINT "INPUT TYPE: R/A/E/M [_]"; CHR$ (8); CHR$ (8);
10020  GET A$: FOR X = 1 TO 4: IF  MID$ ("RAEM",X,1) <  > A$ THEN  NEXT : GOTO 10020
10030  PRINT A$:ST = X:X = 4: NEXT 
10040  RETURN 
11000  REM  --- GET NUMBER ---
11010  VTAB 8: CALL  - 958: INPUT "INPUT NUMBER: ";A$
11020  IF  VAL (A$) > N%(ST) OR  VAL (A$) < 1 THEN 11010
11030 NO =  VAL (A$): RETURN 
18000  REM  >> WRITE DESC
18010  PRINT DK$;"WRITE EAMON.DESC,R";REC: PRINT  CHR$ (34);DE$; CHR$ (34): PRINT DK$: RETURN 
20000  REM  >> READ DESC
20010  PRINT DK$;"READ EAMON.DESC,R";REC: INPUT DE$: PRINT DK$
20020  RETURN 
30000  REM  --- INITIAL DATA ---
30010  DATA  0,0,0,0
30100  DATA "  YOU ARE AT THE ENTRANCE OF A CAVE. TO THE SOUTH, OVER THE TUNNEL ENTRANCE, IS A SIGN SAYING 'BEGINNERS ONLY.' TO THE  NORTH IS THE ROAD BACK TO TOWN."
30110  DATA "  YOU ARE IN A DARK NORTH/SOUTH TUNNEL. TO THE NORTH YOU SEE THE BRIGHT LIGHT   STREAMING IN FROM THE OUTSIDE. TO THE   SOUTH YOU SEE FLICKERING TORCH LIGHT,   BUT YOU CANNOT MAKE OUT ANY DETAILS."
30120  DATA "  YOU ARE IN A SMALL SIDE CHAMBER TO THEWEST OF THE LARGE CHAMBER. IT IS VERY   COLD HERE, AND THE ONLY LIGHT COMES IN  DIMLY FROM THE LARGE CHAMBER."
30130  DATA "  YOU ARE IN A HUGE CHAMBER, THE ROOF   RISES OUT OF SIGHT. BURNING TORCHES LINETHE WALLS, MAKING IT EASY TO SEE.TUNNELSLEAD NORTH AND SOUTH,AND THERE ARE SMALLSIDE CHAMBERS TO BOTH THE EAST AND WEST."
30140  DATA "  YOU ARE IN A SMALL SIDE CHAMBER TO THEEAST OF THE LARGE CHAMBER. IT IS VERY   COLD HERE, AND THE ONLY LIGHT COMES IN  DIMLY FROM THE LARGE CHAMBER."
30150  DATA "  YOU ARE IN A SMALL, STARK CELL WITH A DOOR ON THE EAST SIDE OF THE ROOM."
30160  DATA "  YOU ARE AT THE NORTH END OF A LONG    HALL. A TUNNEL GOES NORTH. TO THE EAST  AND WEST ARE DOORS THAT ARE BOLTED SHUT (LOCKING SOMETHING IN?) IN THE DIM LIGHTYOU CAN SEE THAT THE HALL GOES SOUTH,BUTYOU CANNOT MAKE OUT ANY DETAI
30170  DATA "  YOU ARE IN A SMALL, STARK CELL WITH A DOOR ON THE WEST SIDE OF THE ROOM."
30180  DATA "  YOU ARE IN A SMALL, STARK CELL WITH A DOOR ON THE EAST SIDE."
30190  DATA "  YOU'RE IN THE MIDDLE OF THE LONG HALL.DOORS ARE BOLTED ON BOTH SIDES OF YOU   (EAST AND WEST).  THE HALL EXTENDS NORTHAND SOUTH."
30200  DATA "  YOU ARE IN A SMALL, STARK CELL WITH A DOOR ON THE WEST SIDE."
30210  DATA "  YOU ARE IN A SMALL, STARK CELL WITH A DOOR ON THE EAST SIDE."
30220  DATA "  YOU ARE AT THE SOUTH END OF THE LONG  HALL. TO YOUR GREAT SHOCK ARE TWO DOORS ON THE EAST AND WEST.THE HALL GOES NORTHFROM HERE, AND A BROKEN TUNNEL GOES     SOUTH."
30230  DATA "  YOU ARE IN A SMALL, STARK CELL WITH A DOOR ON THE WEST SIDE."
30240  DATA "  YOU ARE IN A TUNNEL GOING NORTH AND   SOUTH.  THE SIDES OF THE TUNNEL ARE VERYBROKEN AND ROUGH. YOU SEE TORCHLIGHT TO THE SOUTH."
30250  DATA "  YOU ARE IN A SECRET EAST/WEST PASSAGE.YOU HEAR A FAINT MELODY COMING FROM THE EAST."
30260  DATA "  YOU ARE IN AN EAST/WEST PASSAGE. YOU  CAN VERY CLEARLY HEAR RELIGIOUS MUSIC   BEING PLAYED, AND CAN SMELL INCENSE FROMTHE EAST."
30270  DATA "  YOU ARE IN THE TEMPLE. PICTURES OF    GREAT DEEDS COVER THE WALLS.  THERE ARE TWO ALTARS HERE, ONE COVERED WITH GOLD  PAINT AND THE OTHER STAINED WITH BLOOD. THE ONLY EXIT LEADS TO THE WEST."
30280  DATA "  YOU ARE IN WHAT WAS ONCE OBVIOUSLY A  LIBRARY.  MOST OF THE BOOKS HAVE BEEN   DESTROYED, WITH THE SCRAPS LYING ON THE GROUND. A DOOR, TORN FROM ITS HINGES,   ALSO LIES ON THE GROUND. THE EXIT IS TO THE EAST."
30290  DATA "  YOU ARE IN A T-INTERSECTION.A BRIGHTLYBURNING TORCH IS BOLTED TO THE SOUTH    WALL. DARK TUNNELS LEAD NORTH AND EAST. TO THE WEST IS A PLACE WHERE ONCE A DOORSTOOD, BUT IT HAS BEEN TORN FROM ITS    HINGES."
30300  DATA "  YOU ARE IN A DARK EAST/WEST TUNNEL.   YOU CAN SEE TORCHLIGHT BOTH DIRECTIONS."
30310  DATA "  YOU ARE AT THE TOP OF A FLIGHT OF     STAIRS.  A TORCH IS ON THE WALL. IT     LOOKS VERY DARK DOWN THERE. A TUNNEL    HEADS WEST."
30320  DATA "  YOU ARE AT THE BOTTOM OF A FLIGHT OF  A LIGHT CAN BE SEEN UP AT THE TOP OF THESTAIRS, AND A VERY DIM LIGHT CAN BE SEENDOWN THE TUNNEL TO THE EAST."
30330  DATA "  YOU ARE IN AN EAST/WEST TUNNEL. DIM   LIGHT CAN BE SEEN IN BOTH DIRECTIONS."
30340  DATA "  YOU ARE IN AN EAST/WEST TUNNEL.YOU SEELIGHT TO THE EAST, AND FEEL A COOL WIND COMING FROM THERE. IN THE WIND YOU SMELLA HINT OF SALT."
30350  DATA "  YOU ARE IN A SMALL BAY. HIGH WALLS    SURROUND YOU SO THAT THE ONLY EXIT IS   BACK IN THE TUNNEL TO THE WEST. TO THE  EAST, ON THE BANK OF THE SEA, IS A      BROKEN OLD BOAT."
30360  DATA "THERE IS A PILE OF DIAMONDS HERE!"
30370  DATA "THERE IS A STANDARD MARCOS AXE HERE."
30380  DATA "THERE IS A BOTTLE HERE WITH A STRANGE     POTION INSIDE!"
30390  DATA "THERE IS A POOR QUALITY MARCOS SWORD      HERE."
30400  DATA "THERE ARE 50 GOLD PIECES HERE!"
30410  DATA "THERE IS AN UNMARKED GOLD RING HERE."
30420  DATA "THERE IS A HIGH QUALITY MARCOS MACE       HERE."
30430  DATA "THERE ARE SEVERAL RARE SPICES HERE."
30440  DATA "THERE IS AN OLD BOOK HERE. IT GLOWS IN    THE DARKNESS AND IS REMARKABLY WELL     PRESERVED."
30450  DATA "THERE IS A BEAUTIFUL SWORD HERE WITH      INTRICATE CARVING ON THE HANDLE.        WRITTEN ON THE BLADE IS THE NAME,       'TROLLSFIRE'."
30460  DATA "THERE IS A LARGE PILE OF JEWELS HERE!"
30470  DATA "THERE IS A LARGE CHEST IN THE CENTER OF   THE ROOM."
30480  DATA "THERE IS AN EMPTY BOTTLE HERE."
30490  DATA "THERE IS A DEAD BLACK RAT HERE."
30500  DATA "THERE IS A DEAD BROWN RAT HERE."
30510  DATA "THERE IS A DEAD TAN RAT HERE."
30520  DATA "THE HERMIT'S BODY LIES DEAD HERE."
30530  DATA "THE SHAGGY CORPSE OF A GORILLA IS HERE."
30540  DATA "THE DEAD BODY OF HEINRICH LIES HERE."
30550  DATA "THE DEAD BODY OF THE CHEST-MIMIC IS       SPRAWLED ON THE GROUND."
30560  DATA "THE PRIEST LIES DEAD HERE, STILL WITH A   LOOK OF MANIACAL HATRED ON HIS FACE."
30570  DATA "THE DEAD BODY OF THE GIRL CYNTHIA LIES    HERE."
30580  DATA "THE DEAD BODY OF THE PIRATE IS HERE."
30590  DATA "AS YOU APPROACH THE CHEST, IT SUDDENLY  BECOMES ALIVE AND TWO TENTACLES COME OUTOF THE SIDE, HOLDING YOU FAST.  ANOTHER TENTACLE RISES FROM THE TOP AND ATTEMPTSTO HURT YOU."
30600  DATA "AS THE PIRATE MUTTERS A WORD THAT YOU   CAN'T MAKE OUT, BRIGHT GREEN FLAME      SURROUNDS THE BLADE OF HIS SWORD."
30610  DATA "AS THE PIRATE CHOKES AND DIES, THE FLAMEON HIS SWORD DIES ALSO."
30620  DATA "AS YOU SAY THE SWORD'S NAME (TROLLFIRE),BRIGHT GREEN FLAME APPEARS AROUND THE   SWORD'S BLADE."
30630  DATA "SINCE YOU WERE WEARING THE SWORD WHEN ITFLAMED ON, YOU TAKE SOME BURN DAMAGE    UNTIL THE SWORD (HEARING YOUR CRIES OF  PAIN?) EXTINGUISHES ITS FLAME."
30640  DATA "AS YOU SAY THE SWORD'S NAME, THE BRIGHT GREEN FLAME DISAPPEARS FROM THE SWORD."
30650  DATA "THERE IS A HUGE BLACK RAT WITH SHARP      WHITE TEETH HERE!"
30660  DATA "THERE IS A HUGE BROWN RAT WITH SHARP      WHITE TEETH HERE!"
30670  DATA "THERE IS A HUGE TAN RAT WITH SHARP WHITE  TEETH HERE!"
30680  DATA "THERE IS A GRIZZLED OLD HERMIT (WHO       SMELLS AS IF HE HASN'T TAKEN A BATH     IN FORTY YEARS) IN THE ROOM."
30690  DATA "THERE IS A HUGE, HAIRY, STRONG AND ANGRY  GORILLA IN THE ROOM WITH YOU!"
30700  DATA "A HUMAN WARRIOR STANDS BEFORE YOU, ARMED  A LONG SWORD AND CARRYING A SHIELD.     ON HIS SHIELD IS A STICKER WHICH SAYS,  'HI! I'M HEINRICH!'"
30710  DATA "A CHEST-SHAPED MONSTER IS IN THE ROOM,    HOLDING YOU WITH TWO TENTICLES AND      ATTEMPTING TO DISASSEMBLE YOU WITH A    THIRD."
30720  DATA "THERE IS A HUGE MAN IN RELIGOUS GARB AND  AN INSANE LOOK ON HIS FACE. IN HIS      RIGHT HAND HE CARRIES A MACE."
30730  DATA "YOU SEE A BEAUTIFUL GIRL IN A FLOWING     WHITE DRESS. YOU RECOGNIZE HER AS       CYNTHIA, DUKE LUXOM'S NOT-TOO-BRIGHT    DAUGHTER."
30740  DATA "YOU SEE A MAN WITH A BEARD AND A BRASS    RING IN HIS EAR. HE IS WEARING CLOTHES  MADE OUT OF SILK AND IS WEILDING A      VERY FANCILY ENGRAVED SWORD."
40000  REM  === FAKE INIT ===
40010 D$ =  CHR$ (4):DK$ = D$: PRINT D$"OPEN EAMON.DESC,L256":CNT = 30100: PRINT D$;"READ EAMON.DESC,R0": FOR X = 1 TO 4: INPUT N%(X): NEXT : PRINT D$
40015  PRINT D$;"OPEN TEMP.TEXT": PRINT D$
40020  FOR TY = 1 TO 4
40030  FOR R = 1 TO N%(TY)
40100 REC = 100 * (TY - 1) + R: GOSUB 20000
40110  PRINT D$;"WRITE TEMP.TEXT": PRINT CNT;"DATA"; CHR$ (34);DE$; CHR$ (34):CNT = CNT + 10
40190  NEXT : NEXT : PRINT D$;"CLOSE": END