Prev: C9D7 Up: Map Next: CA34
C9F0: Scripts: gollum
What gollum does, turn by turn. CHARACTERS_ACT runs one step of a character's script each turn it can, and a step is an action the character tries as if it had typed it: RUN, TAKE, GIVE TO. A step that names nothing acts on whatever fits.
First comes the script table: one entry per script, a key and the script's address. Key 0 is an ordinary script -- the ones a character wanders between, picked at random by a 'switch at random' step. Any other key is an action code, and that script is the character's reaction when that is done to it: attacked, given something, captured.
Then the scripts, one step to a line. A step's first byte says what it is: its low four bits $00-$03 an action with objects (or, $01 and $03, a routine to call), $04 an action with none, $0E go to, $0F switch at random, $0C switch to a reaction. $10 added means an address follows, where the script goes on if the step is refused; $20 that the step is used up once it works (SCRIPT_DO zeroes its first byte); $40 that an order from the player cannot interrupt it. So $14 is an action with no objects, with somewhere to go if it is refused. The Characters page has every script written out.
GOLLUM_SCRIPTS C9F0 DEFB $00 Key 0, an ordinary script: GOLLUM_A
C9F1 DEFW GOLLUM_A
C9F3 DEFB $0F Key $0F, ATTACK WITH: its reaction, GOLLUM_ON_ATTACK_WITH
C9F4 DEFW GOLLUM_ON_ATTACK_WITH
C9F6 DEFB $FF End of the table
GOLLUM_A -- An ordinary script: GOLLUM_ASKS, GOLLUM_HEARS_ANSWER, DROP: valuable golden ring, GO NORTH, then on as GOLLUM_B.
GOLLUM_A C9F7 DEFB $13 Call GOLLUM_ASKS
C9F8 DEFW GOLLUM_ASKS
C9FA DEFB $00 Not used
C9FB DEFW GOLLUM_C If it is refused: GOLLUM_C
C9FD DEFB $43 Call GOLLUM_HEARS_ANSWER (an order cannot interrupt it)
C9FE DEFW GOLLUM_HEARS_ANSWER
CA00 DEFB $00 Not used
CA01 DEFB $02,$0D,$10,$FF DROP: valuable golden ring
CA05 DEFB $14,$01 GO NORTH
CA07 DEFW GOLLUM_E If it is refused: GOLLUM_E
GOLLUM_B -- Where a jump or a refusal goes on: TAKE: valuable golden ring, Go to GOLLUM_A.
GOLLUM_B CA09 DEFB $02,$13,$10,$FF TAKE: valuable golden ring
CA0D DEFB $0E Go to GOLLUM_A
CA0E DEFW GOLLUM_A
GOLLUM_C -- Where a jump or a refusal goes on: GO NORTH, then on as GOLLUM_D.
GOLLUM_C CA10 DEFB $14,$01 GO NORTH
CA12 DEFW GOLLUM_F If it is refused: GOLLUM_F
GOLLUM_D -- Where a jump or a refusal goes on: GOLLUM_POCKETS, TAKE: valuable golden ring, Go to GOLLUM_A.
GOLLUM_D CA14 DEFB $13 Call GOLLUM_POCKETS
CA15 DEFW GOLLUM_POCKETS
CA17 DEFB $00 Not used
CA18 DEFW GOLLUM_A If it is refused: GOLLUM_A
CA1A DEFB $02,$13,$10,$FF TAKE: valuable golden ring
CA1E DEFB $0E Go to GOLLUM_A
CA1F DEFW GOLLUM_A
GOLLUM_E -- Where a jump or a refusal goes on: GO SOUTHWEST, Go to GOLLUM_B.
GOLLUM_E CA21 DEFB $04,$08 GO SOUTHWEST
CA23 DEFB $0E Go to GOLLUM_B
CA24 DEFW GOLLUM_B
GOLLUM_F -- Where a jump or a refusal goes on: GO SOUTHWEST, Go to GOLLUM_D.
GOLLUM_F CA26 DEFB $04,$08 GO SOUTHWEST
CA28 DEFB $0E Go to GOLLUM_D
CA29 DEFW GOLLUM_D
GOLLUM_ON_ATTACK_WITH -- The reaction to ATTACK WITH: WEAR: valuable golden ring, RUN, Go to GOLLUM_A.
GOLLUM_ON_ATTACK_WITH CA2B DEFB $02,$28,$10,$FF WEAR: valuable golden ring
CA2F DEFB $04,$24 RUN
CA31 DEFB $0E Go to GOLLUM_A
CA32 DEFW GOLLUM_A
Prev: C9D7 Up: Map Next: CA34