Characters Possessing Objects

Whenever the main character gives something to another character, I am having difficulty removing it from the second character. For example, after giving the call slip to the librarian, I want the call slip to be put in a container. This code compiles:

otherwise: 
		now player is carrying wrong book;
		now luciensearch is 0;
		say "Lucien darts back behind the podium and gives a book to you.  He then goes back to work.";
		now authorname is "";
		now callnumbername is "";
		now titlename is "";
		now call slip is in pad;
		now wrong book is located;
		stop the action;

But if I look in the pad the call slip is not there. If I type SHOWME CALL SLIP I get this partial message:

call slip - thing
    tiny printing (part of call slip) - written thing
location: carried by Lucien in The End of the Stacks

In other words, the call slip is not removed from the second character. Is there some language I must use to remove an object from a character’s possession?

It’s difficult to tell from the snippet you’ve provided what might be going wrong. Is the otherwise clause actually being run? What is the if statement that leads to the otherwise? What other rules are involved in this action or might interact with it?

Yes, the otherwise clause is being run. I have included the full command here:

carry out giving call slip to Lucien:
	if authorname is "Michael Binkley":
		if callnumbername is "V3706.5":
			if titlename is "Self-Help":
				now player is carrying spoon bending book;
				now spoon bending book is located;
				now luciensearch is 0;
				increase score by 5;
				say "Lucien dashes back to the podium.  He hands the book to you and shrugs.  'Best I could do for you,' he says as he does so.";
				now authorname is "";
				now callnumbername is "";
				now titlename is "";
				now call slip is in pad;
	otherwise: 
		now player is carrying wrong book;
		now luciensearch is 0;
		say "Lucien darts back behind the podium and gives a book to you.  He then goes back to work.";
		now authorname is "";
		now callnumbername is "";
		now titlename is "";
		now call slip is in pad;
		now wrong book is located;
		stop the action;

You’ll see that the slip is returned to the pad regardless of the outcome, but neither command returns the slip to the pad.

Thank you for the support!

Random potentially unhelpful observation:

Is “pad” a container? Is it closed? Transparent? - IE is the slip logistically visible?

If pad is not a container, I wonder if putting it “in” a non container makes it part of the pad by incorporation (where it won’t be described.) Or if Inform is befuddled and can’t insert an object into a non container and just silently ignores the move?

I’m wondering if the pad might work better as a portable supporter limited to supporting slips of paper, so the slip would be ON the pad instead of IN it…? (If the pad is a container but not openable and not transparent, the slip is basically in an unbreakable box and not available to see.

1 Like

Maybe you could cook up a minimal example in which you see this behavior and then post the complete running example here? Absent any additional context it’s not possible to see why your code wouldn’t work. For instance, even to get carry out giving you must have fiddled with the check rules for giving, right? Without that kind of context we can only guess.

3 Likes

Thank you for the suggestion, I tried switching it to a supporter. Still no luck.

The checks are:

check giving call slip to Lucien:
	if authorname is "":
		say "Lucien glances at the slip and waves it away.  'Author's name,' he says.";
		stop the action;
	if callnumbername is "":
		say "Lucien glances at the slip and waves it away.  'Call number,' he says.";
		stop the action;
	if titlename is "":
		say "Lucien glances at the slip and waves it away.  'Title,' he says.";
		stop the action;
	if spoon bending book is located:
		say "Lucien waves you away.  'I have no more time for this nonsense,' he says.  'Read the book that you have.'";
		stop the action;
	otherwise:
		now luciensearch is 1;
		say "Lucien reaches across the lectern and snatches the slip from you.  He certainly is quick for a man his age.";
		continue the action;

I posted the check code. I appreciate your set of eyes on it.

As Phil said, a good way to start debugging is to create a minimal example that shows the issue. For example, like this:

The Library is a room.

Lucien is a man in the Library.

The pad is a container in the library.

The player carries the call slip.

The block giving rule does nothing when the second noun is Lucien.

Carry out giving the call slip to Lucien (this is the giving-call-slip rule):
	say "Okay, you give the slip to Lucien.";
	now call slip is in pad.

When you turn on the RULES debugging command, you can see that the “standard giving rule” is applied after our giving-call-slip carry out rule.

The standard giving rule is in the Standard Rules (File → Open Installed Extension → Graham Nelson → Standard Rules), and looks like this:

Carry out an actor giving something to (this is the standard giving rule):
	move the noun to the second noun.

So, this moves the call slip to Lucien after we manually moved it to the pad.

The solution is to move the call slip after or instead of the standard giving rule. There are various ways to do that, one simple method would be to use an After rule:

After giving the call slip to Lucien (this is the giving-call-slip rule):
	say "Okay, you give the slip to Lucien.";
	now call slip is in pad.

Now the call slip ends up in the pad, as intended.

5 Likes

Thank you for taking the time to analyze and respond to the problem. I greatly appreciate your help!

1 Like

Can I ask you one further question? How did you know where to look in the standard rules? Or did you just look through until you found it?

I just did a full-text search in the Standard Rules extension (CTRL + F, “standard giving rule”), after finding out the name with the RULES debugging command.

2 Likes