Prev: 9918 Up: Map Next: 9974
9928: A script step: an action with objects, or a routine
Used by the routine at CHARACTERS_ACT.
Four bytes, then a 2-byte fallback if bit 4 is set. With bit 0 clear they are the action code and its two objects, tried as the character's own sentence. With bit 0 set, bytes 1 and 2 are the address of a routine instead: it is run once with printing off as a test, and only if it reports success by setting SUCCEEDED is it run again for real.
A step that succeeds with bit 5 set is used up: the LD (IX+$00),$00 near its end writes zero over its own first byte -- IX is the step, not the character's slot -- so it never calls its routine again. The character goes on as before. Only Thorin's remark about the small curious key has the bit. Tried in the simulator: Thorin took the key, said his line the next turn, and went on following the player, his slot unchanged, while the step's first byte went from $23 to $00. The scripts are not among what a new game copies back, so the step stays spent until the game is loaded again.
SCRIPT_DO 9928 CALL STEP_PAST Step past it
992B BIT 0,(IX+$00) A routine?
992F JR NZ,SCRIPT_DO_0
9931 LD A,(IX+$01) The action and its two objects
9934 LD (ACTION),A
9937 LD A,(IX+$02)
993A LD (TARGET),A
993D LD A,(IX+$03)
9940 LD (INSTRUMENT),A
9943 CALL ACTOR_TRIES Try it: done, or refused
9946 JR Z,STEP_REFUSED
9948 JR SCRIPT_DO_1
SCRIPT_DO_0 994A LD L,(IX+$01) The routine: run it quietly, and if it succeeded, again for real
994D LD H,(IX+$02)
9950 SUB A
9951 LD (DOING_IT),A
9954 LD (SUCCEEDED),A
9957 CALL RUN_ROUTINE
995A LD A,(SUCCEEDED)
995D CP $01
995F JR NZ,STEP_REFUSED
9961 LD (DOING_IT),A
9964 CALL RUN_ROUTINE
SCRIPT_DO_1 9967 BIT 5,(IX+$00) Done. Bit 5: this step is used up, its first byte zeroed
996B JP Z,NEXT_CHARACTER
996E LD (IX+$00),$00
9972 JR NEXT_CHARACTER
Prev: 9918 Up: Map Next: 9974