Prev: 7AED Up: Map Next: 7B63
7AF5: Would the action in ACTION to INSTRUMENT work? Try it as a test
Used by the routine at ACTOR_TRIES.
The action is run through DO_ACTION with DOING_IT clear. That flag is not only whether anything is printed: it is whether the action is done for real, and with it clear a handler only says, by setting SUCCEEDED, whether it would work -- the same test-then-do that SCRIPT_DO uses for a script's own routines. ACTOR_TRIES calls this first, and does the action for real only if it answers yes.
Patterns with bits 2 or 3 of FLAGS_FIRST_WORDS, which have objects to be matched, go through MATCH_AND_TRY instead, not yet worked out.
Output
F NZ if it would work
WOULD_WORK 7AF5 PUSH HL
7AF6 PUSH IY
7AF8 PUSH IX
7AFA PUSH DE
7AFB PUSH BC
7AFC LD HL,(TARGET_SEARCH) Keep TARGET_SEARCH
7AFF PUSH HL
7B00 LD A,(ACTION) IX = the action's pattern
7B03 CALL PATTERN_OF
7B06 PUSH HL
7B07 POP IX
7B09 CALL CLEAR_PHRASES Not yet worked out
7B0C CALL PATTERN_FLAGS
7B0F CALL PATTERN_OPTIONS
7B12 LD A,(TARGET) The two objects' names, into TARGET_NAME and INSTRUMENT_NAME
7B15 LD B,A
7B16 LD A,(TARGET_IS_PLACE)
7B19 LD DE,TARGET_NAME
7B1C CALL NAME_OF_NUMBER
7B1F LD A,(INSTRUMENT)
7B22 LD B,A
7B23 LD A,(INSTRUMENT_IS_PLACE)
7B26 LD DE,INSTRUMENT_NAME
7B29 CALL NAME_OF_NUMBER
7B2C CALL RESTART_TARGETS Not yet worked out
7B2F XOR A Only a test
7B30 LD (DOING_IT),A
7B33 LD A,(FLAGS_FIRST_WORDS) Objects to match? MATCH_AND_TRY
7B36 AND $0C
7B38 JR NZ,WOULD_WORK_0
7B3A CALL DO_ACTION Otherwise try it: SUCCEEDED says whether it worked
7B3D LD A,(SUCCEEDED)
7B40 AND A
7B41 JR WOULD_WORK_2
WOULD_WORK_0 7B43 LD A,$01 MATCH_AND_TRY answers instead
7B45 LD (WITH_ALL),A
7B48 CALL MATCH_AND_TRY
7B4B JR Z,WOULD_WORK_1
7B4D XOR A
7B4E JR WOULD_WORK_2
WOULD_WORK_1 7B50 OR $01 It would work
WOULD_WORK_2 7B52 LD A,$01 For real again
7B54 LD (DOING_IT),A
7B57 POP HL
7B58 LD (TARGET_SEARCH),HL
7B5B POP BC
7B5C POP DE
7B5D POP IX
7B5F POP IY
7B61 POP HL
7B62 RET
Prev: 7AED Up: Map Next: 7B63