Block dropping—in general and per item

I would like (1) to block all dropping with a general response and (2) allow a couple of items to have their own special response/rules. I feel there must be a standard way to do this, but I don’t know it.

1. Blocking of dropping in general

I tried this:

The reserved dropping rule is listed instead of the standard dropping rule in the carry out dropping rulebook.

This is the reserved dropping rule:
	say "No. You like [regarding the noun][them] too much to discard [regarding the noun][them]."

The problem is that the report dropping rules still fire, so if I try dropping something, I get:

>drop sausage
No. You like it too much to discard it.

Dropped.

(The action is still blocked, but the reporting goes on. Which is a little weird, no?) Am I supposed to also include:

The reserved dropping rule is listed instead of the standard dropping rule in the report dropping rulebook.

?

Or perhaps it should be:

The reserved dropping rule is listed instead of the standard dropping rule in the check dropping rulebook.

It feels as if it should be pretty simple to do and I don’t want to start chasing my own tail. What’s a simple way of doing this?

2. Assigning specific drop-blocking responses to specific items

So, having done (1), I did this:

Last check dropping the lamp:
	say "You need that. What if you get stuck in a dark place?" instead.

I first tried a simple check (not last check), but I got the response even if the player weren’t holding the item. (I assume the simple check rule bypasses the standard checks for dropping something. I don’t remember how these things work…) Is there a better way of doing this?

Thanks!

I think the simplest way to do this is to just use Instead rules, rather than mucking about with the standard rulebooks which can be complicated and dangerous (I also added an example showing how you could special-case allow dropping if you wanted to):

"Test"

The lab is a room.

An object is either useless or useful.  An object is usually useful.

The key is in the lab. The lamp is in the lab. 

The trash bag is in the lab.  The trash bag is useless.

Instead of dropping something useful:
	Say "You like [the noun] too much to discard it."
	
Instead of dropping the lamp:
	Say "You need that.  What if you get stuck in a dark place?"
		

Note that you’ll likely want to do something similar to block “PUT [noun] onto [noun]” and “INSERT [noun] INTO [noun]” as well.

1 Like

The problem with “instead” is that it says the response even if you don’t carry the item. “Instead” bypasses the checking required for the game to know whether the player has the item or not, going straight to the response regardless.

Here is the diagram from the documentation:
image

Ah, I see what you mean! Yes, if you’re worried players will drop objects they’re not carrying (which I think can often come up if people try DROP ALL), you can just add a “while the player is carrying the noun” condition to the Instead rules.

EDIT: Or if you want to replace the dropping rule, per your original post, have you tried adding “Stop the action.” at the end? That should pre-empt the reporting rule.

1 Like

Once actions have reached the ‘Carry out’ stage, ‘stop the action’ will not prevent the ‘After’ stage, or if After rules do not pre-empt it, the ‘Report stage’, from running.

For general changes to the rules of an action (such as blocking all dropping), these can if desired be dealt with in the ‘Check’ stage, at which point the action can still be stopped in ‘failure’ after explanatory text is printed. You can put your ‘Check’ rule(s) last in the Check stage rulebook, so all the usual check rules that prevent inappropriate dropping (such as making sure the object to be dropped is something carried) can run first and abort the action if necessary before your rule(s) eventually get the chance to intervene:

Last check dropping....

If you are going to put several rules at the end of the ‘Check’ stage rulebook, these need to be declared in order so that the ones you need to run earlier (more specific, exceptions) are declared first and the last one to run (general, default behaviour) declared last- also, if your rule has fully dealt with the action, end with either ‘instead’ or ‘stop the action’.

And possibly GIVE something TO somebody…

1 Like

I think I managed to sort it out. Perhaps it’s an overkill (and it seems that @drpeterbatesuk is right about last check, but it’s fun practicing some rulebook sorting every now and then).

So, this:

The reserved dropping rule is listed after the can't drop what's not held rule in the check dropping rulebook.

This is the reserved dropping rule:
	say "No. You like [regarding the noun][them] too much to discard [regarding the noun][them].";
	rule succeeds.

The can't drop the lamp rule is listed after the can't drop what's not held rule in the check dropping rulebook.

Check dropping the lamp (this is the can't drop the lamp rule):
	say "You need that. What if you get stuck in a dark place?";
	rule succeeds.

gives:

>drop lamp
You haven’t got that.

>take lamp
Taken. When in darkness, light it.

>drop lamp
You need that. What if you get stuck in a dark place?

>drop sausage
The sausage is already here.

>take sausage
Taken.

>drop sausage
No. You like it too much to discard it.

But adding more special objects will require adding more rules of the kind this is the can't drop the hankie/tortilla/gyros rule, so I’ll go with last check. Thank you all!

Not necessarily, if you wanted to (or needed to) continue with the ‘named rule listed somewhere in the middle of the check dropping rulebook’ approach you could just have one rule for exceptions then work through them:

Check dropping something (this is the special cases dropping rule):
	if the noun is the hankie:
		....
		instead;
	else if the noun is the lamp:
		....
		instead;
	else if....
				
The special cases dropping rule is listed after the can't drop what's not held rule in the check dropping rulebook.		
3 Likes

This is excellent!

Besides, one disadvantage of using the last check approach is that it takes into consideration the order that the rules appear in the code: the more general last check dropping must come after the specific last check dropping the lamp. Otherwise, even the lamp gets the general response.

So, thanks again! I’ll go with the check dropping something and then do a switch statement for each special noun. The last case can be the general response that blocks the dropping.

That’s not really much different. If you list two rules as after the can't drop what's not held rule then which one actually comes directly after that is loosely based on the source ordering – although I think Inform’s still free to put them in either order depending on their “specificity”, which may be better or worse for your purposes depending on the particular rules in question.