]> github.com/historicalsource and other repositories - zork2.git/blob - gmacros.zap
Extensions on Z-Machine Fixed.
[zork2.git] / gmacros.zap
1
2
3         .FUNCT  ZPROB,BASE
4         ZERO?   LUCKY /?ELS5
5         RANDOM  100
6         GRTR?   BASE,STACK /TRUE
7         RFALSE  
8 ?ELS5:  RANDOM  300
9         GRTR?   BASE,STACK /TRUE
10         RFALSE  
11
12
13         .FUNCT  RANDOM-ELEMENT,FROB
14         GET     FROB,0
15         RANDOM  STACK
16         GET     FROB,STACK
17         RSTACK  
18
19
20         .FUNCT  PICK-ONE,FROB,L,CNT,RND,MSG,RFROB
21         GET     FROB,0 >L
22         GET     FROB,1 >CNT
23         DEC     'L
24         ADD     FROB,2 >FROB
25         MUL     CNT,2
26         ADD     FROB,STACK >RFROB
27         SUB     L,CNT
28         RANDOM  STACK >RND
29         GET     RFROB,RND >MSG
30         GET     RFROB,1
31         PUT     RFROB,RND,STACK
32         PUT     RFROB,1,MSG
33         INC     'CNT
34         EQUAL?  CNT,L \?CND1
35         SET     'CNT,0
36 ?CND1:  PUT     FROB,0,CNT
37         RETURN  MSG
38
39         .ENDI