ANSWER TO EXERCISE 81 | |
A slight refinement of such a "purloin'' verb is already defined in the library (if the constant DEBUG is defined), so there's no need. But here's how it could be done: [ Anything i; if (scope_stage==1) rfalse; if (scope_stage==2) { objectloop (i ofclass Object) PlaceInScope(i); rtrue; } "No such in game."; ];(This disallows multiple matches for efficiency reasons -- the parser has enough work to do with such a huge scope definition as it is.) Now the token scope=Anything will match anything at all, even things like the abstract concept of 'east'. |