Drop [n] objects questions

I’ve imp’d a bunch of leaves that are working well. A player can drop 1 leaf at a time from an infinite amount, or drop them all. I’m just trying to lock out the area inbetween - attempts to ‘drop 3 leaves’, for instance.

Edit - I forgot to point out, there really is only 1 ‘leaves’ object, and 1 ‘leaf’ object which is a part of it. But I am uninterested in counting individual leaves and I keep no track of them. You’ve got the leaves object or you’ve got nothing.

There’s a few issues. I’m not actually sure what the parser is doing in the following cases:

If you type ‘drop 2 leaves’ (note that leaves is definitely the name of the object player is holding), it says ‘Only 1 of those are available.’

If you type ‘drop two leaves’, it says ‘You can’t use multiple objects with that verb.’

The first case seems to make sense, but seems to be entirely non-interceptible (I tried grabbing it at the library message stage and making an exception when the noun is leaves, but there is no noun. I can’t even store the noun with a ‘before dropping’ rule to make that work.)

In the second case - uh, I just don’t understand the second case.

Any advice?

I kinda solved the 1st case now. I made a new action “drop [number] [leafmissile]”. This lets me check the number understood to see how many leaves a person tried to drop. Though amounts of 0 and 1 still slip through - they must get processed before it gets to this stage. Either 0 or 1 will drop the whole object, which isn’t ideal in my case where ‘drop 1 leaves’ results in all leaves being dropped.

It seems that there are two issues. First, the I6 for understanding “drop” as the dropping action is being listed before the analog I6 for the custom action. Consequently, the parser attempts to read ``drop [number] leaves’’ as dropping instances of the leaves object first, and only goes on to consider matching the number with a number token if that doesn’t work out. A workaround is to take charge of the I6 yourself, though I suspect that there’s some better option that I’m not thinking of. Second, the default LanguageNumbers array doesn’t have any entry for `zero,’ so you must give it a meaning yourself. For example,[code]Section “Setup”

[Ask Inform not to generate I6 grammar lines for “drop.”]
Understand the command “drop” as something new.

[Give our verb a predictable I6 name.]
The scattering action translates into I6 as “Scatter”.

[Supply the grammar ourselves, putting the DECIMAL_TOKEN pattern before the multiheld pattern.]
Include (-
Verb ‘drop’
* DECIMAL_TOKEN held -> Scatter
* multiheld -> Drop
* held ‘at’ / ‘against’ noun -> ThrowAt
* multiexcept ‘in’ / ‘into’ / ‘down’ noun -> Insert
* multiexcept ‘on’ / ‘onto’ noun -> PutOn
;
-).

[The parser doesn’t know the word “zero” out-of-the-box.]
Understand “zero” as zero.

Section “Demonstration”

There is a room.
The player carries some leaves.
Understand “leaf” as the leaves.

Scattering is an action applying to one number and one carried thing.
Report scattering:
say “You let [the number understood in words] of [the second noun] go.”

Test me with “drop leaves / take leaves / drop zero leaves / drop one leaf / drop two leaves”.[/code]

Thanks Emacs.

I was reticent to get into I6ing this issue, but what I learned from your example was that you can define grammar as certain numbers. From that I found a decent fix on top of my ‘drop [number] [leafmissile]’ schtick. I defined zero and 0 as -1. This steers all attempts to do something with 0 of anything into ‘doesn’t make sense’ territory across the game.

Still on the topic of dropping stuff… is there any way to completely annihilate ‘drop all’? And once I’ve gone that far, I’ll probably want to slay ‘get all’ as well. You know, so there’s some message of my own design that appears if you try either.

I thought I had cleverly bopped my second least favourite library message on the head (‘There are none at all available!’… a response to ‘get all’ when nothing can be got) by overwriting it with Default Messages, but then I discovered the message also appears in response to ‘drop all’ in similar circumstances.

Then I realised I can’t find all the paths that lead to this message appearing in the standard rules, because I can’t actually find one path (I searched for ‘44’, the number of the library message), so I assume it’s in the i6 someplace - and so in turn I can’t really write a default response to cover all eventualities, 'cos I don’t know what those eventualities are.

Throw away the “take” grammar, and rebuild it using “Understand [something] as taking” rather than [things]. Then any attempt to take multiple objects will hit the “you can’t use multiple objects” error.

Thanks, bearer of good news!

And, conveniently for you, if you forbid multiple objects with Zarf’s suggestion, the I6 ordering problem will go away.

Yeah. I just wish I hadn’t been so foolish as to encounter these problems in the wrong order :wink: