-
Notifications
You must be signed in to change notification settings - Fork 1
/
C1GADV3.m
62 lines (62 loc) · 3.27 KB
/
C1GADV3.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
C1GADV3 ;ADVENTURE. FLH, DJW/WV ; 27 JAN 83 12:32 PM
;;1.0;C1GAMES;****;March 1, 2016;
;ADVENTURE. FLH ; 27 JAN 83 12:32 PM
;PRX;24Apr89 18:52;Copyright (c) 1989 PRx, Inc.
; DJW/WV ;March 1, 2016
TURN S (VERB,OBJ)="" D:M SPK
TU1 F J=4:1:9 I 'HINTED(J) S HINTLC(J)=$S($E(CONDLP,5)=J:HINTLC(J)+1,1:0) I HINTLC(J)'<HINTH(J) D HINT^C1GADV9
I CLOSED,TOTING["/OYSTE/" S O="OYSTE",P=1 I ^C1GADV(71100.1,G,O,"P")<0 D PSPK
I CLOSED F J=2:1:HOLDNG+1 S O=$P(TOTING,"/",J),P=^C1GADV(71100.1,G,O,"P") I P<0 S ^("P")=-P-1
S WZDARK=DARK I KNFL>0,KNFL-LP S KNFL=0
D GETIN
TU3 S FOOBAR=$S(FOOBAR>0:-FOOBAR,1:0),TURNS=TURNS+1,WD1=U1,WD2=U2,(WD1X,WD2X)=""
G1 I WD1?1.U.E,$D(^C1GADV(71100,WD1)) S WD1X=^(WD1) I WD1X?1"0".E S WD1=$E(WD1X,2,99) G G1
G2 I WD2?1.U.E,$D(^C1GADV(71100,WD2)) S WD2X=^(WD2) I WD2X?1"0".E S WD2=$E(WD2X,2,99) G G2
I TALLY=0,LP>14,LP-33 S CLK1=CLK1-1 I CLK1=0 D CLOSEUP^C1GADV8 G WD1
I CLK1<0 S CLK2=CLK2-1 I CLK2=0 D CLOSED^C1GADV8 G NEWLP^C1GADV2
S LIMIT=LIMIT-LIT I LIMIT<31 D LAMP^C1GADV8 I GAVEUP G SCORE^C1GADV8
WD1 I WD1="ENTER",WD2="WATER"!(WD2="STREA") S M=$S($E(CONDLP,4)=1:70,1:43) G TURN
I WD1="WATER"!(WD1="OIL"),WD2="PLANT"!(WD2="DOOR") S WD2="POUR",WD2X=^C1GADV(71100,WD2)
G WD2A
WD2 S WD1=WD2,W1=W2,U1=U2,WD1X=WD2X,(WD2,W2,U2,WD2X)=""
WD2A I WD1X="" S I=$R(10000),M=$S(I<2000:13,I<3600:61,1:60) G TURN
I U1="WEST",$R(10000)<2000 S M=17 D SPK
G @$P("TRAVEL/OBJECT/ACTION/SPEC","/",$E(WD1X))
TRAVEL S LNEW=LP,MOV=WD1,MOX=$E(WD1X,2,99) I MOX?3U.E D @MOX G NEWLP^C1GADV2
S LP2=LP1,LP1=LP
TR1 I $D(^C1GADV(71100,LP,MOV,0)) F J=1:1:^(0) S Y=^C1GADV(71100,LP,MOV,J) X $P(Y,"\",1) I S RET="NEWLP^C1GADV2" D @$P(Y,"\",2) G @RET
S M=$S(VERB="FIND"!(VERB="INVEN"):59,MOX:MOX,1:12) D SPK G NEWLP^C1GADV2
TR2 S LNEW=$P(Y,"\",3) Q
TR3 S M=$P(Y,"\",3) D SPK Q
OBJECT S (O,OBJ)=WD1 D HERE E I ^C1GADV(71100.1,G,O,"F")-LP G OBJ2
OBJ1 G WD2:WD2]"",ACT1:VERB]"" W:S ! W !,"What do you want to do with the ",W1,"?" G TU1
OBJ2 I OBJ="GRATE" S OBJ=$S(LP=1!(LP=4)!(LP=7):"DEPRE",LP>9&(LP<15):"ENTRA",1:OBJ) I OBJ'="GRATE" S WD1=OBJ,WD1X=^C1GADV(71100,OBJ) G TRAVEL
I OBJ="DWARF",DFLAG>1 F DW=1:1:5 I LD(DW)=LP G OBJ1
I OBJ=$P("WATER/OIL","/",$E(CONDLP,4)) G OBJ1
D LIQ I O=OBJ S O="BOTTL" D HERE I G OBJ1
I OBJ="PLANT" S O="PLANT2" D AT I I ^C1GADV(71100.1,G,O,"P")=0 S OBJ=O G OBJ1
I OBJ="ROD" S O="ROD2" D HERE I S OBJ=O G OBJ1
I OBJ="KNIFE",KNFL=LP S KNFL=-1,M=116 G TURN
I OBJ="BRIEF" S:WD2="" WD2="ON",WD2X=^C1GADV(71100,"ON") G OBJ1
OBNONE I WD2="",VERB="FIND"!(VERB="INVEN") G OBJ1
W:S ! W !,"I don't see any ",W1,"." S M=0 G TURN
ACTION S VERB=WD1,VBX=WD1X I VERB="SAY" S OBJ=WD2
E G:WD2]"" WD2
ACT1 S M=$P(VBX,"/",2),RET="TURN" D @$P(VBX,"/",OBJ]""+3) G @RET
AVQ Q
SPEC S M=$E(WD1X,2,99) G TURN
GETIN D KBD
S W1=$P(W," ",1),W2=$P(W," ",2),U1=$E($P(SAVE," ",1),1,5),U2=$E($P(SAVE," ",2),1,5) K SAVE Q
KBD W:S ! R !,W:600 G:'$T TIMO^C1GADV
I W="^"!(W="^Q") S W="QUIT" ;MSM;24Apr89
S SAVE=W F I=1:1 Q:SAVE?.CNPU I $E(SAVE,I)?1L S SAVE=$E(SAVE,1,I-1)_$C($A(SAVE,I)-32)_$E(SAVE,I+1,99)
K I Q
SPK W:S ! F I=1:1:^C1GADV(71100,"t",M,0) W !,^(I)
K I Q
PSPK S N=^C1GADV(71100,O,P,0) I N W:S ! F I=.1:.1:N W !,^(I)
K I,N Q
HERE S L=^C1GADV(71100.1,G,O,"L") I L<0!(L=LP)
K L Q
AT I ^C1GADV(71100.1,G,O,"L")=LP!(^("F")=LP)
Q
LIQ S O=^C1GADV(71100.1,G,"BOTTL","P") S:O<0 O=-1-O S O=$P("WATER//OIL","/",O+1) Q