1
0
Fork 0

Trying to hook into BeforeParsing

This commit is contained in:
Alexander Yakovlev 2019-08-12 19:21:29 +07:00
parent 992dc4f98d
commit 885ff2cbbe
Signed by: oreolek
GPG key ID: 1CDC4B7820C93BD3

View file

@ -1,35 +1,23 @@
Global examine_verb_direction; ! Alternative way: with BeforeParsing
[ UnknownVerb direction; Global thing_to_examine = "";
objectloop (direction in real_location) {
if (
direction ofclass Object &&
direction has scenery
) {
examine_verb_direction = direction;
return 'examine.verb';
}
rfalse;
}
rfalse;
];
[ Examine_VerbSub; [ ExamineScope thing;
if (examine_verb_direction ofclass String) print thing_to_examine, " - ", thing, ": ", (a) thing, "^";
print_ret (string) examine_verb_direction; if (thing == thing_to_examine) {
<<Examine examine_verb_direction>>; buffer->0 = 'examine';
]; buffer->1 = thing_to_examine;
Verb 'examine.verb' * -> Examine_Verb; Tokenise__(buffer, parse);
! Fix "I only understood you as far as wanting to examine.verb." message
[ PrintVerb word;
if (word == 'examine.verb') {
if (examine_verb_direction ofclass String) {
print "examine something";
} else {
print "examine", (name) real_location.(examine_verb_direction.name);
}
rtrue; rtrue;
} }
rfalse; ];
[ BeforeParsing;
if (num_words > 1) {
rfalse;
}
thing_to_examine = NextWord();
! WARNING: will catch compass directions
LoopOverScope(ExamineScope);
]; ];