prevent the player from using the TAKE ALL command

Is there a simple way to prevent the player from using TAKE ALL? I feel like there should be, but I wasn’t able to write an appropriate Instead rule for it.

Chapter 18:36 says you can specifically exclude things from take all like so:

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

This is a guess, but I think you could try:

Rule for deciding whether all includes a thing: it does not.

it worked! Thanks! Except I get the stock reply “There are none at all available!” and I can’t figure out how to change it…

Whoo hoo! I figured it out! :smiley:

For posterity’s sake, how exactly did you figure it out?

I used the following codes:

[code]
[This prevents the player from using the TAKE ALL command]
Rule for deciding whether all includes a thing:
it does not.

[This changes the default message “There are none at all available!”]
Rule for printing a parser error when the latest parser error is the nothing to do error:
say “Now, now, don’t be greedy.”[/code]

1 Like

Thanks! That’s helpful!

I’m still in the process of learning I7 myself, so I take anything I can get. :smiley:

sure thing, Suho! i’m still learning, too; let me know if you ever want to trade beta-testing.

Will do!

Just a word of warning: as it stands, your code will also block DROP ALL. There are two problems with this; firstly, your “don’t be greedy” response isn’t appropriate; secondly, you’ll run into a known Inform bug (and one which isn’t going to be fixed).
http://inform7.com/mantis/print_bug_page.php?bug_id=1720

You can get round this easily:

Rule for deciding whether all includes a thing when taking: it does not.
Rule for deciding whether all includes a thing when removing from: it does not.

(The second rule covers TAKE ALL FROM …)

Haha, thanks jrb! I actually discovered this issue last night and was having trouble trying to figure out how to deal with it.

Thanks for the correction!

This also could work. The problem is that it hard codes parser words to actions. It would be nice to say “if current action is taking,” but that doesn’t work, as actions haven’t been defined yet (if they have, and I’m missing something, I’d love to know). It also only rejects if you have more than one item to take. So I put in an alternative way to look for (VERB) ALL.

[code]“testy” by Andrew

This is the klepto rule:
if the number of entries in the multiple object list is greater than 1: [you could also say if the player’s command includes the word “all”]
if word number 1 in the player’s command is “take” or word number 1 in the player’s command is “get”: [“if current action is taking” doesn’t work]
say “Whoah there, klepto!”;
stop the action;
if word number 1 in the player’s command is “drop”:
say “When you need to drop everything to think of the next puzzle, that doesn’t mean literally!”;
stop the action;

The klepto rule is listed before the generate action rule in the turn sequence rules.

room 1 is a room.

the x is in room 1. the y is in room 1.

test all with “get all/get x/get y/drop all”
[/code]

This is going to miss “pick all up” and maybe some other synonyms–I think hard-coding really is not going to be the way to go here. (Similarly, you really don’t want to look for “all” if you want to block “Get x and y” too.)

zarf told me once how to get the action name that we’re trying out of the parser internals before the action is officially set:

[code]To decide which action name is the action to be: (- action_to_be -).

This is the klepto rule:
if the number of entries in the multiple object list is greater than 1: [you could also say if the player’s command includes the word “all”]
if the action to be is the taking action:
say “Whoah there, klepto!”;
stop the action;
if the action to be is the dropping action:
say “When you need to drop everything to think of the next puzzle, that doesn’t mean literally!”;
stop the action;

The klepto rule is listed before the generate action rule in the turn sequence rules.

room 1 is a room.

the x is in room 1. the y is in room 1.

test all with “get all/get x/get y/drop all/drop x/drop y/pick all up”[/code]

But in Inform 6M62 the multiple action processing rules support a way of dealing with this that doesn’t make us dive into I6:

[code]A multiple action processing rule :
if the action name part of the current action is the taking action:
say “Whoah there, klepto!”;
alter the multiple object list to {};
if the action name part of the current action is the dropping action:
say “When you need to drop everything to think of the next puzzle, that doesn’t mean literally!”;
alter the multiple object list to {}.

room 1 is a room.

the x is in room 1. the y is in room 1.

test all with “get all/get x/get y/drop all/drop x/drop y/pick all up”[/code]

Thanks for posting that, matt. I’ve always wondered how to access the current action.

I forgot to mention I was using 6G…I’m not surprised there’s a better way for 6M! Thanks for sharing it, Matt.

Of course, conditioning on the number of things in the multiple object list will mean that TAKE X AND Y is blocked as well as TAKE ALL.
This might or might not be what you want.

(Anybody remember the ghost in Zork?)

I think the action-to-be method should work for 6G… zarf told me about it a while ago.

I’ve been assuming we want to block “TAKE X AND Y” as well as “TAKE ALL.” Letting “TAKE X AND Y” through seems like it’d be harder–I’m pretty sure that you’d either have to do it at the reading-a-command stage or dive into the parser internals. There are a few synonyms for “all” that you’d have to catch; looking at English.i6t we have:

Constant ALL1__WD = 'all'; Constant ALL2__WD = 'each'; Constant ALL3__WD = 'every'; Constant ALL4__WD = 'everything'; Constant ALL5__WD = 'both';

so maybe searching the command for all/each/every/everything/both would work. (“Both” seems to work just like “all.”)

This also raises the question of what to do for a description of objects, such as “TAKE ALL X” or “TAKE X, Y, AND ALL Z”.

If you want to block TAKE ALL but not TAKE X AND Y, then “deciding whether all includes” rules are surely the way.