| 19.13. Writing, reading and appending text to files |
Text can also be saved to a file, and again all file-handling is automatic:
write "Jackdaws love my big sphinx of quartz." to the file of Abecedary Wisdom;
append "Jinxed wizards pluck ivy from the big quilt." to the file of Abecedary Wisdom;
The difference between "write" and "append" here is that "write" makes this text the entire contents of the file, whereas "append" adds it the end (creating the file if it did not previously exist).
The quoted text can, of course, contain substitutions, so can be long and complex if need be.
Text from a file is printed back with the text substitution:
"[text of the File of Abecedary Wisdom]"
To copy one file to another, for instance,
write "[text of the file of Abecedary Wisdom]" to the file of Secondary Wisdom;
|  Example The Fifth Body An expansion on the notebook, allowing the player somewhat more room in which to type his recorded remark. | |
|  Example Mirror, Mirror The sorcerer's mirror can, when held up high, form an impression of its surroundings which it then preserves. | |
"Mirror, Mirror"
The Sorcerer's Workshop is a room. "The sorcerer's den is a dusty, whispering place. A grandfather clock with skeletal hands reads [the time of day in words]. The floorboards are stained where that porridge just wouldn't come out."
The Apprentice's Pantry is east of the Workshop. "This is where the aproned apprentice traditionally makes the camomile tea, cleans out the jackdaw cages and furtively examines purloined artefacts."
The File of Mirror Vision is called "mirror". When play begins: erase the mirror.
The player carries a magic mirror.
To erase the mirror: write "The mirror is polished clean, and has no impression upon it." to the File of Mirror Vision.
To say current room description: try looking.
To expose the mirror:
say "The mirror shines momentarily with a dazzling light.";
write "The hazy image in the mirror preserves a past sight:[line break][current room description]All is distorted and yet living, as though the past and present are coterminous in the mirror." to the File of Mirror Vision.
Understand "hold up [something preferably held]" or "hold [something preferably held] up" as holding aloft. Holding aloft is an action applying to one carried thing. Report holding aloft: say "You hold [the noun] aloft."
Instead of rubbing the mirror: erase the mirror; try examining the mirror. Instead of holding aloft the mirror: expose the mirror.
The description of the mirror is "[text of the File of Mirror Vision]"
Test me with "look / examine mirror / hold up mirror / z / look / x mirror / rub mirror / east / hold mirror up / west / x mirror".
|