Inform: Problems with "ask," "ask about," etc.


28 Aug 1995 17:23:34 GMT

ceforma@rs6000.cmp.ilstu.edu (Christopher E. Forman) writes:
>So my question is: if the player types "ASK character FOR item," what exactly
>is stored in such Inform variables as "verb," "noun," and "second," and how
>can I change the above bit of code so that AskFor and Order will have the same
>effect as Ask (about)?

The Inform library (since version 5/11) defines a seperate 'AskFor' action
which changes the players input (represented internally by noun = character
and second = item) into an 'Order' action. Here comes the code as defined
by the library:

[ AskForSub;
action=##Give; inp1=second; inp2=player;
if (RunLife(noun,##Order)~=0) rfalse;
L__M(##Order);
];

If you want 'Order' (and 'AskFor') to behave in the same way as your 'Ask'
routine, you can trap the actions in the NPC's life routine in a similar
way. Example:

Object NPC "NPC"
with ...,
life [;
Ask: if (second=='item')
{ move item to player; "bla bla..."; }
Order:
if (action==##Give && noun==item && second==player)
<< Ask self 'item' >>;
...

- Martin