FILE IOPE

From Creatures Wikia

Jump to: navigation, search

FILE IOPE is a CAOS command which attaches something to the input stream.

Usage

Syntax: FILE IOPE dir (int) filename (string)

Attaches filename from dir to the current virtual machine's input stream. dir should be 0 for the current world journal, 1 for the main journal, or 2 for GAME engine_other_world's journal.

You should close the input stream with FILE ICLO after you are done reading from it.

If filename is not present, the command will succeed but the input stream will be bad immediately. Likewise if you attempt to traverse above the journal directory. Use INOK to check.

Consider FILE GLOB if you don't know the precise name of the file you need.

Examples

Is the world docked? Uses INNL.

FILE IOPE 0 "wtype"
DOIF INOK eq 0
  DBG: OUTS "huh?"
  FILE ICLO
  STOP
ELIF INNL eq "docked"
  OUTS "yes"
ELSE
  OUTS "no"
ENDI
FILE ICLO

Perhaps we need a good enough version of the engine, let's say 190 or above, otherwise we can't run. Uses INNI.

FILE IOPE 0 "build"
DOIF INOK eq 0 or INNI lt 190
  DBG: OUTS "uh oh!"
  FILE ICLO
  STOP
ENDI

See also

Personal tools