Prev: C924 Up: Map Next: C990
C946: Scripts: butler
What butler 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.
BUTLER_SCRIPTS C946 DEFB $00 Key 0, an ordinary script: BUTLER_A
C947 DEFW BUTLER_A
C949 DEFB $0F Key $0F, ATTACK WITH: its reaction, BUTLER_ON_ATTACK_WITH
C94A DEFW BUTLER_ON_ATTACK_WITH
C94C DEFB $1D Key $1D, GIVE TO: its reaction, ON_GIVE_TO
C94D DEFW ON_GIVE_TO
C94F DEFB $FF End of the table
BUTLER_A -- An ordinary script: UNLOCK WITH: red door, red key, OPEN: red door, CLOSE: red door, LOCK WITH: red door, red key, then on as BUTLER_ON_ATTACK_WITH.
BUTLER_A C950 DEFB $02,$26,$08,$0F UNLOCK WITH: red door, red key
C954 DEFB $02,$10,$08,$FF OPEN: red door
C958 DEFB $02,$0C,$08,$FF CLOSE: red door
C95C DEFB $02,$25,$08,$0F LOCK WITH: red door, red key
BUTLER_ON_ATTACK_WITH -- The reaction to ATTACK WITH: CAPTURE, Go to BUTLER_ON_ATTACK_WITH.
BUTLER_ON_ATTACK_WITH C960 DEFB $14,$30 CAPTURE
C962 DEFW BUTLER_B If it is refused: BUTLER_B
C964 DEFB $0E Go to BUTLER_ON_ATTACK_WITH
C965 DEFW BUTLER_ON_ATTACK_WITH
BUTLER_B -- Where a jump or a refusal goes on: OPEN: barrel, DRINK: wine, CAPTURE, CLOSE: barrel, OPEN: large trap door, CAPTURE, TAKE: barrel, THROW THROUGH: barrel, large trap door, CAPTURE, CLOSE: large trap door, CAPTURE, Go to BUTLER_A.
BUTLER_B C967 DEFB $02,$10,$13,$FF OPEN: barrel
C96B DEFB $02,$21,$14,$FF DRINK: wine
C96F DEFB $04,$30 CAPTURE
C971 DEFB $02,$0C,$13,$FF CLOSE: barrel
C975 DEFB $02,$10,$0C,$FF OPEN: large trap door
C979 DEFB $04,$30 CAPTURE
C97B DEFB $02,$13,$13,$FF TAKE: barrel
C97F DEFB $02,$2C,$13,$0C THROW THROUGH: barrel, large trap door
C983 DEFB $04,$30 CAPTURE
C985 DEFB $02,$0C,$0C,$FF CLOSE: large trap door
C989 DEFB $14,$30 CAPTURE
C98B DEFW BUTLER_A If it is refused: BUTLER_A
C98D DEFB $0E Go to BUTLER_A
C98E DEFW BUTLER_A
Prev: C924 Up: Map Next: C990