| Many of us have been complaining for a while now that the DM no longer | |
| warns the incautious user against the pitfalls of the objectloop | |
| command. I finally decided to go ahead and post this; if it makes it | |
| into the next version of the DM, so much the better. Actually, much of | |
| the text comes straight from the 5.5 DM, but was removed when objectloop | |
| was given expanded functionality in 6.0 The problem still remains, | |
| though, and this fixes the oversight. In addition, I added a couple | |
| definitions of routines I've found useful in my Inform coding, as well | |
| as noting slight mistake I found. | |
| -Lucian Smith | |
| --------- | |
| The following should be added to section 3.4, right after where it says | |
| "'objectloop (x provides wingspan) ...' executes the code ... for each | |
| object x in the game which is defined with a wingspan property.": | |
| --------- | |
| � Certain forms of objectloop cycle through the object tree instead of | |
| | simply looping over all objects in the game. This happens for the | |
| | keywords 'in', 'near', and (theoretically), 'from'. 'in' means through | |
| | all the children of the given object, 'near' means through all the | |
| | children of the parent of the object (including the object itself), and | |
| | 'from' means from the given object through its siblings. However, in | |
| | Inform 6.15, 'from' does not work. Also, you may not use 'near' or | |
| | 'from' as logical tests, as you can with 'in' (which really means | |
| | something different in this context). | |
| | | |
| | �WARNING | |
| | When using these keywords with objectloop, then, be careful if you are | |
| | altering the object tree at the same time. For instance, | |
| | | |
| | objectloop (x in rucksack) remove x; | |
| | | |
| | is likely to go horribly wrong - it's safer not to cut down a tree | |
| | while actually climbing it. The safe way is to keep lopping branches | |
| | off: | |
| | | |
| | while (child(x)~=0) remove child(x); | |
| --------- | |
| The following definitions should be added (in alphabetical order) to | |
| Appendix 7: "Library-defined objects and routines" | |
| --------- | |
| IndirectlyContains(x,y) | |
| Returns true if y is a child of x, or a child of a child of x, or a | |
| child of a child of a...(you get the idea). | |
| PrintOrRun(x, prop, flag) | |
| If x.prop is a string, this command prints the string, adds a new line, | |
| and returns '1' (if 'flag' is 1, the new line is not printed). If | |
| x.prop is a routine, this command acts as if 'x.prop()' was called, and | |
| returns whatever that routine returns. | |
| --------- | |
| Exercise 78 (from Section 27: Tokens of Grammar) and its answer refer | |
| you to Appendix 9 for the specification of NounDomain. They should | |
| actually refer you to Appendix 7. | |
Xet Storage Details
- Size:
- 2.57 kB
- Xet hash:
- d51d9569c0a919fb90fc4010c94751211eeb99aed35f6e6568f682f229fc0d08
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.