Allow for more complex grammar lines with three or more components
Currently, to quote the problem message, "there can be at most two varying parts to a line of grammar, so 'put [something] in [a container]' is allowed but 'put [something] in [something] beside [a door]' is not." While presumably extending this would create difficulties, the lack of this functionality puts a sometimes frustrating limit on the potential complexity of story commands. Even moving from two to three allowed tokens would open up a large possibility space of interesting command structures.
4 comments
-
Ron Newcomb
commented
Although it is possible to do this with the system as-is, (see 25.22 in the manual,) it's by no means obvious and requires I6 code that sets a global and returns GPR_PREPOSITION. If new Understand tokens could be written in I7 code it would help a lot. Here's just part of what's required for a [subordinating conjunction] token, for example.
The understand token subordinating conjunction translates into I6 as "SUB_CONJ_TOKEN".
Include(-
[ SUB_CONJ_TOKEN x;
if (wn > (+ the best match +)) (+ the best match +) = wn;
return ((+ parsing the sub conj +)-->1)();
];-).To decide which number is parse succeeds: (- GPR_PREPOSITION -).
To decide which number is parse fails: (- GPR_FAIL -).To decide which number is parse the sub conj (this is parsing the sub conj): [can't use matches "foo/bar" in here]
repeat through the table of subordinating conjunctions:
if the unmatched word matches the topic entry:
now the sub conj is the output entry;
decide on parse succeeds;
decide on parse fails.Table of subordinating conjunctions
topic output
"then" "then"
"before" "before"
"after" "after"
"if" "if"
"because" "because"
"for" "for"
"so" "so" -
poster
commented
I should have been more specific. You Cannot use if (A) or (B) or (C) in a rule. The maximum that I7 allows is two conditions. Please, go try it.
I have retracted my votes.
-
Erik Temple
commented
It would also be nice if more than one non-object value (e.g. topic, number, etc.) could be understood. The current limit is two objects, one non-object value.
@poster: Inform can already process "if" statements like your example quite well. This request is about grammar for the player's command.
-
poster
commented
Oh my geez, yes. It would be fantastic to be able to use statements like: if (a) and (b) and (c), say "blah".