inform:7 making an animal come to you

i need an animal to come to me when i call it.

Offer it food.

Oh, you mean in Inform 7? The pesky bit is that the animal may not be in the room with the player when the player enters ‘call chihuahua’. You should start by looking at page 16.7 in the manual and Example 290, which appears on that page.

This is a little trickier than average – you want to be able to call the animal even when it isn’t there, but most actions only apply to things that are in the room with the player. Look at the section of the documentation Jim pointed you to, and the first part of this post of mine talks about how you can do that with an action applying to one “visible” thing and an [any thing] token.

So something like this (untested, and you’d have to fix the tabs yourself):

Calling is an action applying to one visible thing. Understand "call [any thing]" as calling. Instead of calling: say "[The noun] won't come when you call." Instead of calling the hedgehog: say "The hedgehog comes happily trotting in."; move the hedgehog to the location.

The second rule is more specific than the first, so (if I haven’t messed up) it should get checked first. That means that when you call the hedgehog you get the results of that rule, and if you call anything else you get the result of the first rule.

Or, with a nod to the Three Stooges:

Calling is an action applying to one visible thing. Understand "call [any thing]" as calling.  Understand "Hey [any thing]" as calling.
Understand "porcupine" as the hedgehog.
Instead of calling:
  say "[The noun] won't come when you call."
Instead of calling the hedgehog:
  say "'Hey, Porcupine! C[apostrophe]mere,' you call.[paragraph break]'I[apostrophe]ll come when I[apostrophe]m good and ready,' responds the hedgehog.[paragraph break]'Are ya ready?' you ask, theateningly.[paragraph break]'Yeah, I[apostrophe]m ready,' says the spiny creature.";
  move the hedgehog to the location.

(Sorry, I never could resist a Stooge reference.)

Robert Rothman