I was having some issues with my latest WIP when trying to implement asking an NPC to give an item. To check the process, I created a minimal game on zilf.io to show the issue. The transcript shows like this :
INTRODUCTORY TEXT!
EMPTY GAME
An interactive fiction by AUTHOR NAME
Release 1 / Serial number 251217 / ZILF 1.1 lib T3
START ROOM
The maid is here, busily cleaning.
There is a broom and a mop here.
MAID, GIVE MOP
You aren’t holding the mop.
MAID, GIVE BROOM
You aren’t holding the broom.
MAID, GIVE BROOM TO ME
You aren’t holding the broom.
MAID, GIVE MOP TO ME
You aren’t holding the mop.
TAKE MOP
You pick up the mop.
MAID, GIVE MOP TO ME
You don’t see that here.
MAID, EXAMINE ME
DEBUG: IN MARY - M-WINNER ROUTINE CALLED
The maid seems to be busy.
The library seems to check if the ‘player’ is holding the attempted give item instead of the current ‘winner’ (in this example the maid) - and never passes the ‘give’ to the action routine for the NPC to be ‘captured’ by M-WINNER. Where as other ‘commands’ (like examine in the example) are passed over to that routine ? The minimal code I used is :\
"EMPTY GAME main file"
<VERSION XZIP>
<CONSTANT RELEASEID 1>
"Main loop"
<CONSTANT GAME-BANNER
"EMPTY GAME|
An interactive fiction by AUTHOR NAME">
<ROUTINE GO ()
<CRLF> <CRLF>
<TELL "INTRODUCTORY TEXT!" CR CR>
<V-VERSION> <CRLF>
<SETG HERE ,STARTROOM>
<MOVE ,PLAYER ,HERE>
<V-LOOK>
<MAIN-LOOP>>
<INSERT-FILE "parser">
"Objects"
<OBJECT STARTROOM
(IN ROOMS)
(DESC "START ROOM")
(FLAGS LIGHTBIT)>
<OBJECT MARY
(DESC "maid")
(DESCFCN MARY-D)
(IN STARTROOM)
(ACTION MARY-F)
(SYNONYM MARY MAID LADY WOMAN)
(ADJECTIVE YOUNG)
(LASTROOM <>)
(NEWROOM <>)
(FLAGS PERSONBIT FEMALEBIT CONTBIT OPENBIT)
>
<ROUTINE MARY-D (ARG)
<COND (<EQUAL? .ARG ,M-OBJDESC?>
<RTRUE>
)
(T
<TELL CT ,MARY " is here, busily cleaning." CR>
)>
>
<ROUTINE MARY-F ("OPT" ARG "AUX" (CNT 0))
<COND (<EQUAL? .ARG ,M-WINNER>
<TELL "DEBUG: IN MARY - M-WINNER ROUTINE CALLED" CR>
<COND (<VERB? GIVE SGIVE>
;"GIVE ME"
<TELL "DEBUG: IN MARY - ASK TO GIVE" CR>
)
(T
<TELL CT ,MARY " seems to be busy." CR>
<RTRUE>
)>
)
(<VERB? EXAMINE>
<TELL CT ,MARY " is the maid." CR>
<RTRUE>
)>
>
<OBJECT MOP
(DESC "mop")
(SYNONYM MOP)
(IN STARTROOM)
(TEXT "Your basic mop")
(FLAGS TAKEBIT)
>
<OBJECT BROOM
(DESC "broom")
(SYNONYM BROOM)
(IN STARTROOM)
(TEXT "Your basic mop")
(FLAGS TAKEBIT TRYTAKEBIT)
>
Do I need to add something to get ‘give’ to work correctly?
Is there something happening in the PRE-GIVE routine or whatever of the GIVE verb or any other similar verbs? If so, they might be checking there (that, as far as I’m aware, runs before you run any M-WINNER stuff). However, I did personally change how I do stuff with M-WINNER in my game, so maybe not for you. But you should check just in case.
Sorry, Thanks Tara, only just got around to checking this - we added those overrides before the parser include. It’s ‘partially’ working but I still have an issue if I am holding the item I am asking the NPC to ‘give’ where I still get the Library Message DONT-SEE-THAT-HERE ?: Transcript |
INTRODUCTORY TEXT!
EMPTY GAME
An interactive fiction by AUTHOR NAME
Release 1 / Serial number 251219 / ZILF 1.1 lib T3
START ROOM
The maid is here, busily cleaning.
There is a letter, a broom, and a mop here.
maid, give me the broom
DEBUG: IN MARY - M-WINNER ROUTINE CALLED
DEBUG: IN MARY - ASK TO GIVE
maid, give broom to me
DEBUG: IN MARY - M-WINNER ROUTINE CALLED
DEBUG: IN MARY - ASK TO GIVE
I think what’s happening here is that the player’s possessions aren’t in scope for NPCs, just like an NPC’s possessions aren’t in scope for the player. (The “you” in that message refers to the current WINNER, i.e. the NPC being ordered.)
SEE-INSIDE? is the routine that controls this. The simplest workaround for now is to override the routine after including the parser:
<SET REDEFINE T>
<ROUTINE SEE-INSIDE? (OBJ)
<T? <OR ;"Everyone can see the player's possessions"
<==? .OBJ ,PLAYER>
;"We can always see the contents of surfaces"
<FSET? .OBJ ,SURFACEBIT>
;"We can see inside containers if they're open or transparent"
<AND <FSET? .OBJ ,CONTBIT>
<OR <FSET? .OBJ ,OPENBIT>
<FSET? .OBJ ,TRANSBIT>>>>>>
Alternately, I could see this being the intended behavior with a different error message? “The maid doesn’t see that here.” or something along those lines.