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
1 changed files with 18 additions and 30 deletions

View File

@ -1,35 +1,23 @@
Global examine_verb_direction;
! Alternative way: with BeforeParsing
[ UnknownVerb direction;
objectloop (direction in real_location) {
if (
direction ofclass Object &&
direction has scenery
) {
examine_verb_direction = direction;
return 'examine.verb';
}
rfalse;
}
rfalse;
];
Global thing_to_examine = "";
[ Examine_VerbSub;
if (examine_verb_direction ofclass String)
print_ret (string) examine_verb_direction;
<<Examine examine_verb_direction>>;
];
Verb 'examine.verb' * -> Examine_Verb;
! 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);
}
[ ExamineScope thing;
print thing_to_examine, " - ", thing, ": ", (a) thing, "^";
if (thing == thing_to_examine) {
buffer->0 = 'examine';
buffer->1 = thing_to_examine;
Tokenise__(buffer, parse);
rtrue;
}
rfalse;
];
[ BeforeParsing;
if (num_words > 1) {
rfalse;
}
thing_to_examine = NextWord();
! WARNING: will catch compass directions
LoopOverScope(ExamineScope);
];