From Creatures Wikia
Syntax: FILE OOPE where (int) file (string) append (int)
Directs the output stream to file in directory specified by where, which should be 0 to use the current world's journal directory, 1 to use the game journal directory, or 2 to write to GAME engine_other_world's journal directory. append should be 0 to overwrite any existing file, or 1 to add to it.
You can use FVWM if you want to make sure you don't overwrite anything.
Use FILE OCLO to close the output stream when you're done. It will be closed automatically if the output stream is redirected again, the virtual machine is destroyed, or the engine exits.
Note that output stream direction can persist across scripts within an agent, if an agent is interrupted or issues a STOP instruction before it closes the stream. You can use INST to prevent this from happening, if it is important.
Write a list of the name of every known agent in the world to the file "ouragents" in the world's journal directory. Note that below we could use WILD instead of READ and the long string formation, if we didn't mind getting out "Unknown Agent" for undocumented ones. As it is we just ignore unknown agents.
FILE OOPE 0 "ouragents" 0 ENUM 0 0 0 SETS va00 "Agent Help " ADDS va00 VTOS FMLY ADDS va00 " " ADDS va00 VTOS GNUS ADDS va00 " " ADDS va00 VTOS SPCS DOIF REAQ va00 ne 0 OUTS READ va00 0 OUTS "\n" ENDI NEXT FILE OCLO
If you have an agent that does something important, you might like to log when it does. You could use the debug log, or if you want the data to be accessible from outside, you could send to a file, as follows. This will append to "mylog" in the world journal directory a line like "
Did my thing at 11:19:13 GMT, 18 Feb 2006, tick 630641."
SCRP 1 1 10644 1 INST * do your thing FILE OOPE 0 "mylog" 1 OUTS "Did my thing at " OUTS RTIF RTIM "%X %Z, %d %b %Y" OUTS ", tick " OUTS VTOS WTIK OUTS ".\n" FILE OCLO ENDM
See also DBG: HTML.