Prev: C990 Up: Map Next: C9D7
C9B1: Scripts: red golden dragon
What red golden dragon 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.
RED_GOLDEN_DRAGON_SCRIPTS C9B1 DEFB $00 Key 0, an ordinary script: RED_GOLDEN_DRAGON_A
C9B2 DEFW RED_GOLDEN_DRAGON_A
C9B4 DEFB $0F Key $0F, ATTACK WITH: its reaction, RED_GOLDEN_DRAGON_ON_ATTACK_WITH
C9B5 DEFW RED_GOLDEN_DRAGON_ON_ATTACK_WITH
C9B7 DEFB $FF End of the table
RED_GOLDEN_DRAGON_A -- An ordinary script: DRAGON_HUNTS, Go to RED_GOLDEN_DRAGON_A.
RED_GOLDEN_DRAGON_A C9B8 DEFB $13 Call DRAGON_HUNTS
C9B9 DEFW DRAGON_HUNTS
C9BB DEFB $00 Not used
C9BC DEFW RED_GOLDEN_DRAGON_B If it is refused: RED_GOLDEN_DRAGON_B
C9BE DEFB $0E Go to RED_GOLDEN_DRAGON_A
C9BF DEFW RED_GOLDEN_DRAGON_A
RED_GOLDEN_DRAGON_B -- Where a jump or a refusal goes on: DRAGON_FOLLOWS, DRAGON_THREATENS, then on as RED_GOLDEN_DRAGON_ON_ATTACK_WITH.
RED_GOLDEN_DRAGON_B C9C1 DEFB $13 Call DRAGON_FOLLOWS
C9C2 DEFW DRAGON_FOLLOWS
C9C4 DEFB $00 Not used
C9C5 DEFW RED_GOLDEN_DRAGON_C If it is refused: RED_GOLDEN_DRAGON_C
C9C7 DEFB $13 Call DRAGON_THREATENS
C9C8 DEFW DRAGON_THREATENS
C9CA DEFB $00 Not used
C9CB DEFW RED_GOLDEN_DRAGON_C If it is refused: RED_GOLDEN_DRAGON_C
RED_GOLDEN_DRAGON_ON_ATTACK_WITH -- The reaction to ATTACK WITH: BURN, Go to RED_GOLDEN_DRAGON_A.
RED_GOLDEN_DRAGON_ON_ATTACK_WITH C9CD DEFB $04,$2D BURN
C9CF DEFB $0E Go to RED_GOLDEN_DRAGON_A
C9D0 DEFW RED_GOLDEN_DRAGON_A
RED_GOLDEN_DRAGON_C -- Where a jump or a refusal goes on: RUN, Go to RED_GOLDEN_DRAGON_A.
RED_GOLDEN_DRAGON_C C9D2 DEFB $04,$24 RUN
C9D4 DEFB $0E Go to RED_GOLDEN_DRAGON_A
C9D5 DEFW RED_GOLDEN_DRAGON_A
Prev: C990 Up: Map Next: C9D7