Refuse Take All

Hiya!

I’m trying to restrict the player from getting themselves in trouble.
To accomplish this, I’m restricting Undo, Carry Capacity (sort of)…

… and they shouldn’t be able to use “take all”.

However, when I try to dismiss it as “a mistake”, it still carries out the action but doesn’t print it - or at least part of the action.
The player is punished for trying to take stuff that doesn’t belong to them.

And unless I messed up, “instead of taking all:” just gave me errors.

I’m at the office right now (during my break, don’t worry) so I can’t see the exact error but any ideas would be much appreciated.

And now I’m going to eat my cookie.

Don’t try to do it with “as a mistake.” That’ll only allow you to catch literal strings, and you’ll be certain to miss something (“take everything,” “get all,” “pick up all”).

You also can’t easily do this with commands on actions, because the way “Take all” is processed is that it executes a separate taking action for everything that’s takeable. So if you’re in a room with a rock and a ring and you type “take all,” first it does the “taking the rock” action and then it does the “taking the ring” action. While the Instead rules are running the action machinery doesn’t know whether this is happening because the player typed “take all” or “take ring.”

If your purpose is to keep the player from taking things that don’t belong to them and getting punished for it, the simplest solution is something like this:

Definition: A thing is hazardous if [your criteria for determining that goes here]. Rule for deciding whether all includes something hazardous: it does not.

That allows “take all” but won’t let the player take any of the hazardous stuff.

If you just want to completely disable “take all” you can do this:

Rule for deciding whether all includes something: It does not.

This will also mess with “drop all” and the like, but you may be cool with that.

Lastly, if you want to try something fancy where you let players take things up to their carrying capacity and then tell them to stop, I had some code for this in one of my games. This is 6G60 code, not sure if it needs an update. But this might not produce the effect you want, and also involves some tinkering with the internals of how Inform handles “take all”–it uses “the multiple object list” which is the thing that Inform uses to execute “Take knife,” “take fork” etc. when it’s doing a take all.

If you want to find out more about this search the documentation for “deciding whether all includes” and “multiple object list” if that’s something you want to explore.

[EDITED to fix code mistakes]

I have a question, Matt. Would the following code muck with my stuff, or only when it’s being played by a player? To decide whether all includes something: It does not. Because I believe I need “all” for myself in the code. Would that be in jeopardy?

You mean would it muck with things like “Now everything the player carries is nowhere”? It wouldn’t–“deciding whether all includes” only affects player commands that are meant to apply to multiple objects. It doesn’t have any effect on the rest of the source code.

(side note: be sure of what you’re doing. Restricting UNDO is a sure way to annoy players. Carrying capacity, ditto)

I never knew what I was doing before and I’m not gonna start doing that now. :slight_smile:

To decide whether all includes something: it does not.

:frowning:

“Deciding whether all includes” is an activity on objects, so you need to define a rule rather than a phrase.

Rule for deciding whether all includes something: it does not.

If you do this, you should also change the message given to the player to explain that you’ve deactivated “all” universally in this game. You should be able to do this by changing the parser response that normally says “There are none at all available!” to say something else. I’m not sure which parser response that is but you should be able to find it.

The parser nothing error internal rule response (B).

that works beautifully! thanks! :smiley:

Whoops, my bad. Edited the original post.