How to model an animal

Hey all,

I’m brand spanking new to creating an interactive fiction game (though I’ve played them).

I’m making a game that contains a monkey, and I’m not sure whether to model it as a person or an object.

The player should be able to talk to it and elicit a (nonverbal) response. It should be able to travel the area.

However, I also want it to be “takeable” by the player.

My first impulse is to say that the monkey is a person but is “takeable”. Is that possible? Is that the best way?


there is also the “animal” kind!

But you can’t carry such an animal. You can do this instead:

[code]Jungle is a room.

The monkey is a portable animal in Jungle. [portable doesnt work here]

Instead of taking monkey:
if the player is not carrying monkey
say “done.”;
move monkey to player;
say “But you’re already carrying this monkey!”;
end if.

test me with “carry monkey/again/drop monkey/carry monkey”[/code]

Excellent, I didn’t realize there was an Animal type. I think I started with an old instruction manual.

Thanks for your help, this is so much fun!


It might be better to just block the rule that prevents the player from taking the monkey. Then you don’t have to bypass other checks the parser makes (carrying capacity etc).

Procedural rule while taking the monkey: ignore the can't take other people rule.

That sounds good, Nitku, thanks for the info!

Verb problem – I’m putting it here because it’s related to this thread.

Inform knows “feed the fruit to the monkey”, so why doesn’t it know this?

Instead of feeding fruit to monkey:
if the player is carrying the fruit:
say “The monkey gobbles up the fruit”;
move fruit to nowhere;
end if.

It doesn’t know the verb. I can see there’s something going on with the “to monkey” being added to the simple verb, but I don’t know how to solve it.


Well, for one thing, you mixed up the colon/indent and begin;/end if syntax, but I guess you just typed that in your post rather than pasting it from actual code. :slight_smile: As far as “feeding” goes, it’s not a defined action – it’s recognized as a synonym for “giving” which is the actual action. (This can be found in the “actions” index of a compiled game.) Even though the in - game parser recognizes different grammar for actions, when you’re programming the game, you need to use the unique action name. Otherwise it would become impossibly confusing, since often the same syntax can be routed to multiple different actions. Try:Instead of giving fruit to the monkey: say "The monkey gobbles up the fruit."; remove fruit from play.Hope that helps.

Edit: Also, since the giving action already requires the player to be carrying the item, you don’t need to add that condition.

Ah, thanks Mike. I figured if “feed” was recognized in game play I could use it. That actions menu of the index is helpful!