1
0
Fork 0

best code so far

This commit is contained in:
Alexander Yakovlev 2019-08-13 09:57:59 +07:00
parent 885ff2cbbe
commit 566e290f36
Signed by: oreolek
GPG key ID: 1CDC4B7820C93BD3
2 changed files with 24 additions and 27 deletions

View file

@ -1,23 +1,15 @@
! Alternative way: with BeforeParsing
Global thing_to_examine;
Global thing_to_examine = "";
[ 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);
[ExamineScope thing;
if (thing ofclass Object && WordInProperty(thing_to_examine, thing, name)) {
<Examine thing_to_examine>;
rtrue;
}
rfalse;
];
[ BeforeParsing;
if (num_words > 1) {
rfalse;
}
thing_to_examine = NextWord();
! WARNING: will catch compass directions
[ UnknownVerb word;
thing_to_examine = word;
LoopOverScope(ExamineScope);
rfalse;
];

View file

@ -1,15 +1,20 @@
Global the_word_was = "";
Global thing_to_examine;
[ UnknownVerb word i;
objectloop (i in location) {
if (
!word == (i.&name) --> 0 &&
i has scenery
) {
the_word_was = i;
return 'осм';
}
rfalse;
[ExamineScope thing;
if (
thing ofclass Object &&
! WordInProperty(thing_to_examine, thing, name)
thing_to_examine == (thing.&name) --> 0
) {
<Examine thing_to_examine>;
rtrue;
}
rfalse;
];
[ UnknownVerb word;
thing_to_examine = word;
LoopOverScope(ExamineScope);
rfalse;
];