Sorry for being a nuisance, still going around my harvesting piece of code. I’ve actually got it all working very well, thanks chiefly to Matt, Juhana and the new way in which Inform indexes phrases. I’ve just stumbled upon a slight hiccup which I’d, nevertheless, like fixed.
The problem is that disambiguation - yes, again it’s disambiguation - seems to behave as expected when I type “harvest all”, but not so well when I type “harvest grain and potatoes.” Here’s full working code which summarizes my harvesting scenario:
[code]“Test”
Unharvested food is a kind of thing. Unharvested food is always fixed in place.
Field is a room. Some grain_scenery is unharvested food in Field. Some potatoes are unharvested food in Field. Field has a number called unharvested grain. The unharvested grain of Field is 16. Field has a number called unharvested potatoes. The unharvested potatoes of Field is 8. The grain_scenery is privately-named. The printed name of the grain_scenery is “grain”. Understand “grain” as the grain_scenery.
A bag of potatoes is a kind of thing. The plural of bag of potatoes is bags of potatoes. There are 8 bags of potatoes.
A bag of grain is a kind of thing. The plural of bag of grain is bags of grain. There are 16 bags of grain.
Instead of harvesting grain_scenery:
if unharvested grain of Field > 0:
say “I harvest some grain.”;
now the player carries a random bag of grain that is off-stage;
decrease unharvested grain of Field by 1;
otherwise:
say “There is no more grain.”
Instead of harvesting potatoes:
if unharvested potatoes of Field > 0:
say “I harvest some taters.”;
now the player carries a random bag of potatoes that is off-stage;
decrease unharvested potatoes of Field by 1;
otherwise:
say “There are no more taters.”
Section 2 - Harvesting
Harvesting is an action applying to one visible thing. Understand “harvest [things]” as harvesting.
Check harvesting something which is not unharvested food (this is the block harvesting rule):
say “I can’t harvest that.”;
stop the action.
Rule for deciding whether all includes anything (called harvest material) while harvesting (this is the deal with ALL and HARVESTING rule):
if the harvest material is unharvested food:
it does;
otherwise:
it does not.
Does the player mean harvesting a bag of grain: it is very unlikely.
Does the player mean harvesting unharvested food: it is very likely.
Does the player mean harvesting a bag of potatoes: it is very unlikely.
Rule for clarifying the parser’s choice while harvesting:
do nothing.[/code]
Everything works perfectly, even “harvest all”, which gives the following output:
It’s simply wondrous to see it working. However, if the player happens to write it differently…
Bang! There it goes again.
Also, in my last thread I took the opportunity to ask a second, lesser question, and I’ll take the same liberty now. I wonder if anyone could tell me - I’m sure it’s in the manual, but I can’t easily find it - how to edit (i.e., get rid of) the enumeration when doing multiple things. I mean output like -
harvest all
I harvest some grain.
I harvest some taters.
Of course, if I could do it with one sentence, such as “I harvest [list of unharvested food in the location]”, it would be even better. The best I could find was “Rule for printing the name of unharvested food while harvesting” to replace it with a blank string, which of course gave the expected, laughable result:
harvest all
:I harvest some grain.
:I harvest some taters.