Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inform7: how do I make an actor to examine something after I give it to them

Tags:

inform7

I am trying to make an actor examine something after the player character give it to them. If I say something like:

After giving a book to Tom:
  try Tom examining the book.

It seems as though the entire thing is just completely ignored. I give the book to Tom and he doesn't examine it. I even created a report rule (

Report Tom examining book:
  say "1.";

) to see if he does examine it and it just doesn't tell me that he does, but that didn't work either.

Basically what I am trying to do is give him the book. He automatically (preferably silently) examines the book and then after examining the book he'll say something like "What a marvelous book!"

Thank you for taking the time to answer. If this has been answered already, I apologize, I looked but didn't see anything remotely similar.

like image 228
D. Grimshaw Avatar asked Mar 21 '18 17:03

D. Grimshaw


1 Answers

There are two parts to this problem: Getting Tom to take the book, and making Tom say "What a marvelous book!" afterwards.

1. Getting Tom to take the book

The current After rule never applies, as Tom doesn't take the book (the action is blocked by the 'block giving' rule).

The simplest way to fix this is to replace the After rule with an Instead rule, therefore making the completed statement this:

Instead of giving a book to Tom:
  Say "You hand over [the book] to [Tom].";
  Now tom carries the book;
  try Tom examining the book.

This works, but bypassing the give command isn't the most elegant way of doing things. We could instead completely remove the rule that prevents giving things to people, like so:

The block giving rule is not listed in any rulebook.
After giving a book to Tom:
  say "You give [the book] to [Tom].";
  try Tom examining the book.

(We have to describe us giving the book to Tom because following the After giving rule prevents the Report giving rules from taking affect. We could still follow the Report giving rules by using the phrase continue the action, but then we describe giving the book to Tom after he examines it).

But this has the effect of allowing you to give anything to Tom, which is probably not what we want. We can get around this by doing something like this:

This is the partial block giving rule:
  if the noun is the book and the second noun is tom:
    continue the action;
  otherwise:
    say "[The second noun] [don't] seem interested.";
    stop the action.

The partial block giving rule is listed instead of the block giving rule in the check giving it to rules.

This allows you to only give Tom the book, and nothing else to anyone else. If you expect this exact situation to occur often with different people and different objects, then you could go further and define a relation (say, "being interested in") to determine whether someone will accept an object, and change the rule to only allow you to give people objects they are interested in.

2. Making Tom say "What a marvelous book!"

Now, we have several ways to make Tom say what we want him to say. The most obvious change we can make is to have Tom not actually examine the book. We could simply replace that line with something like this:

Say "[Tom] looks over [the book]. 'Wow,' says [Tom], 'what a marvelous book!'".

However, let's say that we still want Tom to actually examine the book (which would be helpful if wanted to later check whether or not the book has been examined, or if tom has examined something, etc.). We could then do something like this:

Try silently tom examining the book;
Say "[Tom] looks over [the book]. 'Wow,' says [Tom], 'what a marvelous book!'"

Try silently simply prevents the action from producing any text (unless it fails). We could also use a report rule instead of try silently, which is a little more elegant and looks like this:

Report tom examining the book:
  Say "[Tom] looks over [the book]. 'Wow,' says [Tom], 'what a marvelous book!'";
  stop the action.
like image 70
Eli Zupke Avatar answered Nov 03 '22 15:11

Eli Zupke