Dropping multiple things

I have multiple things, some on the ground, some carried by the player. However, when I try to drop something, say an arrow, I get the message that I already dropped it. I assumed that another “different” arrow is already on the ground, and I am triggering the “can’t drop what’s already dropped rule”. I unlisted that rule and then I can drop an arrow–as long as it is not in a quiver carried by the player. However, after the arrow is dropped, my inventory still has the arrow and it has not incremented the arrow on the ground.

Any idea what is going on here?

Can you post a minimal code example?

1 Like

I suspect that BEFORE TAKING and AFTER TAKING did something unintended to some setup activities that prepared DROP. Notice that I do not override TAKE action.

Before taking something:
	if noun is a new weapon:
		say "Ganon says, 'Hey! Those aren't free. You need to pay." instead;
	if noun is arrow and player does not carry quiver:
		say "You have no quiver to put the arrow into." instead;

After taking arrow:
	say "Storing arrow in my quiver.";
	now noun is in quiver carried by player;	
	

test taking with "take old arrow/ i/take quiver/ take new arrow/ take old arrow/ i/ drop my arrow/i".

[MULTIPLE-OBJECT TRANSACTIONS]
[DROP multiple things]
The can't drop what's already dropped rule is not listed in the check dropping rulebook.

Instead of dropping weapon:
	say "Dropping my [noun]";
	if noun is in quiver carried by player:
		say "Retrieving it from quiver.";
		now noun is in location;

To further add to the mystery, I get a DROP response msg that says I don’t have an arrow, but SHOWME SELF says I DO have an arrow.

I’m not certain, because I only have part of your code, but I think the problem is that the parser is choosing the arrow on the ground to drop, because it’s the “closest” to the player. That is, the other arrows are in the quiver, two steps removed from the player, whereas the arrow on the ground is a sibling to the player. You can check this using TRACE 5. The following seems to fix the problem:

Does the player mean dropping an arrow enclosed by the player:
	It is very likely;

You do not need to unlist the can't drop what's already dropped rule.

Stuff the player carries is allowed for DROPping. But stuff inside stuff the player carries is locked out at the ‘can’t drop what’s not held’ rule. So any arrows in the quiver aren’t being considered as actionable by DROP.

As a reminder, any time you see a response that isn’t what you want or expect, turn on RULES then perform the action. Look at what rule fired just before the message is printed. Then you know exactly what stopped things working.

How to get around this one? Probably the best way is to modify the ‘can’t drop what’s not held’ rule. We don’t want to just turn it off because then the player will be able to drop things already on the ground and other weird stuff.

The normal rule is:

if the actor is carrying the noun, continue the action;
if the actor is wearing the noun, continue the action;
if the actor is the player:
	say "[We] [haven't] got [regarding the noun][those]." (A);
stop the action.

I’m going to assume there’s only one quiver in the game and write the new rule that way. You can rephrase it if a quiver is a kind rather than a thing:

This is the NEW can't drop what's not held rule:
	if the noun is in quiver and (player carries quiver or player wears quiver), continue the action;
	if the actor is carrying the noun, continue the action;
	if the actor is wearing the noun, continue the action;
	if the actor is the player:
		say "[We] [haven't] got [regarding the noun][those]." (A);
	stop the action.

With all this in place, the game will still try to grab the arrow on the ground first if we do nothing else - because the quiver arrow loses points for being in a container. Like @rileypb said, you can see this with TRACE 5 or TRACE 4, and we need to preference the quiver arrow:

Does the player mean dropping an arrow enclosed by the player:
	It is likely;

Put it all together and it works. Here’s a demo:

Summary
"Robin Hood's non-adventure" by Friar Tuck.

lab is a room. warehouse is a room.

an arrow is a kind of thing.
2 arrows are in warehouse.

a quiver is a container. Player carries quiver.

When play begins:
	let Z be a random arrow in warehouse;
	now Z is in lab;
	let Z be a random arrow in warehouse;
	now Z is in quiver;

This is the NEW can't drop what's not held rule:
	if the noun is in quiver and (player carries quiver or player wears quiver), continue the action;
	if the actor is carrying the noun, continue the action;
	if the actor is wearing the noun, continue the action;
	if the actor is the player:
		say "[We] [haven't] got [regarding the noun][those]." (A);
	stop the action.

The NEW can't drop what's not held rule is listed instead of the can't drop what's not held rule in the check dropping rules.

Does the player mean dropping an arrow enclosed by the player:
	it is likely;

Test me with "i/drop arrow".

-Wade

1 Like

Just as a note, Falsoon’s use of:

Instead of dropping weapon:
	say "Dropping my [noun]";
	if noun is in quiver carried by player:
		say "Retrieving it from quiver.";
	now noun is in location;

gets around the can't drop what's not held rule.

1 Like

Though it also prevents dropping anything that’s not in the quiver!

1 Like

I changed the indentation so that it will drop other things, but I think it will circumvent the can’t drop what you’ve already dropped rule or whatever it’s called.

1 Like

I used the code Wade posted, and it all works–if I drop only one arrow.
However, if I try to DROP 2 old arrows, it says “There are none at all available!”.
I want take, drop, and buy to be consistent. I think the NEW rule must be changed to accommodate multiple arrows (or whatevers).

Try something like this:

Lab is a room.

A weapon is a kind of thing. A weapon can be new or old.
An arrow is a kind of weapon.
Understand the new property as describing a weapon.


The quiver is a container.
The player carries the quiver.

10 old arrows are in the lab. 3 new arrows are in the lab.

Before taking something:
	if noun is a new weapon:
		say "Ganon says, 'Hey! Those aren't free. You need to pay." instead;
	if noun is arrow and player does not carry quiver:
		say "You have no quiver to put the arrow into." instead;

After taking arrow:
	say "Taken. Storing arrow in my quiver.";
	now noun is in quiver carried by player;	
	

test taking with "take old arrow/ i/take quiver/ take new arrow/ take old arrow/ i/ drop arrow/i".

[MULTIPLE-OBJECT TRANSACTIONS]
[DROP multiple things]
[The can't drop what's already dropped rule is not listed in the check dropping rulebook.]

Does the player mean dropping an arrow enclosed by the quiver:
	It is very likely;
	
Before dropping weapon:
	if noun is in quiver carried by player:
		say "(Retrieving [the noun] from quiver)";

Check an actor dropping (this is the new can't drop what's not held rule):
	if the actor is carrying the noun, continue the action;
	if the actor is wearing the noun, continue the action;
	if the noun is in a quiver carried by the actor, continue the action;
	if the actor is the player:
		say "[We] [haven't] got [regarding the noun][those]." (A);
	stop the action.
	
The new can't drop what's not held rule is listed instead of the can't drop what's not held rule in the check dropping rulebook.