home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib24b.dsk
/
ACS.WRITER.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
11KB
|
260 lines
10 REM **********************
20 REM * ACS.WRITER *
30 REM * BY JENNY SCHMIDT *
40 REM * COPYRIGHT (C) 1985 *
50 REM * BY MICROSPARC, INC *
60 REM * CONCORD, MA 01742 *
70 REM **********************
80 DIM D$(100),N%(100),S%(100),E%(100),W%(100),U%(100),D%(100),CT%(750),A$(750),O$(300),V%(300),R%(300),CH%(16)
90 D$ = CHR$(4): IF PEEK(768) < >32 OR PEEK(800) < >2 THEN GOSUB 2560
100 CH$ = "IMOGRCFPAS+-T$JQ"
110 FOR W = 1 TO 16:CH%(W) = ASC( MID$ (CH$,W,1)): NEXT W
120 HOME : VTAB 2: HTAB 15: PRINT "ACS.WRITER": VTAB 3: HTAB 12: PRINT "BY JENNY SCHMIDT": VTAB 5: PRINT "** COPYRIGHT 1985 BY MICROSPARC, INC **": VTAB 12
130 PRINT "ADVENTURE NAME (11 CHAR MAX, ?-CATALOG)": INPUT N$
140 IF LEN(N$) >11 GOTO 200
150 X$ = LEFT$(N$,1): IF X$ = "?" THEN HOME : PRINT D$"CATALOG": PRINT : PRINT "PRESS ANY KEY TO CONTINUE";: GET I$: GOTO 130
160 IF X$ <"A" OR X$ >"Z" THEN 200
170 IF LEN(N$) <2 GOTO 210
180 FOR I = 2 TO LEN(N$):Y$ = MID$ (N$,I,1): IF (Y$ <"0" AND Y$ < >".") OR Y$ >"Z" OR (Y$ >"9" AND Y$ <"A") THEN I = LEN(N$): NEXT : GOTO 200
190 NEXT : GOTO 210
200 PRINT "INVALID FILE NAME": PRINT "PRESS ANY KEY TO CONTINUE": GET I$: GOTO 130
210 PRINT : INPUT "SLOT # OF PRINTER (0 IF NONE)? ";P$:P = INT( VAL(P$)):PR$ = "": IF P <0 OR P >7 GOTO 210
220 HOME : VTAB 10: HTAB 12: PRINT "(D)ESCRIPTIONS": PRINT : HTAB 12: PRINT "(O)BJECTS": PRINT : HTAB 12: PRINT "(A)CTIONS"
230 PRINT : HTAB 12: PRINT "(Q)UIT": PRINT : PRINT : HTAB 12: PRINT "OPTION: ";:IL$ = I$: GET I$: PRINT I$
240 IF I$ = "A" THEN 740
250 IF I$ = "O" THEN 1640
260 IF I$ = "Q" GOTO 2430
270 IF I$ < >"D" THEN 220
275 TT = 100
280 HOME : IF IL$ = I$ THEN 320
290 N = 0:SF = 0
300 N1 = 0
310 N = N +1
320 IF N1 <N THEN N1 = N
330 PRINT "SECTION "N"-": CALL 768,Q$
340 IF Q$ = "" THEN 420
350 IF VAL(Q$) >0 THEN N = VAL(Q$): GOTO 320
360 IF Q$ = "LIST" THEN 440
370 IF Q$ = "QUIT" THEN GOSUB 2130: ON SF GOTO 220,320
380 IF Q$ = "SAVE" THEN 510
390 IF Q$ = "LOAD" THEN 620
400 IF Q$ = "?" THEN GOSUB 2450: HOME : GOTO 330
410 D$(N) = Q$
420 SF = 1: INPUT "NORTH? ";N%(N): INPUT "SOUTH? ";S%(N): INPUT "EAST? ";E%(N): INPUT "WEST? ";W%(N): INPUT "UP? ";U%(N): INPUT "DOWN? ";D%(N)
430 GOTO 310
440 PRINT : INPUT "LIST TO PRINTER? ";YN$:YN$ = LEFT$(YN$,1)
450 PRINT D$;"PR#";P *(YN$ = "Y"):PE = 0: IF YN$ = "Y" THEN PE = 1
460 FOR W = 1 TO N1 -1
470 PRINT "SECTION "W"-": GOSUB 2400: PRINT " N:"N%(W)" S:"S%(W)" E:"E%(W)" W:"W%(W)" U:"U%(W)" D:"D%(W)
480 NEXT W
490 PRINT D$;"PR#0"
500 GOTO 330
510 ES$ = "DESCRIPTION":ES = 1
520 ONERR GOTO 2220
530 PRINT D$;"OPEN DES.";N$: PRINT D$;"CLOSE DES.";N$
540 PRINT D$;"DELETE DES.";N$: PRINT D$;"OPEN DES.";N$
550 PRINT D$;"WRITE DES.";N$
560 PRINT N1 -1
570 FOR W = 1 TO N1 -1
580 PRINT CHR$(34)D$(W): PRINT N%(W): PRINT S%(W): PRINT E%(W): PRINT W%(W): PRINT U%(W): PRINT D%(W)
590 NEXT W
600 PRINT D$;"CLOSE DES.";N$
610 SF = 0: GOTO 330
620 ES$ = "DESCRIPTION":ES = 1
630 ONERR GOTO 2230
640 PRINT D$;"OPEN DES.";N$: PRINT D$;"READ DES.";N$
650 INPUT N1
660 FOR W = 1 TO N1
670 INPUT D$(W): INPUT N%(W): INPUT S%(W): INPUT E%(W): INPUT W%(W): INPUT U%(W): INPUT D%(W)
680 NEXT W
690 PRINT D$"CLOSE DES.";N$
700 POKE 216,0
710 PRINT N1" DESCRIPTION(S) LOADED"
720 N1 = N1 +1:N = N1
730 GOTO 330
740 N = 1:SF = 0
750 HOME
760 INPUT "ARE THESE ACTIONS USER PROMPTED? ";L$: IF LEFT$(L$,1) = "Y" THEN L$ = "USR." +N$:TA$ = "USER-PROMPTED":TT = 750: GOTO 780
770 TA$ = "NON-USER-PROMPTED":L$ = "NUP." +N$:TT = 400
780 CT%(N) = 0:I = 0
790 W = N: GOSUB 2180
800 CALL 768,I$
810 IF I$ = "" OR LEFT$(I$,1) = "X" THEN N = N -1: GOTO 850
820 I = I +1: IF MID$ (I$,I,1) = " " OR MID$ (I$,I,1) = "." GOTO 820
830 A$(N) = MID$ (I$,I):CT%(N) = I -1:SF = 1
840 N = N +1: ON (N >TT) +1 GOTO 780,2550
850 HOME : VTAB 6: HTAB 8: PRINT TA$" ACTIONS": VTAB 8: HTAB 10: PRINT "(LI)ST": PRINT : HTAB 10: PRINT "(D)ELETE": PRINT : HTAB 10: PRINT "(I)NSERT": PRINT : HTAB 10: PRINT "(S)AVE": PRINT : HTAB 10: PRINT "(LO)AD"
860 PRINT : HTAB 10: PRINT "(E)DIT
870 PRINT : HTAB 10: PRINT "(Q)UIT"
880 PRINT : PRINT : HTAB 10: PRINT "OPTION:";: GET I$: PRINT I$;
890 IF I$ = "E" THEN PRINT : GOTO 840
900 IF I$ = "Q" THEN PRINT : GOSUB 2130: ON SF GOTO 220,850
910 IF I$ < >"L" THEN 1070
920 GET I$: PRINT I$: IF I$ = "O" GOTO 1520
930 IF I$ < >"I" GOTO 850
940 PRINT : INPUT "LIST TO PRINTER? ";YN$:YN$ = LEFT$(YN$,1)
950 PRINT D$;"PR#";P *(YN$ = "Y"): IF YN$ = "Y" THEN PRINT PR$;
960 HOME : TEXT
970 REM :N = N - 1
980 PRINT TA$" ACTIONS:"
990 FOR W = 1 TO N
1000 GOSUB 2180
1010 IF CT%(W) = 0 THEN 1030
1020 FOR Q = 1 TO CT%(W): PRINT ".";: NEXT Q
1030 PRINT A$(W)
1040 NEXT W
1050 PRINT D$;"PR#0"
1060 GOTO 840
1070 IF I$ < >"D" THEN 1190
1080 HOME : TEXT
1090 INPUT "DELETE FROM ";X$:F = INT( VAL(X$)): INPUT "TO ";X$:T = INT( VAL(X$))
1100 IF (T <F) OR (T >N) OR (F <1) OR (T <1) OR (F >N) THEN PRINT "RANGE ERROR-NO LINES DELETED": PRINT "PRESS ANY KEY TO CONTINUE": GET T$: GOTO 850
1110 F1 = F
1120 T = T +1
1130 FOR W = T TO N
1140 A$(F) = A$(W):CT%(F) = CT%(W)
1150 F = F +1
1160 NEXT W
1170 N = N -T +F1
1180 GOTO 850
1190 IF I$ < >"I" THEN 1330
1200 HOME : TEXT
1210 INPUT "INSERT BEFORE WHICH LINE ? ";X$:F = INT( VAL(X$)): IF N >(TT -1) THEN PRINT "TOO MANY LINES": GOSUB 2540: GOTO 850
1220 IF (F >N) OR (F <1) THEN PRINT "NO SUCH LINE": PRINT "PRESS ANY KEY TO CONTINUE": GET T$: GOTO 850
1230 FOR W = N TO F STEP -1
1240 A$(W +1) = A$(W):CT%(W +1) = CT%(W)
1250 NEXT W:N = N +1
1260 CT%(F) = 0:I = 0
1270 W = F: GOSUB 2180
1280 CALL 768,I$
1290 I = I +1: IF MID$ (I$,I,1) = " " OR MID$ (I$,I,1) = "." GOTO 1290
1300 CT%(F) = I -1:A$(F) = MID$ (I$,I)
1310 INPUT "INSERT ANOTHER LINE? ";Q$: IF LEFT$(Q$,1) = "Y" THEN F = F +1: GOTO 1230
1320 GOTO 850
1330 IF I$ < >"S" THEN 850
1340 PRINT : IF N <2 THEN 850
1350 FOR W = 1 TO N: FOR Q = 1 TO 16
1360 IF ASC( LEFT$(A$(W),1)) < >CH%(Q) THEN NEXT Q
1370 IF Q = 17 THEN PRINT "ERROR IN LINE ";W: GOSUB 2080: GET I$:W = N: NEXT W: GOTO 850
1380 A$(W) = MID$ (A$(W),2)
1390 IF Q <10 THEN A$(W) = STR$(Q) +" " +A$(W): GOTO 1410
1400 A$(W) = STR$(Q) +A$(W)
1410 PRINT ".";:Q = 16: NEXT Q: NEXT W: PRINT
1420 ONERR GOTO 2230
1430 ES$ = TA$ +" ACTIONS":ES = 2
1440 PRINT D$;"OPEN";L$: PRINT D$;"CLOSE";L$: PRINT D$;"DELETE";L$: PRINT D$;"OPEN";L$
1450 PRINT D$;"WRITE";L$
1460 PRINT N
1470 FOR W = 1 TO N
1480 PRINT CHR$(34)A$(W): PRINT CT%(W)
1490 NEXT W
1500 PRINT D$;"CLOSE";L$:W = N +1: POKE 216,0: GOSUB 2080
1510 SF = 0: GOTO 850
1520 PRINT : INPUT "LOAD ACTIONS? ";YN$: IF YN$ < >"Y" GOTO 850
1530 ES$ = TA$ +" ACTIONS":ES = 2: ONERR GOTO 2230
1540 PRINT D$;"OPEN";L$
1550 PRINT D$;"READ";L$
1560 INPUT N
1570 FOR W = 1 TO N
1580 INPUT A$(W): INPUT CT%(W)
1590 Q = VAL( LEFT$(A$(W),2)):A$(W) = MID$ (A$(W),3):A$(W) = CHR$(CH%(Q)) +A$(W)
1600 NEXT W
1610 PRINT D$;"CLOSE";L$
1620 POKE 216,0
1630 GOTO 850
1640 HOME : IF I$ = IL$ THEN 1680
1650 N = 0:SF = 0
1660 N1 = 0
1670 N = N +1
1680 IF N1 <N THEN N1 = N
1690 PRINT "OBJECT "N": ": CALL 768,Q$
1700 IF VAL(Q$) >0 THEN N = VAL(Q$): GOTO 1680
1710 IF Q$ = "LIST" THEN 1800
1720 IF Q$ = "QUIT" THEN GOSUB 2130: ON SF GOTO 220,1680
1730 IF Q$ = "SAVE" THEN 1870
1740 IF Q$ = "LOAD" THEN 1970
1750 IF Q$ = "?" THEN GOSUB 2450: HOME : GOTO 1690
1760 IF Q$ = "" THEN 1690
1770 O$(N) = Q$:SF = 1
1780 INPUT "VALUE: ";V%(N): INPUT "SECTION: ";R%(N)
1790 GOTO 1670
1800 PRINT : INPUT "LIST TO PRINTER? ";YN$:YN$ = LEFT$(YN$,1)
1810 PRINT D$;"PR#";P *(YN$ = "Y"): IF YN$ = "Y" THEN PRINT PR$;
1820 FOR W = 1 TO N1 -1
1830 PRINT "OBJECT "W": "O$(W): PRINT " VALUE: ";V%(W);" SECTION: ";R%(W)
1840 NEXT W
1850 PRINT D$;"PR#0"
1860 GOTO 1690
1870 ES$ = "OBJECTS":ES = 2: ONERR GOTO 2220
1880 PRINT D$;"OPEN OBJ.";N$: PRINT D$;"CLOSE OBJ.";N$: PRINT D$;"DELETE OBJ.";N$: PRINT D$;"OPEN OBJ.";N$
1890 PRINT D$;"WRITE OBJ.";N$
1900 PRINT N1 -1
1910 FOR W = 1 TO N1 -1
1920 PRINT CHR$(34)O$(W): PRINT V%(W): PRINT R%(W)
1930 NEXT W
1940 PRINT D$;"CLOSE OBJ.";N$
1950 POKE 216,0
1960 SF = 0: GOTO 1690
1970 ES$ = "OBJECTS":ES = 3: ONERR GOTO 2230
1980 PRINT D$;"OPEN OBJ.";N$: PRINT D$;"READ OBJ.";N$
1990 INPUT N1
2000 FOR W = 1 TO N1
2010 INPUT O$(W): INPUT V%(W): INPUT R%(W)
2020 NEXT W
2030 PRINT D$;"CLOSE OBJ.";N$
2040 POKE 216,0
2050 PRINT N1" OBJECT(S) LOADED"
2060 N1 = N1 +1:N = N1
2070 GOTO 1690
2080 FOR K = 1 TO W -1
2090 Q = VAL( LEFT$(A$(K),2)):A$(K) = MID$ (A$(K),3):A$(K) = CHR$(CH%(Q)) +A$(K)
2100 NEXT K
2110 RETURN
2120 END
2130 REM QUIT CHECKER
2140 IF NOT SF THEN 2170
2150 INPUT "QUIT WITHOUT SAVING? ";YN$
2160 IF LEFT$(YN$,1) < >"Y" THEN SF = 2: RETURN
2170 SF = 1: RETURN
2180 REM PAD LINE NUMBER N WITH LEADING 0'S
2190 NS$ = STR$(W):NL = LEN(NS$): IF NL >2 THEN 2210
2200 PRINT LEFT$("00",3 -NL);
2210 PRINT NS$" ";: RETURN
2220 EL = 1: GOTO 2240: REM ENTRY POINT FOR DISK WRITE
2230 EL = 2: REM ENTRY POINT FOR DISK READ
2240 ER = PEEK(222)
2250 IF ER = 4 THEN PRINT "DISK WRITE PROTECTED": GOTO 2340
2260 IF ER = 5 THEN PRINT "FILE NOT FOUND OR EMPTY": GOTO 2340
2270 IF ER = 6 THEN PRINT "FILE NOT FOUND": GOTO 2340
2280 IF ER = 8 THEN PRINT "DISK I/O ERROR": GOTO 2340
2290 IF ER = 9 THEN PRINT "DISK FULL": GOTO 2340
2300 IF ER = 10 THEN PRINT "FILE LOCKED": GOTO 2340
2310 IF ER = 11 THEN PRINT "ILLEGAL FILE NAME": GOTO 2340
2320 IF ER = 13 THEN PRINT "FILE TYPE MISMATCH": GOTO 2340
2330 PRINT "ERROR #";ER" IN LINE "; PEEK(218) + PEEK(219) *256
2340 IF EL = 1 THEN EL$ = "WRITE": GOTO 2360
2350 EL$ = "READ"
2360 PRINT "UNABLE TO "EL$: PRINT ES$" FILE."
2370 PRINT D$"CLOSE": PRINT "PRESS ANY KEY TO CONTINUE": GET T$
2380 POKE 216,0
2390 ON ES GOTO 290,850,1640
2400 IF PE = 0 THEN PRINT D$(W): RETURN
2410 DL = LEN(D$(W)):LN = INT(DL/40)
2420 FOR I = 1 TO LN: PRINT MID$ (D$(W),40 *I -39,40): NEXT : PRINT MID$ (D$(W),40 *I -39): RETURN
2430 PRINT : INPUT "RUN ACS.PLAYER? ";YN$: IF LEFT$(YN$,1) = "Y" THEN PRINT D$"RUN ACS.PLAYER"
2440 END
2450 HOME : PRINT "DESCRIPTION AND OBJECT EDITOR COMMANDS"
2460 PRINT "ALL COMMANDS ENTERED AT FIRST PROMPT."
2470 PRINT : PRINT "<RETURN>";: HTAB 10:: PRINT "DESCRIPTIONS ONLY:": HTAB 10: PRINT "SKIPS TO NEXT PROMPT,": HTAB 10: PRINT "PRESERVING PREVIOUS CONTENTS."
2480 PRINT : PRINT "SAVE";: HTAB 10: PRINT "SAVES .DES OR .OBJ FILE."
2490 PRINT : PRINT "LOAD";: HTAB 10: PRINT "LOADS .DES OR .OBJ FILE."
2500 PRINT : PRINT "LIST";: HTAB 10: PRINT "LISTS DESCRIPTIONS OR OBJECTS": HTAB 10: PRINT "CURRENTLY IN MEMORY."
2510 PRINT : PRINT "NNN";: HTAB 10: PRINT "EDIT DESCRIPTION OR OBJECT": HTAB 10: PRINT "SPECIFIED BY NNN."
2520 PRINT : PRINT "QUIT";: HTAB 10: PRINT "RETURN TO MAIN MENU.": HTAB 10: PRINT "'QUIT WITHOUT SAVING?' IF": HTAB 10: PRINT "CHANGES SINCE LAST SAVE."
2530 PRINT : PRINT "?";: HTAB 10: PRINT "FOR HELP: THIS LIST!"
2540 PRINT : PRINT "PRESS ANY KEY WHEN READY";: GET T$: RETURN
2550 PRINT "TOO MANY LINES":N = N -1: GOSUB 2540: GOTO 850
2560 FOR I = 0 TO 70: READ ML: POKE 768 +I,ML: NEXT I: RETURN
2570 DATA 32,190,222,32,227,223,36,17,208,5,162,163,76,18,212,133,133,132,134,165,184,164,185,133,135,132
2580 DATA 136,32,44,213,173,0,2,201,3,208,3,76,99,216,169,0,133,13,133,14,169,0,160,2,32,237
2590 DATA 227,32,61,231,32,123,218,165,135,164,136,133,184,132,185,32,183,0,96,0