[I6] Commands for NPCs

Dear all,

how can I (under Inform 6) issue a command to an NPC, such as “take sword” or “east”? I can of course hardcode it by moving the sword into the NPC or moving the NPC to a location, but is there a way to have the NPC execute a command, such as e.g. <> would do it for the player?

Thanks and kind regards,

Here’s an NPC I was using to debug the I6 Library:

Object -> girl "girl"
  with name 'girl',
       orders [;
           WaveHands: "The girl waves energetically.";
           Take:!       print (name) noun, "^";
                        <<Take noun, actor>>;
           Drop:!       print (name) noun, "^";
                        <<Drop noun second, actor>>;
           PutOn:       <<PutOn noun second, actor>>;
  has animate female transparent;

Thanks David, that’s graspable. How would that work for a direction, i.e. the NPC shall execute the command “go east”?

<<Go e_obj, actor>>

EDIT: oops.

Sorry, I have to pester you with some non-working code:

Object michael "Michael" loc007_Vor_Imbiss with name 'michael', description "This is Michael.", daemon [i; if(status_michael==0){ switch(counter_michael){ 0: <<Go east_obj, actor>>; } } ], has animate proper;

That results in “Expected expression but found ,” in the line “0: <<Go east_obj, actor>>;”. What wrong am I doing?

“east_obj” is wrong. It should be “e_obj”.

It does not work. I have hardcoded it now, but I’d still love to know what the problem was - “Expected expression but found ,” in the line “0: <<Go e_obj, actor>>;”. Any ideas? Semicolon don’t work either. <> (without comma) does compile, but tries to move the player instead of the NPC.

What version of Inform are you using? The <<Go e_obj, actor>> syntax (with the comma) was added in 6.33.

6.31. Thanks for the explanation! :slight_smile: